update dev300-m58
[ooovba.git] / canvas / source / directx / dx_bitmapcanvashelper.hxx
blob594859a64ee1c2210b9370799ddd791c484d6e72
1 /*************************************************************************
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4 *
5 * Copyright 2008 by Sun Microsystems, Inc.
7 * OpenOffice.org - a multi-platform office productivity suite
9 * $RCSfile: dx_bitmapcanvashelper.hxx,v $
10 * $Revision: 1.2 $
12 * This file is part of OpenOffice.org.
14 * OpenOffice.org is free software: you can redistribute it and/or modify
15 * it under the terms of the GNU Lesser General Public License version 3
16 * only, as published by the Free Software Foundation.
18 * OpenOffice.org is distributed in the hope that it will be useful,
19 * but WITHOUT ANY WARRANTY; without even the implied warranty of
20 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21 * GNU Lesser General Public License version 3 for more details
22 * (a copy is included in the LICENSE file that accompanied this code).
24 * You should have received a copy of the GNU Lesser General Public License
25 * version 3 along with OpenOffice.org. If not, see
26 * <http://www.openoffice.org/license.html>
27 * for a copy of the LGPLv3 License.
29 ************************************************************************/
31 #ifndef _DXCANVAS_BITMAPCANVASHELPER_HXX_
32 #define _DXCANVAS_BITMAPCANVASHELPER_HXX_
34 #include <com/sun/star/rendering/XCanvas.hpp>
36 #include <basegfx/vector/b2isize.hxx>
37 #include <basegfx/vector/b2dsize.hxx>
39 #include "dx_graphicsprovider.hxx"
40 #include "dx_ibitmap.hxx"
41 #include "dx_gdiplususer.hxx"
42 #include "dx_impltools.hxx"
43 #include "dx_canvashelper.hxx"
45 #include <boost/utility.hpp>
48 namespace dxcanvas
50 /** Helper class for basic canvas functionality. Also offers
51 optional backbuffer painting, when providing it with a second
52 HDC to render into.
54 class BitmapCanvasHelper : public CanvasHelper
56 public:
57 BitmapCanvasHelper();
59 /// Release all references
60 void disposing();
62 /** Set the target for rendering operations
64 @param rTarget
65 Render target
67 void setTarget( const IBitmapSharedPtr& rTarget );
69 /** Set the target for rendering operations
71 @param rTarget
72 Render target
74 @param rOutputOffset
75 Output offset in pixel
77 void setTarget( const IBitmapSharedPtr& rTarget,
78 const ::basegfx::B2ISize& rOutputOffset );
81 // CanvasHelper functionality is implementation-inherited. yuck.
82 // =============================================================
83 void clear();
85 ::com::sun::star::uno::Reference< ::com::sun::star::rendering::XCachedPrimitive >
86 drawTextLayout( const ::com::sun::star::rendering::XCanvas* pCanvas,
87 const ::com::sun::star::uno::Reference<
88 ::com::sun::star::rendering::XTextLayout >& layoutetText,
89 const ::com::sun::star::rendering::ViewState& viewState,
90 const ::com::sun::star::rendering::RenderState& renderState );
92 // BitmapCanvasHelper functionality
93 // ================================
95 void copyRect( const ::com::sun::star::rendering::XCanvas* pCanvas,
96 const ::com::sun::star::uno::Reference<
97 ::com::sun::star::rendering::XBitmapCanvas >& sourceCanvas,
98 const ::com::sun::star::geometry::RealRectangle2D& sourceRect,
99 const ::com::sun::star::rendering::ViewState& sourceViewState,
100 const ::com::sun::star::rendering::RenderState& sourceRenderState,
101 const ::com::sun::star::geometry::RealRectangle2D& destRect,
102 const ::com::sun::star::rendering::ViewState& destViewState,
103 const ::com::sun::star::rendering::RenderState& destRenderState );
105 ::com::sun::star::geometry::IntegerSize2D getSize();
107 ::com::sun::star::uno::Reference< ::com::sun::star::rendering::XBitmap >
108 getScaledBitmap( const ::com::sun::star::geometry::RealSize2D& newSize,
109 sal_Bool beFast );
111 ::com::sun::star::uno::Sequence< sal_Int8 >
112 getData( ::com::sun::star::rendering::IntegerBitmapLayout& bitmapLayout,
113 const ::com::sun::star::geometry::IntegerRectangle2D& rect );
115 void setData( const ::com::sun::star::uno::Sequence< sal_Int8 >& data,
116 const ::com::sun::star::rendering::IntegerBitmapLayout& bitmapLayout,
117 const ::com::sun::star::geometry::IntegerRectangle2D& rect );
119 void setPixel( const ::com::sun::star::uno::Sequence< sal_Int8 >& color,
120 const ::com::sun::star::rendering::IntegerBitmapLayout& bitmapLayout,
121 const ::com::sun::star::geometry::IntegerPoint2D& pos );
123 ::com::sun::star::uno::Sequence< sal_Int8 >
124 getPixel( ::com::sun::star::rendering::IntegerBitmapLayout& bitmapLayout,
125 const ::com::sun::star::geometry::IntegerPoint2D& pos );
127 ::com::sun::star::uno::Reference< ::com::sun::star::rendering::XBitmapPalette > getPalette();
129 ::com::sun::star::rendering::IntegerBitmapLayout getMemoryLayout();
131 bool hasAlpha() const;
133 protected:
134 /// Render target
135 IBitmapSharedPtr mpTarget;
139 #endif /* _DXCANVAS_BITMAPCANVASHELPER_HXX_ */