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 <drawinglayer/drawinglayerdllapi.h>
24 #include <drawinglayer/primitive2d/BufferedDecompositionPrimitive2D.hxx>
25 #include <basegfx/matrix/b2dhommatrix.hxx>
26 #include <drawinglayer/attribute/fillgraphicattribute.hxx>
27 #include <vcl/bitmapex.hxx>
29 namespace drawinglayer::primitive2d
31 class FillGraphicPrimitive2D
;
34 namespace drawinglayer::processor2d
36 // define a simple accessor which can be used as friend. That method exists
37 // only locally at SDPRProcessor2dTools.cxx and is thus only usable/callable
39 void setOffsetXYCreatedBitmap(
40 drawinglayer::primitive2d::FillGraphicPrimitive2D
&,
44 // FillbitmapPrimitive2D class
45 namespace drawinglayer::primitive2d
47 /** FillGraphicPrimitive2D class
49 This class defines a bitmap filling for a rectangular area. The
50 Range is defined by the Transformation, the fill by the FillGraphicAttribute.
51 There, the fill consists of a Bitmap (not transparent) defining the fill data
52 and a Point/Vector pair defining the relative position/size [0.0 .. 1.0]
53 inside the area where the bitmap is positioned. A flag defines then if this
56 Renderers should handle this primitive; it has a geometrically correct
57 decomposition, but on pixel outputs the areas where the tiled pieces are
58 aligned tend to show up (one overlapping or empty pixel)
60 class DRAWINGLAYER_DLLPUBLIC FillGraphicPrimitive2D final
: public BufferedDecompositionPrimitive2D
63 /// the geometric definition
64 basegfx::B2DHomMatrix maTransformation
;
66 /// the fill attributes
67 attribute::FillGraphicAttribute maFillGraphic
;
69 /// the evtl. buffered OffsetXYCreatedBitmap
70 BitmapEx maOffsetXYCreatedBitmap
;
72 /// local decomposition.
73 virtual void create2DDecomposition(Primitive2DContainer
& rContainer
, const geometry::ViewInformation2D
& rViewInformation
) const override
;
75 // allow this single accessor to change it to set buggered data
76 friend void drawinglayer::processor2d::setOffsetXYCreatedBitmap(
77 drawinglayer::primitive2d::FillGraphicPrimitive2D
&,
80 // private tooling method to be called by setOffsetXYCreatedBitmap
81 void impSetOffsetXYCreatedBitmap(const BitmapEx
& rBitmap
)
83 maOffsetXYCreatedBitmap
= rBitmap
;
88 FillGraphicPrimitive2D(
89 basegfx::B2DHomMatrix aTransformation
,
90 const attribute::FillGraphicAttribute
& rFillGraphic
);
93 const basegfx::B2DHomMatrix
& getTransformation() const { return maTransformation
; }
94 const attribute::FillGraphicAttribute
& getFillGraphic() const { return maFillGraphic
; }
95 const BitmapEx
& getOffsetXYCreatedBitmap() const { return maOffsetXYCreatedBitmap
; }
98 virtual bool operator==( const BasePrimitive2D
& rPrimitive
) const override
;
101 virtual basegfx::B2DRange
getB2DRange(const geometry::ViewInformation2D
& rViewInformation
) const override
;
103 /// provide unique ID
104 virtual sal_uInt32
getPrimitive2DID() const override
;
106 } // end of namespace drawinglayer::primitive2d
109 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */