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_VCL_CANVASBITMAPHELPER_HXX
21 #define INCLUDED_CANVAS_SOURCE_VCL_CANVASBITMAPHELPER_HXX
23 #include <canvashelper.hxx>
24 #include <canvas/vclwrapper.hxx>
26 #include <vcl/bitmapex.hxx>
28 #include "bitmapbackbuffer.hxx"
29 #include "spritecanvas.hxx"
34 /** Helper class for basic canvasbitmap functionality. Extends
35 CanvasHelper with some CanvasBitmap specialities, such as alpha
38 Note that a plain CanvasHelper, although it does support the
39 XBitmap interface, has no provision for alpha channel on VCL
40 (at least no efficient one. If the alpha VDev one day gets
41 part of SAL, we might change that).
43 class CanvasBitmapHelper
: public CanvasHelper
48 /** Set a new bitmap on this helper.
50 This method late-initializes the bitmap canvas helper,
51 providing it with the necessary device and output
52 objects. The internally stored bitmap representation is
53 updated from the given bitmap, including any size
54 changes. Note that the CanvasHelper does <em>not</em> take
55 ownership of the SpriteCanvas object, nor does it perform
56 any reference counting. Thus, to prevent reference counted
57 objects from deletion, the user of this class is
58 responsible for holding ref-counted references to those
62 Content of this bitmap is used as our new content (our
63 internal size is adapted to the size of the bitmap given)
66 Reference device for this canvas bitmap
68 @param rOutDevProvider
69 Reference output device. Used to create matching bitmap.
71 void init( const BitmapEx
& rBitmap
,
72 ::com::sun::star::rendering::XGraphicDevice
& rDevice
,
73 const OutDevProviderSharedPtr
& rOutDevProvider
);
76 // Overridden CanvasHelper functionality
77 // =====================================
83 ::com::sun::star::geometry::IntegerSize2D
getSize();
85 ::com::sun::star::uno::Reference
< ::com::sun::star::rendering::XBitmapCanvas
> queryBitmapCanvas();
87 ::com::sun::star::uno::Reference
< ::com::sun::star::rendering::XBitmap
>
88 getScaledBitmap( const ::com::sun::star::geometry::RealSize2D
& newSize
,
91 ::com::sun::star::uno::Sequence
< sal_Int8
>
92 getData( ::com::sun::star::rendering::IntegerBitmapLayout
& bitmapLayout
,
93 const ::com::sun::star::geometry::IntegerRectangle2D
& rect
);
95 void setData( const ::com::sun::star::uno::Sequence
< sal_Int8
>& data
,
96 const ::com::sun::star::rendering::IntegerBitmapLayout
& bitmapLayout
,
97 const ::com::sun::star::geometry::IntegerRectangle2D
& rect
);
99 void setPixel( const ::com::sun::star::uno::Sequence
< sal_Int8
>& color
,
100 const ::com::sun::star::rendering::IntegerBitmapLayout
& bitmapLayout
,
101 const ::com::sun::star::geometry::IntegerPoint2D
& pos
);
103 ::com::sun::star::uno::Sequence
< sal_Int8
>
104 getPixel( ::com::sun::star::rendering::IntegerBitmapLayout
& bitmapLayout
,
105 const ::com::sun::star::geometry::IntegerPoint2D
& pos
);
107 ::com::sun::star::rendering::IntegerBitmapLayout
getMemoryLayout();
110 BitmapEx
getBitmap() const;
114 void setBitmap( const BitmapEx
& rBitmap
);
116 BitmapBackBufferSharedPtr mpBackBuffer
;
117 OutDevProviderSharedPtr mpOutDevReference
;
121 #endif // INCLUDED_CANVAS_SOURCE_VCL_CANVASBITMAPHELPER_HXX
123 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */