Line data Source code
1 : /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 : /*
3 : * This file is part of the LibreOffice project.
4 : *
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/.
8 : */
9 :
10 : #ifndef INCLUDED_CANVAS_SOURCE_OPENGL_OGL_BITMAPCANVASHELPER_HXX
11 : #define INCLUDED_CANVAS_SOURCE_OPENGL_OGL_BITMAPCANVASHELPER_HXX
12 :
13 : #include <com/sun/star/rendering/XBitmapCanvas.hpp>
14 : #include <com/sun/star/rendering/XIntegerBitmap.hpp>
15 :
16 : #include <basegfx/vector/b2isize.hxx>
17 : #include <basegfx/vector/b2dsize.hxx>
18 :
19 : #include <boost/utility.hpp>
20 : #include <boost/shared_ptr.hpp>
21 : #include <vector>
22 :
23 : #include "ogl_canvashelper.hxx"
24 :
25 :
26 : namespace oglcanvas
27 : {
28 : /** Helper class for basic canvas functionality. */
29 0 : class BitmapCanvasHelper : public CanvasHelper
30 : {
31 : public:
32 : BitmapCanvasHelper();
33 :
34 : /// Release all references
35 : void disposing();
36 :
37 : /** Initialize canvas helper
38 :
39 : This method late-initializes the canvas helper, providing
40 : it with the necessary device and output objects. Note that
41 : the CanvasHelper does <em>not</em> take ownership of the
42 : passed rDevice reference, nor does it perform any
43 : reference counting. Thus, to prevent the reference counted
44 : SpriteCanvas object from deletion, the user of this class
45 : is responsible for holding ref-counted references itself!
46 :
47 : @param rDevice
48 : Reference device this canvas is associated with
49 :
50 : */
51 : void init( ::com::sun::star::rendering::XGraphicDevice& rDevice,
52 : SpriteDeviceHelper& rDeviceHelper,
53 : const ::com::sun::star::geometry::IntegerSize2D& rSize );
54 :
55 : // BitmapCanvasHelper functionality
56 : // ================================
57 :
58 : void copyRect( const ::com::sun::star::rendering::XCanvas* rCanvas,
59 : const ::com::sun::star::uno::Reference<
60 : ::com::sun::star::rendering::XBitmapCanvas >& sourceCanvas,
61 : const ::com::sun::star::geometry::RealRectangle2D& sourceRect,
62 : const ::com::sun::star::rendering::ViewState& sourceViewState,
63 : const ::com::sun::star::rendering::RenderState& sourceRenderState,
64 : const ::com::sun::star::geometry::RealRectangle2D& destRect,
65 : const ::com::sun::star::rendering::ViewState& destViewState,
66 : const ::com::sun::star::rendering::RenderState& destRenderState );
67 :
68 0 : ::com::sun::star::geometry::IntegerSize2D getSize() { return maSize; }
69 :
70 : ::com::sun::star::uno::Reference< ::com::sun::star::rendering::XBitmapCanvas > queryBitmapCanvas();
71 :
72 : ::com::sun::star::uno::Reference< ::com::sun::star::rendering::XBitmap >
73 : getScaledBitmap( const ::com::sun::star::geometry::RealSize2D& newSize,
74 : bool beFast );
75 :
76 : ::com::sun::star::uno::Sequence< sal_Int8 >
77 : getData( ::com::sun::star::rendering::IntegerBitmapLayout& bitmapLayout,
78 : const ::com::sun::star::geometry::IntegerRectangle2D& rect );
79 :
80 : void setData( const ::com::sun::star::uno::Sequence< sal_Int8 >& data,
81 : const ::com::sun::star::rendering::IntegerBitmapLayout& bitmapLayout,
82 : const ::com::sun::star::geometry::IntegerRectangle2D& rect );
83 :
84 : void setPixel( const ::com::sun::star::uno::Sequence< sal_Int8 >& color,
85 : const ::com::sun::star::rendering::IntegerBitmapLayout& bitmapLayout,
86 : const ::com::sun::star::geometry::IntegerPoint2D& pos );
87 :
88 : ::com::sun::star::uno::Sequence< sal_Int8 >
89 : getPixel( ::com::sun::star::rendering::IntegerBitmapLayout& bitmapLayout,
90 : const ::com::sun::star::geometry::IntegerPoint2D& pos );
91 :
92 : ::com::sun::star::rendering::IntegerBitmapLayout getMemoryLayout();
93 :
94 : bool hasAlpha() const;
95 :
96 : private:
97 : ::com::sun::star::geometry::IntegerSize2D maSize;
98 : };
99 : }
100 :
101 : #endif
102 :
103 : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|