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  * This file incorporates work covered by the following license notice:
10  *
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 .
18  */
19 
20 #ifndef INCLUDED_DRAWINGLAYER_SOURCE_TOOLS_EMFPBRUSH_HXX
21 #define INCLUDED_DRAWINGLAYER_SOURCE_TOOLS_EMFPBRUSH_HXX
22 
23 #include "emfphelperdata.hxx"
24 #include <tools/color.hxx>
25 
26 namespace emfplushelper
27 {
28     enum EmfPlusHatchStyle
29     {
30         HatchStyleHorizontal = 0x00000000,
31         HatchStyleVertical = 0x00000001,
32         HatchStyleForwardDiagonal = 0x00000002,
33         HatchStyleBackwardDiagonal = 0x00000003,
34         HatchStyleLargeGrid = 0x00000004,
35         HatchStyleDiagonalCross = 0x00000005,
36         HatchStyle05Percent = 0x00000006,
37         HatchStyle10Percent = 0x00000007,
38         HatchStyle20Percent = 0x00000008,
39         HatchStyle25Percent = 0x00000009,
40         HatchStyle30Percent = 0x0000000A,
41         HatchStyle40Percent = 0x0000000B,
42         HatchStyle50Percent = 0x0000000C,
43         HatchStyle60Percent = 0x0000000D,
44         HatchStyle70Percent = 0x0000000E,
45         HatchStyle75Percent = 0x0000000F,
46         HatchStyle80Percent = 0x00000010,
47         HatchStyle90Percent = 0x00000011,
48         HatchStyleLightDownwardDiagonal = 0x00000012,
49         HatchStyleLightUpwardDiagonal = 0x00000013,
50         HatchStyleDarkDownwardDiagonal = 0x00000014,
51         HatchStyleDarkUpwardDiagonal = 0x00000015,
52         HatchStyleWideDownwardDiagonal = 0x00000016,
53         HatchStyleWideUpwardDiagonal = 0x00000017,
54         HatchStyleLightVertical = 0x00000018,
55         HatchStyleLightHorizontal = 0x00000019,
56         HatchStyleNarrowVertical = 0x0000001A,
57         HatchStyleNarrowHorizontal = 0x0000001B,
58         HatchStyleDarkVertical = 0x0000001C,
59         HatchStyleDarkHorizontal = 0x0000001D,
60         HatchStyleDashedDownwardDiagonal = 0x0000001E,
61         HatchStyleDashedUpwardDiagonal = 0x0000001F,
62         HatchStyleDashedHorizontal = 0x00000020,
63         HatchStyleDashedVertical = 0x00000021,
64         HatchStyleSmallConfetti = 0x00000022,
65         HatchStyleLargeConfetti = 0x00000023,
66         HatchStyleZigZag = 0x00000024,
67         HatchStyleWave = 0x00000025,
68         HatchStyleDiagonalBrick = 0x00000026,
69         HatchStyleHorizontalBrick = 0x00000027,
70         HatchStyleWeave = 0x00000028,
71         HatchStylePlaid = 0x00000029,
72         HatchStyleDivot = 0x0000002A,
73         HatchStyleDottedGrid = 0x0000002B,
74         HatchStyleDottedDiamond = 0x0000002C,
75         HatchStyleShingle = 0x0000002D,
76         HatchStyleTrellis = 0x0000002E,
77         HatchStyleSphere = 0x0000002F,
78         HatchStyleSmallGrid = 0x00000030,
79         HatchStyleSmallCheckerBoard = 0x00000031,
80         HatchStyleLargeCheckerBoard = 0x00000032,
81         HatchStyleOutlinedDiamond = 0x00000033,
82         HatchStyleSolidDiamond = 0x00000034
83     };
84 
85     enum EmfPlusBrushType
86     {
87         BrushTypeSolidColor = 0x00000000,
88         BrushTypeHatchFill = 0x00000001,
89         BrushTypeTextureFill = 0x00000002,
90         BrushTypePathGradient = 0x00000003,
91         BrushTypeLinearGradient = 0x00000004
92     };
93 
94     struct EMFPPath;
95 
96     struct EMFPBrush : public EMFPObject
97     {
98         ::Color solidColor;
99         sal_uInt32 type;
100         sal_uInt32 additionalFlags;
101 
102         /* linear gradient */
103         sal_Int32 wrapMode;
104         float firstPointX, firstPointY, secondPointX, secondPointY;
105         ::Color secondColor; // first color is stored in solidColor;
106         basegfx::B2DHomMatrix brush_transformation;
107         bool hasTransformation;
108         sal_Int32 blendPoints;
109         std::unique_ptr<float[]> blendPositions;
110         float* blendFactors;
111         sal_Int32 colorblendPoints;
112         std::unique_ptr<float[]> colorblendPositions;
113         std::unique_ptr<::Color[]> colorblendColors;
114         sal_Int32 surroundColorsNumber;
115         std::unique_ptr<::Color[]> surroundColors;
116         std::unique_ptr<EMFPPath> path;
117         EmfPlusHatchStyle hatchStyle;
118 
119         EMFPBrush();
120         virtual ~EMFPBrush() override;
121 
GetTypeemfplushelper::EMFPBrush122         sal_uInt32 GetType() const { return type; }
GetColoremfplushelper::EMFPBrush123         const ::Color& GetColor() const { return solidColor; }
124 
125         void Read(SvStream& s, EmfPlusHelperData const & rR);
126     };
127 }
128 
129 #endif
130 
131 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
132