1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
3 * This file is part of the LibreOffice project.
5 * This Source Code Form is subject to the terms of the Mozilla Public
6 * License, v. 2.0. If a copy of the MPL was not distributed with this
7 * file, You can obtain one at http://mozilla.org/MPL/2.0/.
9 * This file incorporates work covered by the following license notice:
11 * Licensed to the Apache Software Foundation (ASF) under one or more
12 * contributor license agreements. See the NOTICE file distributed
13 * with this work for additional information regarding copyright
14 * ownership. The ASF licenses this file to you under the Apache
15 * License, Version 2.0 (the "License"); you may not use this file
16 * except in compliance with the License. You may obtain a copy of
17 * the License at http://www.apache.org/licenses/LICENSE-2.0 .
20 #ifndef INCLUDED_CANVAS_SOURCE_DIRECTX_DX_BITMAPCANVASHELPER_HXX
21 #define INCLUDED_CANVAS_SOURCE_DIRECTX_DX_BITMAPCANVASHELPER_HXX
23 #include <com/sun/star/rendering/XCanvas.hpp>
24 #include <com/sun/star/rendering/XBitmapCanvas.hpp>
26 #include <basegfx/vector/b2isize.hxx>
27 #include <basegfx/vector/b2dsize.hxx>
29 #include "dx_graphicsprovider.hxx"
30 #include "dx_ibitmap.hxx"
31 #include "dx_gdiplususer.hxx"
32 #include "dx_impltools.hxx"
33 #include "dx_canvashelper.hxx"
35 #include <boost/utility.hpp>
40 /** Helper class for basic canvas functionality. Also offers
41 optional backbuffer painting, when providing it with a second
44 class BitmapCanvasHelper
: public CanvasHelper
49 /// Release all references
52 /** Set the target for rendering operations
57 void setTarget( const IBitmapSharedPtr
& rTarget
);
59 /** Set the target for rendering operations
65 Output offset in pixel
67 void setTarget( const IBitmapSharedPtr
& rTarget
,
68 const ::basegfx::B2ISize
& rOutputOffset
);
71 // CanvasHelper functionality is implementation-inherited. yuck.
72 // =============================================================
75 ::com::sun::star::uno::Reference
< ::com::sun::star::rendering::XCachedPrimitive
>
76 drawTextLayout( const ::com::sun::star::rendering::XCanvas
* pCanvas
,
77 const ::com::sun::star::uno::Reference
<
78 ::com::sun::star::rendering::XTextLayout
>& laidOutText
,
79 const ::com::sun::star::rendering::ViewState
& viewState
,
80 const ::com::sun::star::rendering::RenderState
& renderState
);
82 // BitmapCanvasHelper functionality
83 // ================================
85 void copyRect( const ::com::sun::star::rendering::XCanvas
* pCanvas
,
86 const ::com::sun::star::uno::Reference
<
87 ::com::sun::star::rendering::XBitmapCanvas
>& sourceCanvas
,
88 const ::com::sun::star::geometry::RealRectangle2D
& sourceRect
,
89 const ::com::sun::star::rendering::ViewState
& sourceViewState
,
90 const ::com::sun::star::rendering::RenderState
& sourceRenderState
,
91 const ::com::sun::star::geometry::RealRectangle2D
& destRect
,
92 const ::com::sun::star::rendering::ViewState
& destViewState
,
93 const ::com::sun::star::rendering::RenderState
& destRenderState
);
95 ::com::sun::star::geometry::IntegerSize2D
getSize();
97 ::com::sun::star::uno::Reference
< ::com::sun::star::rendering::XBitmap
>
98 getScaledBitmap( const ::com::sun::star::geometry::RealSize2D
& newSize
,
101 ::com::sun::star::uno::Sequence
< sal_Int8
>
102 getData( ::com::sun::star::rendering::IntegerBitmapLayout
& bitmapLayout
,
103 const ::com::sun::star::geometry::IntegerRectangle2D
& rect
);
105 void setData( const ::com::sun::star::uno::Sequence
< sal_Int8
>& data
,
106 const ::com::sun::star::rendering::IntegerBitmapLayout
& bitmapLayout
,
107 const ::com::sun::star::geometry::IntegerRectangle2D
& rect
);
109 void setPixel( const ::com::sun::star::uno::Sequence
< sal_Int8
>& color
,
110 const ::com::sun::star::rendering::IntegerBitmapLayout
& bitmapLayout
,
111 const ::com::sun::star::geometry::IntegerPoint2D
& pos
);
113 ::com::sun::star::uno::Sequence
< sal_Int8
>
114 getPixel( ::com::sun::star::rendering::IntegerBitmapLayout
& bitmapLayout
,
115 const ::com::sun::star::geometry::IntegerPoint2D
& pos
);
117 ::com::sun::star::uno::Reference
< ::com::sun::star::rendering::XBitmapPalette
> getPalette();
119 ::com::sun::star::rendering::IntegerBitmapLayout
getMemoryLayout();
121 bool hasAlpha() const;
125 IBitmapSharedPtr mpTarget
;
129 #endif // INCLUDED_CANVAS_SOURCE_DIRECTX_DX_BITMAPCANVASHELPER_HXX
131 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */