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 <vcl/gradient.hxx>
24 using namespace ::com::sun::star
;
26 // ---------------------------------------------------------------
28 CGMOutAct::CGMOutAct( CGM
& rCGM
)
32 mnGroupActCount
= mnGroupLevel
= 0;
33 mpGroupLevel
= new sal_uInt32
[ CGM_OUTACT_MAX_GROUP_LEVEL
];
34 mpPoints
= (Point
*)new sal_Int8
[ 0x2000 * sizeof( Point
) ];
35 mpFlags
= new sal_uInt8
[ 0x2000 ];
41 // ---------------------------------------------------------------
43 CGMOutAct::~CGMOutAct()
45 delete[] (sal_Int8
*) mpPoints
;
47 delete[] mpGroupLevel
;
53 // ---------------------------------------------------------------
55 void CGMOutAct::BeginFigure()
64 // ---------------------------------------------------------------
66 void CGMOutAct::CloseRegion()
71 DrawPolyPolygon( maPolyPolygon
);
72 maPolyPolygon
.Clear();
76 // ---------------------------------------------------------------
78 void CGMOutAct::NewRegion()
82 Polygon
aPolygon( mnIndex
, mpPoints
, mpFlags
);
83 maPolyPolygon
.Insert( aPolygon
);
88 // ---------------------------------------------------------------
90 void CGMOutAct::EndFigure()
93 DrawPolyPolygon( maPolyPolygon
);
94 maPolyPolygon
.Clear();
99 // ---------------------------------------------------------------
101 void CGMOutAct::RegPolyLine( Polygon
& rPolygon
, sal_Bool bReverse
)
103 sal_uInt16 nPoints
= rPolygon
.GetSize();
108 for ( sal_uInt16 i
= 0; i
< nPoints
; i
++ )
110 mpPoints
[ mnIndex
+ i
] = rPolygon
.GetPoint( nPoints
- i
- 1 );
111 mpFlags
[ mnIndex
+ i
] = (sal_Int8
)rPolygon
.GetFlags( nPoints
- i
- 1 );
116 for ( sal_uInt16 i
= 0; i
< nPoints
; i
++ )
118 mpPoints
[ mnIndex
+ i
] = rPolygon
.GetPoint( i
);
119 mpFlags
[ mnIndex
+ i
] = (sal_Int8
)rPolygon
.GetFlags( i
);
122 mnIndex
= mnIndex
+ nPoints
;
126 // ---------------------------------------------------------------
128 void CGMOutAct::SetGradientOffset( long nHorzOfs
, long nVertOfs
, sal_uInt32
/*nType*/ )
131 mpGradient
= new awt::Gradient
;
132 mpGradient
->XOffset
= ( (sal_uInt16
)nHorzOfs
& 0x7f );
133 mpGradient
->YOffset
= ( (sal_uInt16
)nVertOfs
& 0x7f );
136 // ---------------------------------------------------------------
138 void CGMOutAct::SetGradientAngle( long nAngle
)
141 mpGradient
= new awt::Gradient
;
142 mpGradient
->Angle
= sal::static_int_cast
< sal_Int16
>(nAngle
);
145 // ---------------------------------------------------------------
147 void CGMOutAct::SetGradientDescriptor( sal_uInt32 nColorFrom
, sal_uInt32 nColorTo
)
150 mpGradient
= new awt::Gradient
;
151 mpGradient
->StartColor
= nColorFrom
;
152 mpGradient
->EndColor
= nColorTo
;
155 // ---------------------------------------------------------------
157 void CGMOutAct::SetGradientStyle( sal_uInt32 nStyle
, double /*fRatio*/ )
160 mpGradient
= new awt::Gradient
;
165 mpGradient
->Style
= awt::GradientStyle_AXIAL
;
170 mpGradient
->Style
= awt::GradientStyle_RADIAL
; // CONICAL
175 mpGradient
->Style
= awt::GradientStyle_RECT
;
180 mpGradient
->Style
= awt::GradientStyle_ELLIPTICAL
;
185 mpGradient
->Style
= awt::GradientStyle_LINEAR
;
191 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */