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