1 /*************************************************************************
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
5 * Copyright 2008 by Sun Microsystems, Inc.
7 * OpenOffice.org - a multi-platform office productivity suite
9 * $RCSfile: canvasbitmaphelper.hxx,v $
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 _VCLCANVAS_CANVASBITMAPHELPER_HXX_
32 #define _VCLCANVAS_CANVASBITMAPHELPER_HXX_
34 #include <canvashelper.hxx>
35 #include <canvas/vclwrapper.hxx>
37 #include <vcl/bitmapex.hxx>
39 #include "bitmapbackbuffer.hxx"
40 #include "spritecanvas.hxx"
45 /** Helper class for basic canvasbitmap functionality. Extends
46 CanvasHelper with some CanvasBitmap specialities, such as alpha
49 Note that a plain CanvasHelper, although it does support the
50 XBitmap interface, has no provision for alpha channel on VCL
51 (at least no efficient one. If the alpha VDev one day gets
52 part of SAL, we might change that).
54 class CanvasBitmapHelper
: public CanvasHelper
59 /** Set a new bitmap on this helper.
61 This method late-initializes the bitmap canvas helper,
62 providing it with the necessary device and output
63 objects. The internally stored bitmap representation is
64 updated from the given bitmap, including any size
65 changes. Note that the CanvasHelper does <em>not</em> take
66 ownership of the SpriteCanvas object, nor does it perform
67 any reference counting. Thus, to prevent reference counted
68 objects from deletion, the user of this class is
69 responsible for holding ref-counted references to those
73 Content of this bitmap is used as our new content (our
74 internal size is adapted to the size of the bitmap given)
77 Reference device for this canvas bitmap
79 @param rOutDevProvider
80 Reference output device. Used to create matching bitmap.
82 void init( const BitmapEx
& rBitmap
,
83 ::com::sun::star::rendering::XGraphicDevice
& rDevice
,
84 const OutDevProviderSharedPtr
& rOutDevProvider
);
87 // Overridden CanvasHelper functionality
88 // =====================================
94 ::com::sun::star::geometry::IntegerSize2D
getSize();
96 ::com::sun::star::uno::Reference
< ::com::sun::star::rendering::XBitmapCanvas
> queryBitmapCanvas();
98 ::com::sun::star::uno::Reference
< ::com::sun::star::rendering::XBitmap
>
99 getScaledBitmap( const ::com::sun::star::geometry::RealSize2D
& newSize
,
102 ::com::sun::star::uno::Sequence
< sal_Int8
>
103 getData( ::com::sun::star::rendering::IntegerBitmapLayout
& bitmapLayout
,
104 const ::com::sun::star::geometry::IntegerRectangle2D
& rect
);
106 void setData( const ::com::sun::star::uno::Sequence
< sal_Int8
>& data
,
107 const ::com::sun::star::rendering::IntegerBitmapLayout
& bitmapLayout
,
108 const ::com::sun::star::geometry::IntegerRectangle2D
& rect
);
110 void setPixel( const ::com::sun::star::uno::Sequence
< sal_Int8
>& color
,
111 const ::com::sun::star::rendering::IntegerBitmapLayout
& bitmapLayout
,
112 const ::com::sun::star::geometry::IntegerPoint2D
& pos
);
114 ::com::sun::star::uno::Sequence
< sal_Int8
>
115 getPixel( ::com::sun::star::rendering::IntegerBitmapLayout
& bitmapLayout
,
116 const ::com::sun::star::geometry::IntegerPoint2D
& pos
);
118 ::com::sun::star::rendering::IntegerBitmapLayout
getMemoryLayout();
121 BitmapEx
getBitmap() const;
125 void setBitmap( const BitmapEx
& rBitmap
);
127 BitmapBackBufferSharedPtr mpBackBuffer
;
128 OutDevProviderSharedPtr mpOutDevReference
;
132 #endif /* _VCLCANVAS_CANVASBITMAPHELPER_HXX_ */