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 .
22 #include <com/sun/star/rendering/XCanvas.hpp>
23 #include <com/sun/star/rendering/XBitmapCanvas.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"
37 /** Helper class for basic canvas functionality. Also offers
38 optional backbuffer painting, when providing it with a second
41 class BitmapCanvasHelper
: public CanvasHelper
46 /// Release all references
49 /** Set the target for rendering operations
54 void setTarget( const IBitmapSharedPtr
& rTarget
);
56 /** Set the target for rendering operations
62 Output offset in pixel
64 void setTarget( const IBitmapSharedPtr
& rTarget
,
65 const ::basegfx::B2ISize
& rOutputOffset
);
68 // CanvasHelper functionality is implementation-inherited. yuck.
69 // =============================================================
72 css::uno::Reference
< css::rendering::XCachedPrimitive
>
73 drawTextLayout( const css::rendering::XCanvas
* pCanvas
,
74 const css::uno::Reference
<
75 css::rendering::XTextLayout
>& laidOutText
,
76 const css::rendering::ViewState
& viewState
,
77 const css::rendering::RenderState
& renderState
);
79 // BitmapCanvasHelper functionality
80 // ================================
82 void copyRect( const css::rendering::XCanvas
* pCanvas
,
83 const css::uno::Reference
<
84 css::rendering::XBitmapCanvas
>& sourceCanvas
,
85 const css::geometry::RealRectangle2D
& sourceRect
,
86 const css::rendering::ViewState
& sourceViewState
,
87 const css::rendering::RenderState
& sourceRenderState
,
88 const css::geometry::RealRectangle2D
& destRect
,
89 const css::rendering::ViewState
& destViewState
,
90 const css::rendering::RenderState
& destRenderState
);
92 css::geometry::IntegerSize2D
getSize();
94 css::uno::Reference
< css::rendering::XBitmap
>
95 getScaledBitmap( const css::geometry::RealSize2D
& newSize
,
98 css::uno::Sequence
< sal_Int8
>
99 getData( css::rendering::IntegerBitmapLayout
& bitmapLayout
,
100 const css::geometry::IntegerRectangle2D
& rect
);
102 void setData( const css::uno::Sequence
< sal_Int8
>& data
,
103 const css::rendering::IntegerBitmapLayout
& bitmapLayout
,
104 const css::geometry::IntegerRectangle2D
& rect
);
106 void setPixel( const css::uno::Sequence
< sal_Int8
>& color
,
107 const css::rendering::IntegerBitmapLayout
& bitmapLayout
,
108 const css::geometry::IntegerPoint2D
& pos
);
110 css::uno::Sequence
< sal_Int8
>
111 getPixel( css::rendering::IntegerBitmapLayout
& bitmapLayout
,
112 const css::geometry::IntegerPoint2D
& pos
);
114 css::uno::Reference
< css::rendering::XBitmapPalette
> getPalette();
116 css::rendering::IntegerBitmapLayout
getMemoryLayout();
118 bool hasAlpha() const;
122 IBitmapSharedPtr mpTarget
;
126 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */