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 "canvashelper.hxx"
24 #include <vcl/bitmapex.hxx>
26 #include "bitmapbackbuffer.hxx"
31 /** Helper class for basic canvasbitmap functionality. Extends
32 CanvasHelper with some CanvasBitmap specialities, such as alpha
35 Note that a plain CanvasHelper, although it does support the
36 XBitmap interface, has no provision for alpha channel on VCL
37 (at least no efficient one. If the alpha VDev one day gets
38 part of SAL, we might change that).
40 class CanvasBitmapHelper
: public CanvasHelper
45 /** Set a new bitmap on this helper.
47 This method late-initializes the bitmap canvas helper,
48 providing it with the necessary device and output
49 objects. The internally stored bitmap representation is
50 updated from the given bitmap, including any size
51 changes. Note that the CanvasHelper does <em>not</em> take
52 ownership of the SpriteCanvas object, nor does it perform
53 any reference counting. Thus, to prevent reference counted
54 objects from deletion, the user of this class is
55 responsible for holding ref-counted references to those
59 Content of this bitmap is used as our new content (our
60 internal size is adapted to the size of the bitmap given)
63 Reference device for this canvas bitmap
65 @param rOutDevProvider
66 Reference output device. Used to create matching bitmap.
68 void init( const BitmapEx
& rBitmap
,
69 css::rendering::XGraphicDevice
& rDevice
,
70 const OutDevProviderSharedPtr
& rOutDevProvider
);
73 // Overridden CanvasHelper functionality
74 // =====================================
80 css::geometry::IntegerSize2D
getSize() const;
82 css::uno::Reference
< css::rendering::XBitmap
>
83 getScaledBitmap( const css::geometry::RealSize2D
& newSize
,
86 css::uno::Sequence
< sal_Int8
>
87 getData( css::rendering::IntegerBitmapLayout
& bitmapLayout
,
88 const css::geometry::IntegerRectangle2D
& rect
);
90 css::uno::Sequence
< sal_Int8
>
91 getPixel( css::rendering::IntegerBitmapLayout
& bitmapLayout
,
92 const css::geometry::IntegerPoint2D
& pos
);
94 css::rendering::IntegerBitmapLayout
getMemoryLayout() const;
97 BitmapEx
getBitmap() const;
101 BitmapBackBufferSharedPtr mpBackBuffer
;
102 OutDevProviderSharedPtr mpOutDevReference
;
106 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */