1 /*************************************************************************
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
5 * Copyright 2000, 2010 Oracle and/or its affiliates.
7 * OpenOffice.org - a multi-platform office productivity suite
9 * This file is part of OpenOffice.org.
11 * OpenOffice.org is free software: you can redistribute it and/or modify
12 * it under the terms of the GNU Lesser General Public License version 3
13 * only, as published by the Free Software Foundation.
15 * OpenOffice.org is distributed in the hope that it will be useful,
16 * but WITHOUT ANY WARRANTY; without even the implied warranty of
17 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18 * GNU Lesser General Public License version 3 for more details
19 * (a copy is included in the LICENSE file that accompanied this code).
21 * You should have received a copy of the GNU Lesser General Public License
22 * version 3 along with OpenOffice.org. If not, see
23 * <http://www.openoffice.org/license.html>
24 * for a copy of the LGPLv3 License.
26 ************************************************************************/
28 #ifndef _DXCANVAS_BITMAPCANVASHELPER_HXX_
29 #define _DXCANVAS_BITMAPCANVASHELPER_HXX_
31 #include <com/sun/star/rendering/XCanvas.hpp>
33 #include <basegfx/vector/b2isize.hxx>
34 #include <basegfx/vector/b2dsize.hxx>
36 #include "dx_graphicsprovider.hxx"
37 #include "dx_ibitmap.hxx"
38 #include "dx_gdiplususer.hxx"
39 #include "dx_impltools.hxx"
40 #include "dx_canvashelper.hxx"
42 #include <boost/utility.hpp>
47 /** Helper class for basic canvas functionality. Also offers
48 optional backbuffer painting, when providing it with a second
51 class BitmapCanvasHelper
: public CanvasHelper
56 /// Release all references
59 /** Set the target for rendering operations
64 void setTarget( const IBitmapSharedPtr
& rTarget
);
66 /** Set the target for rendering operations
72 Output offset in pixel
74 void setTarget( const IBitmapSharedPtr
& rTarget
,
75 const ::basegfx::B2ISize
& rOutputOffset
);
78 // CanvasHelper functionality is implementation-inherited. yuck.
79 // =============================================================
82 ::com::sun::star::uno::Reference
< ::com::sun::star::rendering::XCachedPrimitive
>
83 drawTextLayout( const ::com::sun::star::rendering::XCanvas
* pCanvas
,
84 const ::com::sun::star::uno::Reference
<
85 ::com::sun::star::rendering::XTextLayout
>& layoutetText
,
86 const ::com::sun::star::rendering::ViewState
& viewState
,
87 const ::com::sun::star::rendering::RenderState
& renderState
);
89 // BitmapCanvasHelper functionality
90 // ================================
92 void copyRect( const ::com::sun::star::rendering::XCanvas
* pCanvas
,
93 const ::com::sun::star::uno::Reference
<
94 ::com::sun::star::rendering::XBitmapCanvas
>& sourceCanvas
,
95 const ::com::sun::star::geometry::RealRectangle2D
& sourceRect
,
96 const ::com::sun::star::rendering::ViewState
& sourceViewState
,
97 const ::com::sun::star::rendering::RenderState
& sourceRenderState
,
98 const ::com::sun::star::geometry::RealRectangle2D
& destRect
,
99 const ::com::sun::star::rendering::ViewState
& destViewState
,
100 const ::com::sun::star::rendering::RenderState
& destRenderState
);
102 ::com::sun::star::geometry::IntegerSize2D
getSize();
104 ::com::sun::star::uno::Reference
< ::com::sun::star::rendering::XBitmap
>
105 getScaledBitmap( const ::com::sun::star::geometry::RealSize2D
& newSize
,
108 ::com::sun::star::uno::Sequence
< sal_Int8
>
109 getData( ::com::sun::star::rendering::IntegerBitmapLayout
& bitmapLayout
,
110 const ::com::sun::star::geometry::IntegerRectangle2D
& rect
);
112 void setData( const ::com::sun::star::uno::Sequence
< sal_Int8
>& data
,
113 const ::com::sun::star::rendering::IntegerBitmapLayout
& bitmapLayout
,
114 const ::com::sun::star::geometry::IntegerRectangle2D
& rect
);
116 void setPixel( const ::com::sun::star::uno::Sequence
< sal_Int8
>& color
,
117 const ::com::sun::star::rendering::IntegerBitmapLayout
& bitmapLayout
,
118 const ::com::sun::star::geometry::IntegerPoint2D
& pos
);
120 ::com::sun::star::uno::Sequence
< sal_Int8
>
121 getPixel( ::com::sun::star::rendering::IntegerBitmapLayout
& bitmapLayout
,
122 const ::com::sun::star::geometry::IntegerPoint2D
& pos
);
124 ::com::sun::star::uno::Reference
< ::com::sun::star::rendering::XBitmapPalette
> getPalette();
126 ::com::sun::star::rendering::IntegerBitmapLayout
getMemoryLayout();
128 bool hasAlpha() const;
132 IBitmapSharedPtr mpTarget
;
136 #endif /* _DXCANVAS_BITMAPCANVASHELPER_HXX_ */