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 _DXCANVAS_BITMAPCANVASHELPER_HXX_
21 #define _DXCANVAS_BITMAPCANVASHELPER_HXX_
23 #include <com/sun/star/rendering/XCanvas.hpp>
25 #include <basegfx/vector/b2isize.hxx>
26 #include <basegfx/vector/b2dsize.hxx>
28 #include "dx_graphicsprovider.hxx"
29 #include "dx_ibitmap.hxx"
30 #include "dx_gdiplususer.hxx"
31 #include "dx_impltools.hxx"
32 #include "dx_canvashelper.hxx"
34 #include <boost/utility.hpp>
39 /** Helper class for basic canvas functionality. Also offers
40 optional backbuffer painting, when providing it with a second
43 class BitmapCanvasHelper
: public CanvasHelper
48 /// Release all references
51 /** Set the target for rendering operations
56 void setTarget( const IBitmapSharedPtr
& rTarget
);
58 /** Set the target for rendering operations
64 Output offset in pixel
66 void setTarget( const IBitmapSharedPtr
& rTarget
,
67 const ::basegfx::B2ISize
& rOutputOffset
);
70 // CanvasHelper functionality is implementation-inherited. yuck.
71 // =============================================================
74 ::com::sun::star::uno::Reference
< ::com::sun::star::rendering::XCachedPrimitive
>
75 drawTextLayout( const ::com::sun::star::rendering::XCanvas
* pCanvas
,
76 const ::com::sun::star::uno::Reference
<
77 ::com::sun::star::rendering::XTextLayout
>& layoutetText
,
78 const ::com::sun::star::rendering::ViewState
& viewState
,
79 const ::com::sun::star::rendering::RenderState
& renderState
);
81 // BitmapCanvasHelper functionality
82 // ================================
84 void copyRect( const ::com::sun::star::rendering::XCanvas
* pCanvas
,
85 const ::com::sun::star::uno::Reference
<
86 ::com::sun::star::rendering::XBitmapCanvas
>& sourceCanvas
,
87 const ::com::sun::star::geometry::RealRectangle2D
& sourceRect
,
88 const ::com::sun::star::rendering::ViewState
& sourceViewState
,
89 const ::com::sun::star::rendering::RenderState
& sourceRenderState
,
90 const ::com::sun::star::geometry::RealRectangle2D
& destRect
,
91 const ::com::sun::star::rendering::ViewState
& destViewState
,
92 const ::com::sun::star::rendering::RenderState
& destRenderState
);
94 ::com::sun::star::geometry::IntegerSize2D
getSize();
96 ::com::sun::star::uno::Reference
< ::com::sun::star::rendering::XBitmap
>
97 getScaledBitmap( const ::com::sun::star::geometry::RealSize2D
& newSize
,
100 ::com::sun::star::uno::Sequence
< sal_Int8
>
101 getData( ::com::sun::star::rendering::IntegerBitmapLayout
& bitmapLayout
,
102 const ::com::sun::star::geometry::IntegerRectangle2D
& rect
);
104 void setData( const ::com::sun::star::uno::Sequence
< sal_Int8
>& data
,
105 const ::com::sun::star::rendering::IntegerBitmapLayout
& bitmapLayout
,
106 const ::com::sun::star::geometry::IntegerRectangle2D
& rect
);
108 void setPixel( const ::com::sun::star::uno::Sequence
< sal_Int8
>& color
,
109 const ::com::sun::star::rendering::IntegerBitmapLayout
& bitmapLayout
,
110 const ::com::sun::star::geometry::IntegerPoint2D
& pos
);
112 ::com::sun::star::uno::Sequence
< sal_Int8
>
113 getPixel( ::com::sun::star::rendering::IntegerBitmapLayout
& bitmapLayout
,
114 const ::com::sun::star::geometry::IntegerPoint2D
& pos
);
116 ::com::sun::star::uno::Reference
< ::com::sun::star::rendering::XBitmapPalette
> getPalette();
118 ::com::sun::star::rendering::IntegerBitmapLayout
getMemoryLayout();
120 bool hasAlpha() const;
124 IBitmapSharedPtr mpTarget
;
128 #endif /* _DXCANVAS_BITMAPCANVASHELPER_HXX_ */
130 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */