MCGR: Reduce diverse GradientStyle enums to single UNO API one

Change-Id: Ie0cd26a308a75ddead9451c53e874a39cc6eeb63
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/150705
Tested-by: Jenkins
Reviewed-by: Armin Le Grand <Armin.Le.Grand@me.com>
This commit is contained in:
Armin Le Grand (allotropia)
2023-04-21 15:03:14 +02:00
committed by Armin Le Grand
parent 0293724d05
commit dccd82b5ac
51 changed files with 194 additions and 394 deletions
@@ -160,7 +160,7 @@ namespace vclcanvas
aLeftBottom -= 2.0*nDiagonalLength*aDirection;
aRightTop += 2.0*nDiagonalLength*aDirection;
aRightBottom += 2.0*nDiagonalLength*aDirection;
Gradient vclGradient( GradientStyle::Linear, rColors[ 0 ], rColors[ 1 ] );
Gradient vclGradient( css::awt::GradientStyle_LINEAR, rColors[ 0 ], rColors[ 1 ] );
::tools::Polygon aTempPoly( static_cast<sal_uInt16>(5) );
aTempPoly[0] = ::Point( ::basegfx::fround( aLeftTop.getX() ),
::basegfx::fround( aLeftTop.getY() ) );
@@ -185,7 +185,7 @@ namespace vclcanvas
aLeftBottom -= 2.0*nDiagonalLength*aDirection;
aRightTop += 2.0*nDiagonalLength*aDirection;
aRightBottom += 2.0*nDiagonalLength*aDirection;
Gradient vclGradient( GradientStyle::Axial, rColors[ 1 ], rColors[ 0 ] );
Gradient vclGradient( css::awt::GradientStyle_AXIAL, rColors[ 1 ], rColors[ 0 ] );
::tools::Polygon aTempPoly( static_cast<sal_uInt16>(5) );
aTempPoly[0] = ::Point( ::basegfx::fround( aLeftTop.getX() ),
::basegfx::fround( aLeftTop.getY() ) );
@@ -549,7 +549,7 @@ namespace cppcanvas::internal
uno::Sequence< uno::Sequence < double > > aColors;
uno::Sequence< double > aStops;
if( rGradient.GetStyle() == GradientStyle::Axial )
if( rGradient.GetStyle() == css::awt::GradientStyle_AXIAL )
{
aStops = { 0.0, 0.5, 1.0 };
aColors = { aEndColor, aStartColor, aEndColor };
@@ -575,7 +575,7 @@ namespace cppcanvas::internal
OUString aGradientService;
switch( rGradient.GetStyle() )
{
case GradientStyle::Linear:
case css::awt::GradientStyle_LINEAR:
aGradInfo = basegfx::utils::createLinearODFGradientInfo(
aBounds,
nSteps,
@@ -587,7 +587,7 @@ namespace cppcanvas::internal
aGradientService = "LinearGradient";
break;
case GradientStyle::Axial:
case css::awt::GradientStyle_AXIAL:
{
// Adapt the border so that it is suitable
// for the axial gradient. An axial
@@ -621,7 +621,7 @@ namespace cppcanvas::internal
break;
}
case GradientStyle::Radial:
case css::awt::GradientStyle_RADIAL:
aGradInfo = basegfx::utils::createRadialODFGradientInfo(
aBounds,
aOffset,
@@ -630,7 +630,7 @@ namespace cppcanvas::internal
aGradientService = "EllipticalGradient";
break;
case GradientStyle::Elliptical:
case css::awt::GradientStyle_ELLIPTICAL:
aGradInfo = basegfx::utils::createEllipticalODFGradientInfo(
aBounds,
aOffset,
@@ -640,7 +640,7 @@ namespace cppcanvas::internal
aGradientService = "EllipticalGradient";
break;
case GradientStyle::Square:
case css::awt::GradientStyle_SQUARE:
aGradInfo = basegfx::utils::createSquareODFGradientInfo(
aBounds,
aOffset,
@@ -650,7 +650,7 @@ namespace cppcanvas::internal
aGradientService = "RectangularGradient";
break;
case GradientStyle::Rect:
case css::awt::GradientStyle_RECT:
aGradInfo = basegfx::utils::createRectangularODFGradientInfo(
aBounds,
aOffset,
+1 -1
View File
@@ -61,7 +61,7 @@ public:
basegfx::B2DRange definitionRange(0, 0, 100, 200);
basegfx::B2DRange outputRange(0, 100, 100, 200); // Paint only lower half of the gradient.
attribute::FillGradientAttribute attributes(
attribute::GradientStyle::Linear, 0, 0, 0, 0,
css::awt::GradientStyle_LINEAR, 0, 0, 0, 0,
basegfx::utils::createColorStopsFromStartEndColor(COL_WHITE.getBColor(),
COL_BLACK.getBColor()));
rtl::Reference<primitive2d::FillGradientPrimitive2D> gradientPrimitive(
@@ -31,11 +31,11 @@ namespace drawinglayer::attribute
double mfOffsetY;
double mfAngle;
basegfx::ColorStops maColorStops;
GradientStyle meStyle;
css::awt::GradientStyle meStyle;
sal_uInt16 mnSteps;
ImpFillGradientAttribute(
GradientStyle eStyle,
css::awt::GradientStyle eStyle,
double fBorder,
double fOffsetX,
double fOffsetY,
@@ -74,7 +74,7 @@ namespace drawinglayer::attribute
mfOffsetY(0.0),
mfAngle(0.0),
maColorStops(),
meStyle(GradientStyle::Linear),
meStyle(css::awt::GradientStyle_LINEAR),
mnSteps(0)
{
// always add a fallback color, see above
@@ -82,7 +82,7 @@ namespace drawinglayer::attribute
}
// data read access
GradientStyle getStyle() const { return meStyle; }
css::awt::GradientStyle getStyle() const { return meStyle; }
double getBorder() const { return mfBorder; }
double getOffsetX() const { return mfOffsetX; }
double getOffsetY() const { return mfOffsetY; }
@@ -121,7 +121,7 @@ namespace drawinglayer::attribute
}
FillGradientAttribute::FillGradientAttribute(
GradientStyle eStyle,
css::awt::GradientStyle eStyle,
double fBorder,
double fOffsetX,
double fOffsetY,
@@ -179,9 +179,9 @@ namespace drawinglayer::attribute
// is different from processing the gradient manually by drawinglayer
// (and the Writer unittest for it fails). Keep using the drawinglayer code
// until somebody founds out what's wrong and fixes it.
if (getStyle() != drawinglayer::attribute::GradientStyle::Linear
&& getStyle() != drawinglayer::attribute::GradientStyle::Axial
&& getStyle() != drawinglayer::attribute::GradientStyle::Radial)
if (getStyle() != css::awt::GradientStyle_LINEAR
&& getStyle() != css::awt::GradientStyle_AXIAL
&& getStyle() != css::awt::GradientStyle_RADIAL)
{
return true;
}
@@ -227,7 +227,7 @@ namespace drawinglayer::attribute
return mpFillGradientAttribute->getAngle();
}
GradientStyle FillGradientAttribute::getStyle() const
css::awt::GradientStyle FillGradientAttribute::getStyle() const
{
return mpFillGradientAttribute->getStyle();
}
@@ -32,14 +32,14 @@ using namespace com::sun::star;
namespace drawinglayer::primitive2d
{
// Get the OuterColor. Take into account that for attribute::GradientStyle::Axial
// Get the OuterColor. Take into account that for css::awt::GradientStyle_AXIAL
// this is the last one due to inverted gradient usage (see constructor there)
basegfx::BColor FillGradientPrimitive2D::getOuterColor() const
{
if (getFillGradient().getColorStops().empty())
return basegfx::BColor();
if (attribute::GradientStyle::Axial == getFillGradient().getStyle())
if (css::awt::GradientStyle_AXIAL == getFillGradient().getStyle())
return getFillGradient().getColorStops().back().getStopColor();
return getFillGradient().getColorStops().front().getStopColor();
@@ -48,8 +48,8 @@ namespace drawinglayer::primitive2d
// Get the needed UnitPolygon dependent on the GradientStyle
basegfx::B2DPolygon FillGradientPrimitive2D::getUnitPolygon() const
{
if (attribute::GradientStyle::Radial == getFillGradient().getStyle()
|| attribute::GradientStyle::Elliptical == getFillGradient().getStyle())
if (css::awt::GradientStyle_RADIAL == getFillGradient().getStyle()
|| css::awt::GradientStyle_ELLIPTICAL == getFillGradient().getStyle())
{
return basegfx::utils::createPolygonFromCircle(basegfx::B2DPoint(0.0, 0.0), 1.0);
}
@@ -62,7 +62,8 @@ namespace drawinglayer::primitive2d
{
switch(getFillGradient().getStyle())
{
case attribute::GradientStyle::Linear:
default: // GradientStyle_MAKE_FIXED_SIZE
case css::awt::GradientStyle_LINEAR:
{
texture::GeoTexSvxGradientLinear aGradient(
getDefinitionRange(),
@@ -74,7 +75,7 @@ namespace drawinglayer::primitive2d
aGradient.appendTransformationsAndColors(aCallback);
break;
}
case attribute::GradientStyle::Axial:
case css::awt::GradientStyle_AXIAL:
{
texture::GeoTexSvxGradientAxial aGradient(
getDefinitionRange(),
@@ -86,7 +87,7 @@ namespace drawinglayer::primitive2d
aGradient.appendTransformationsAndColors(aCallback);
break;
}
case attribute::GradientStyle::Radial:
case css::awt::GradientStyle_RADIAL:
{
texture::GeoTexSvxGradientRadial aGradient(
getDefinitionRange(),
@@ -98,7 +99,7 @@ namespace drawinglayer::primitive2d
aGradient.appendTransformationsAndColors(aCallback);
break;
}
case attribute::GradientStyle::Elliptical:
case css::awt::GradientStyle_ELLIPTICAL:
{
texture::GeoTexSvxGradientElliptical aGradient(
getDefinitionRange(),
@@ -111,7 +112,7 @@ namespace drawinglayer::primitive2d
aGradient.appendTransformationsAndColors(aCallback);
break;
}
case attribute::GradientStyle::Square:
case css::awt::GradientStyle_SQUARE:
{
texture::GeoTexSvxGradientSquare aGradient(
getDefinitionRange(),
@@ -124,7 +125,7 @@ namespace drawinglayer::primitive2d
aGradient.appendTransformationsAndColors(aCallback);
break;
}
case attribute::GradientStyle::Rect:
case css::awt::GradientStyle_RECT:
{
texture::GeoTexSvxGradientRect aGradient(
getDefinitionRange(),
@@ -99,7 +99,7 @@ namespace drawinglayer::primitive3d
basegfx::ColorStop(0.0, aGray),
basegfx::ColorStop(1.0, aGray) };
const attribute::FillGradientAttribute aFillGradient(attribute::GradientStyle::Linear, 0.0, 0.0, 0.0, 0.0, aColorStops);
const attribute::FillGradientAttribute aFillGradient(css::awt::GradientStyle_LINEAR, 0.0, 0.0, 0.0, 0.0, aColorStops);
const Primitive3DReference xRef(new TransparenceTexturePrimitive3D(aFillGradient, getChildren(), getTextureSize()));
return { xRef };
}
@@ -285,40 +285,7 @@ void VclMetafileProcessor2D::impConvertFillGradientAttributeToVCLGradient(
// defaults for intensity; those were computed into the start/end colors already
o_rVCLGradient.SetStartIntensity(100);
o_rVCLGradient.SetEndIntensity(100);
switch (rFiGrAtt.getStyle())
{
default: // attribute::GradientStyle::Linear :
{
o_rVCLGradient.SetStyle(GradientStyle::Linear);
break;
}
case attribute::GradientStyle::Axial:
{
o_rVCLGradient.SetStyle(GradientStyle::Axial);
break;
}
case attribute::GradientStyle::Radial:
{
o_rVCLGradient.SetStyle(GradientStyle::Radial);
break;
}
case attribute::GradientStyle::Elliptical:
{
o_rVCLGradient.SetStyle(GradientStyle::Elliptical);
break;
}
case attribute::GradientStyle::Square:
{
o_rVCLGradient.SetStyle(GradientStyle::Square);
break;
}
case attribute::GradientStyle::Rect:
{
o_rVCLGradient.SetStyle(GradientStyle::Rect);
break;
}
}
o_rVCLGradient.SetStyle(rFiGrAtt.getStyle());
}
void VclMetafileProcessor2D::impStartSvtGraphicFill(SvtGraphicFill const* pSvtGraphicFill)
@@ -2078,16 +2045,16 @@ void VclMetafileProcessor2D::processPolyPolygonGradientPrimitive2D(
switch (aVCLGradient.GetStyle())
{
default: // GradientStyle::Linear:
case GradientStyle::Axial:
default: // css::awt::GradientStyle_LINEAR:
case css::awt::GradientStyle_AXIAL:
eGrad = SvtGraphicFill::GradientType::Linear;
break;
case GradientStyle::Radial:
case GradientStyle::Elliptical:
case css::awt::GradientStyle_RADIAL:
case css::awt::GradientStyle_ELLIPTICAL:
eGrad = SvtGraphicFill::GradientType::Radial;
break;
case GradientStyle::Square:
case GradientStyle::Rect:
case css::awt::GradientStyle_SQUARE:
case css::awt::GradientStyle_RECT:
eGrad = SvtGraphicFill::GradientType::Rectangular;
break;
}
@@ -2269,7 +2236,7 @@ void VclMetafileProcessor2D::processUnifiedTransparencePrimitive2D(
basegfx::fround(rUniTransparenceCandidate.getTransparence() * 255.0)));
const Color aTransColor(nTransPercentVcl, nTransPercentVcl, nTransPercentVcl);
aVCLGradient.SetStyle(GradientStyle::Linear);
aVCLGradient.SetStyle(css::awt::GradientStyle_LINEAR);
aVCLGradient.SetStartColor(aTransColor);
aVCLGradient.SetEndColor(aTransColor);
aVCLGradient.SetAngle(0_deg10);
@@ -185,32 +185,6 @@ bool VclPixelProcessor2D::tryDrawPolygonStrokePrimitive2DDirect(
rSource.getLineAttribute().getMiterMinimumAngle());
}
namespace
{
GradientStyle convertGradientStyle(drawinglayer::attribute::GradientStyle eGradientStyle)
{
switch (eGradientStyle)
{
case drawinglayer::attribute::GradientStyle::Axial:
return GradientStyle::Axial;
case drawinglayer::attribute::GradientStyle::Radial:
return GradientStyle::Radial;
case drawinglayer::attribute::GradientStyle::Elliptical:
return GradientStyle::Elliptical;
case drawinglayer::attribute::GradientStyle::Square:
return GradientStyle::Square;
case drawinglayer::attribute::GradientStyle::Rect:
return GradientStyle::Rect;
case drawinglayer::attribute::GradientStyle::Linear:
return GradientStyle::Linear;
default:
assert(false);
return GradientStyle::Linear;
}
}
} // end anonymous namespace
void VclPixelProcessor2D::processBasePrimitive2D(const primitive2d::BasePrimitive2D& rCandidate)
{
switch (rCandidate.getPrimitive2DID())
@@ -1053,9 +1027,8 @@ void VclPixelProcessor2D::processFillGradientPrimitive2D(
// try to use vcl - since vcl uses the old gradient paint mechanisms this may
// create wrong geometries. If so, add another case above for useDecompose
GradientStyle eGradientStyle = convertGradientStyle(rFillGradient.getStyle());
Gradient aGradient(eGradientStyle, Color(rFillGradient.getColorStops().front().getStopColor()),
Gradient aGradient(rFillGradient.getStyle(),
Color(rFillGradient.getColorStops().front().getStopColor()),
Color(rFillGradient.getColorStops().back().getStopColor()));
aGradient.SetAngle(Degree10(static_cast<int>(basegfx::rad2deg<10>(rFillGradient.getAngle()))));
@@ -59,14 +59,15 @@ namespace drawinglayer::processor3d
// create texture
const attribute::FillGradientAttribute& rFillGradient = rPrimitive.getGradient();
const basegfx::B2DRange aOutlineRange(0.0, 0.0, rPrimitive.getTextureSize().getX(), rPrimitive.getTextureSize().getY());
const attribute::GradientStyle aGradientStyle(rFillGradient.getStyle());
const css::awt::GradientStyle aGradientStyle(rFillGradient.getStyle());
std::shared_ptr< texture::GeoTexSvx > pNewTex;
if(!rFillGradient.hasSingleColor())
{
switch(aGradientStyle)
{
case attribute::GradientStyle::Linear:
default: // GradientStyle_MAKE_FIXED_SIZE
case css::awt::GradientStyle_LINEAR:
{
pNewTex = std::make_shared<texture::GeoTexSvxGradientLinear>(
aOutlineRange,
@@ -77,7 +78,7 @@ namespace drawinglayer::processor3d
rFillGradient.getAngle());
break;
}
case attribute::GradientStyle::Axial:
case css::awt::GradientStyle_AXIAL:
{
pNewTex = std::make_shared<texture::GeoTexSvxGradientAxial>(
aOutlineRange,
@@ -88,7 +89,7 @@ namespace drawinglayer::processor3d
rFillGradient.getAngle());
break;
}
case attribute::GradientStyle::Radial:
case css::awt::GradientStyle_RADIAL:
{
pNewTex =
std::make_shared<texture::GeoTexSvxGradientRadial>(
@@ -100,7 +101,7 @@ namespace drawinglayer::processor3d
rFillGradient.getOffsetY());
break;
}
case attribute::GradientStyle::Elliptical:
case css::awt::GradientStyle_ELLIPTICAL:
{
pNewTex =
std::make_shared<texture::GeoTexSvxGradientElliptical>(
@@ -113,7 +114,7 @@ namespace drawinglayer::processor3d
rFillGradient.getAngle());
break;
}
case attribute::GradientStyle::Square:
case css::awt::GradientStyle_SQUARE:
{
pNewTex =
std::make_shared<texture::GeoTexSvxGradientSquare>(
@@ -126,7 +127,7 @@ namespace drawinglayer::processor3d
rFillGradient.getAngle());
break;
}
case attribute::GradientStyle::Rect:
case css::awt::GradientStyle_RECT:
{
pNewTex =
std::make_shared<texture::GeoTexSvxGradientRect>(
@@ -276,22 +276,23 @@ void writeSdrFillAttribute(::tools::XmlWriter& rWriter,
rWriter.startElement("gradient");
switch (rGradient.getStyle())
{
case drawinglayer::attribute::GradientStyle::Linear:
default: // GradientStyle_MAKE_FIXED_SIZE
case css::awt::GradientStyle_LINEAR:
rWriter.attribute("style", "Linear");
break;
case drawinglayer::attribute::GradientStyle::Axial:
case css::awt::GradientStyle_AXIAL:
rWriter.attribute("style", "Axial");
break;
case drawinglayer::attribute::GradientStyle::Radial:
case css::awt::GradientStyle_RADIAL:
rWriter.attribute("style", "Radial");
break;
case drawinglayer::attribute::GradientStyle::Elliptical:
case css::awt::GradientStyle_ELLIPTICAL:
rWriter.attribute("style", "Elliptical");
break;
case drawinglayer::attribute::GradientStyle::Square:
case css::awt::GradientStyle_SQUARE:
rWriter.attribute("style", "Square");
break;
case drawinglayer::attribute::GradientStyle::Rect:
case css::awt::GradientStyle_RECT:
rWriter.attribute("style", "Rect");
break;
}
+1 -37
View File
@@ -675,44 +675,8 @@ namespace wmfemfhelper
aEnd = interpolate(aBlack, aEnd, static_cast<double>(nEndIntens) * 0.01);
}
drawinglayer::attribute::GradientStyle aGradientStyle(drawinglayer::attribute::GradientStyle::Rect);
switch(rGradient.GetStyle())
{
case GradientStyle::Linear :
{
aGradientStyle = drawinglayer::attribute::GradientStyle::Linear;
break;
}
case GradientStyle::Axial :
{
aGradientStyle = drawinglayer::attribute::GradientStyle::Axial;
break;
}
case GradientStyle::Radial :
{
aGradientStyle = drawinglayer::attribute::GradientStyle::Radial;
break;
}
case GradientStyle::Elliptical :
{
aGradientStyle = drawinglayer::attribute::GradientStyle::Elliptical;
break;
}
case GradientStyle::Square :
{
aGradientStyle = drawinglayer::attribute::GradientStyle::Square;
break;
}
default : // GradientStyle::Rect
{
aGradientStyle = drawinglayer::attribute::GradientStyle::Rect;
break;
}
}
return drawinglayer::attribute::FillGradientAttribute(
aGradientStyle,
rGradient.GetStyle(),
static_cast<double>(rGradient.GetBorder()) * 0.01,
static_cast<double>(rGradient.GetOfsX()) * 0.01,
static_cast<double>(rGradient.GetOfsY()) * 0.01,
+1 -1
View File
@@ -408,7 +408,7 @@ void EscherPropertyContainer::CreateGradientProperties(
nFillType = ESCHER_FillShadeScale;
nAngle = (rGradient.Angle * 0x10000) / 10;
nFillFocus = (sal::static_int_cast<int>(rGradient.Style) ==
sal::static_int_cast<int>(GradientStyle::Linear)) ? 0 : 50;
sal::static_int_cast<int>(css::awt::GradientStyle_LINEAR)) ? 0 : 50;
}
break;
case awt::GradientStyle_RADIAL :
+10 -10
View File
@@ -219,8 +219,8 @@ void SVGAttributeWriter::AddPaintAttr( const Color& rLineColor, const Color& rFi
void SVGAttributeWriter::AddGradientDef( const tools::Rectangle& rObjRect, const Gradient& rGradient, OUString& rGradientId )
{
if( rObjRect.GetWidth() && rObjRect.GetHeight() &&
( rGradient.GetStyle() == GradientStyle::Linear || rGradient.GetStyle() == GradientStyle::Axial ||
rGradient.GetStyle() == GradientStyle::Radial || rGradient.GetStyle() == GradientStyle::Elliptical ) )
( rGradient.GetStyle() == css::awt::GradientStyle_LINEAR || rGradient.GetStyle() == css::awt::GradientStyle_AXIAL ||
rGradient.GetStyle() == css::awt::GradientStyle_RADIAL || rGradient.GetStyle() == css::awt::GradientStyle_ELLIPTICAL ) )
{
SvXMLElementExport aDesc( mrExport, XML_NAMESPACE_NONE, aXMLElemDefs, true, true );
Color aStartColor( rGradient.GetStartColor() ), aEndColor( rGradient.GetEndColor() );
@@ -248,7 +248,7 @@ void SVGAttributeWriter::AddGradientDef( const tools::Rectangle& rObjRect, const
std::unique_ptr< SvXMLElementExport > apGradient;
OUString aColorStr;
if( rGradient.GetStyle() == GradientStyle::Linear || rGradient.GetStyle() == GradientStyle::Axial )
if( rGradient.GetStyle() == css::awt::GradientStyle_LINEAR || rGradient.GetStyle() == css::awt::GradientStyle_AXIAL )
{
tools::Polygon aLinePoly( 2 );
@@ -267,9 +267,9 @@ void SVGAttributeWriter::AddGradientDef( const tools::Rectangle& rObjRect, const
// write stop values
double fBorder = static_cast< double >( rGradient.GetBorder() ) *
( ( rGradient.GetStyle() == GradientStyle::Axial ) ? 0.005 : 0.01 );
( ( rGradient.GetStyle() == css::awt::GradientStyle_AXIAL ) ? 0.005 : 0.01 );
ImplGetColorStr( ( rGradient.GetStyle() == GradientStyle::Axial ) ? aEndColor : aStartColor, aColorStr );
ImplGetColorStr( ( rGradient.GetStyle() == css::awt::GradientStyle_AXIAL ) ? aEndColor : aStartColor, aColorStr );
mrExport.AddAttribute( XML_NAMESPACE_NONE, aXMLAttrOffset, OUString::number( fBorder ) );
mrExport.AddAttribute( XML_NAMESPACE_NONE, aXMLAttrStopColor, aColorStr );
@@ -277,7 +277,7 @@ void SVGAttributeWriter::AddGradientDef( const tools::Rectangle& rObjRect, const
SvXMLElementExport aDesc2( mrExport, XML_NAMESPACE_NONE, aXMLElemStop, true, true );
}
if( rGradient.GetStyle() == GradientStyle::Axial )
if( rGradient.GetStyle() == css::awt::GradientStyle_AXIAL )
{
ImplGetColorStr( aStartColor, aColorStr );
mrExport.AddAttribute( XML_NAMESPACE_NONE, aXMLAttrOffset, OUString::number( 0.5 ) );
@@ -288,7 +288,7 @@ void SVGAttributeWriter::AddGradientDef( const tools::Rectangle& rObjRect, const
}
}
if( rGradient.GetStyle() != GradientStyle::Axial )
if( rGradient.GetStyle() != css::awt::GradientStyle_AXIAL )
fBorder = 0.0;
ImplGetColorStr( aEndColor, aColorStr );
@@ -2315,8 +2315,8 @@ void SVGActionWriter::ImplWritePattern( const tools::PolyPolygon& rPolyPoly,
void SVGActionWriter::ImplWriteGradientEx( const tools::PolyPolygon& rPolyPoly, const Gradient& rGradient,
sal_uInt32 nWriteFlags)
{
if ( rGradient.GetStyle() == GradientStyle::Linear ||
rGradient.GetStyle() == GradientStyle::Axial )
if ( rGradient.GetStyle() == css::awt::GradientStyle_LINEAR ||
rGradient.GetStyle() == css::awt::GradientStyle_AXIAL )
{
ImplWriteGradientLinear( rPolyPoly, rGradient );
}
@@ -2376,7 +2376,7 @@ void SVGActionWriter::ImplWriteGradientLinear( const tools::PolyPolygon& rPolyPo
const Color aEndColor = ImplGetColorWithIntensity( rGradient.GetEndColor(), rGradient.GetEndIntensity() );
double fBorderOffset = rGradient.GetBorder() / 100.0;
const sal_uInt16 nSteps = rGradient.GetSteps();
if( rGradient.GetStyle() == GradientStyle::Linear )
if( rGradient.GetStyle() == css::awt::GradientStyle_LINEAR )
{
// Emulate non-smooth gradient
if( 0 < nSteps && nSteps < 100 )
@@ -21,6 +21,7 @@
#include <drawinglayer/drawinglayerdllapi.h>
#include <o3tl/cow_wrapper.hxx>
#include <com/sun/star/awt/GradientStyle.hpp>
#include <vector>
namespace basegfx
@@ -34,16 +35,6 @@ namespace drawinglayer::attribute
{
class ImpFillGradientAttribute;
enum class GradientStyle
{
Linear,
Axial,
Radial,
Elliptical,
Square,
Rect
};
class DRAWINGLAYER_DLLPUBLIC FillGradientAttribute
{
public:
@@ -73,8 +64,8 @@ public:
but (existing) fallbacks to filled polygon can trigger.
*/
/// constructors/assignmentoperator/destructor
FillGradientAttribute(GradientStyle eStyle, double fBorder, double fOffsetX, double fOffsetY,
double fAngle, const basegfx::ColorStops& rColorStops,
FillGradientAttribute(css::awt::GradientStyle eStyle, double fBorder, double fOffsetX,
double fOffsetY, double fAngle, const basegfx::ColorStops& rColorStops,
sal_uInt16 nSteps = 0);
FillGradientAttribute();
FillGradientAttribute(const FillGradientAttribute&);
@@ -100,7 +91,7 @@ public:
bool operator==(const FillGradientAttribute& rCandidate) const;
// data read access
GradientStyle getStyle() const;
css::awt::GradientStyle getStyle() const;
double getBorder() const;
double getOffsetX() const;
double getOffsetY() const;
+4 -3
View File
@@ -28,6 +28,7 @@
#include <vcl/dllapi.h>
#include <vcl/vclenum.hxx>
#include <com/sun/star/awt/GradientStyle.hpp>
namespace tools { class Rectangle; }
@@ -45,13 +46,13 @@ public:
Gradient();
Gradient( const Gradient& rGradient );
Gradient( Gradient&& rGradient );
Gradient( GradientStyle eStyle,
Gradient( css::awt::GradientStyle eStyle,
const Color& rStartColor,
const Color& rEndColor );
~Gradient();
void SetStyle( GradientStyle eStyle );
GradientStyle GetStyle() const;
void SetStyle( css::awt::GradientStyle eStyle );
css::awt::GradientStyle GetStyle() const;
void SetStartColor( const Color& rColor );
const Color& GetStartColor() const;
-12
View File
@@ -141,18 +141,6 @@ enum class ExtDateFieldFormat
FORCE_EQUAL_SIZE=SAL_MAX_ENUM
};
// this appears to be a direct copy of css::awt::GradientStyle
enum class GradientStyle
{
Linear = 0,
Axial = 1,
Radial = 2,
Elliptical = 3,
Square = 4,
Rect = 5,
FORCE_EQUAL_SIZE = SAL_MAX_ENUM
};
enum class HatchStyle
{
Single = 0,
+1 -1
View File
@@ -62,7 +62,7 @@ void OEndMarker::Paint(vcl::RenderContext& rRenderContext, const tools::Rectangl
aStartColor.RGBtoHSB(nHue, nSat, nBri);
nSat += 40;
Color aEndColor(Color::HSBtoRGB(nHue, nSat, nBri));
Gradient aGradient(GradientStyle::Linear, aStartColor, aEndColor);
Gradient aGradient(css::awt::GradientStyle_LINEAR, aStartColor, aEndColor);
aGradient.SetSteps(static_cast<sal_uInt16>(aSize.Height()));
rRenderContext.DrawGradient(PixelToLogic(aPoly), aGradient);
@@ -128,7 +128,7 @@ void OStartMarker::Paint(vcl::RenderContext& rRenderContext, const tools::Rectan
aStartColor.RGBtoHSB(nHue, nSat, nBri);
nSat += 40;
Color aEndColor(Color::HSBtoRGB(nHue, nSat, nBri));
Gradient aGradient(GradientStyle::Linear,aStartColor,aEndColor);
Gradient aGradient(css::awt::GradientStyle_LINEAR,aStartColor,aEndColor);
aGradient.SetSteps(static_cast<sal_uInt16>(aSize.Height()));
rRenderContext.DrawGradient(PixelToLogic(aPoly) ,aGradient);
+1 -1
View File
@@ -404,7 +404,7 @@ void ScZoomSlider::DoPaint(vcl::RenderContext& rRenderContext)
Gradient aGradient;
aGradient.SetAngle(0_deg10);
aGradient.SetStyle(GradientStyle::Linear);
aGradient.SetStyle(css::awt::GradientStyle_LINEAR);
aGradient.SetStartColor(aStartColor);
aGradient.SetEndColor(aEndColor);
+1 -1
View File
@@ -869,7 +869,7 @@ void drawDataBars(vcl::RenderContext& rRenderContext, const ScDataBarInfo* pOldD
if(pOldDataBarInfo->mbGradient)
{
rRenderContext.SetLineColor(pOldDataBarInfo->maColor);
Gradient aGradient(GradientStyle::Linear, pOldDataBarInfo->maColor, COL_TRANSPARENT);
Gradient aGradient(css::awt::GradientStyle_LINEAR, pOldDataBarInfo->maColor, COL_TRANSPARENT);
aGradient.SetSteps(255);
if(pOldDataBarInfo->mnLength < 0)
@@ -77,7 +77,7 @@ void AnnotationTextWindow::Paint(vcl::RenderContext& rRenderContext, const ::too
if (!bHighContrast)
{
rRenderContext.DrawGradient(::tools::Rectangle(Point(0,0), rRenderContext.PixelToLogic(aSize)),
Gradient(GradientStyle::Linear, mrContents.maColorLight, mrContents.maColor));
Gradient(css::awt::GradientStyle_LINEAR, mrContents.maColorLight, mrContents.maColor));
}
DoPaint(rRenderContext, rRect);
@@ -384,7 +384,7 @@ void PageObjectPainter::PaintBackgroundDetail (
const Color aBottomColor(mpTheme->GetGradientColor(eColorType, Theme::GradientColorClass::Fill2));
if (aTopColor != aBottomColor)
{
Gradient gradient(GradientStyle::Linear, aTopColor, aBottomColor);
Gradient gradient(css::awt::GradientStyle_LINEAR, aTopColor, aBottomColor);
rDevice.DrawGradient(aPageObjectBox, gradient);
}
else
@@ -93,37 +93,6 @@ namespace drawinglayer
{
namespace
{
attribute::GradientStyle XGradientStyleToGradientStyle(css::awt::GradientStyle eStyle)
{
switch(eStyle)
{
case css::awt::GradientStyle_LINEAR :
{
return attribute::GradientStyle::Linear;
}
case css::awt::GradientStyle_AXIAL :
{
return attribute::GradientStyle::Axial;
}
case css::awt::GradientStyle_RADIAL :
{
return attribute::GradientStyle::Radial;
}
case css::awt::GradientStyle_ELLIPTICAL :
{
return attribute::GradientStyle::Elliptical;
}
case css::awt::GradientStyle_SQUARE :
{
return attribute::GradientStyle::Square;
}
default :
{
return attribute::GradientStyle::Rect; // css::awt::GradientStyle_RECT
}
}
}
attribute::HatchStyle XHatchStyleToHatchStyle(css::drawing::HatchStyle eStyle)
{
switch(eStyle)
@@ -772,7 +741,7 @@ namespace drawinglayer::primitive2d
}
aGradient = attribute::FillGradientAttribute(
XGradientStyleToGradientStyle(aXGradient.GetGradientStyle()),
aXGradient.GetGradientStyle(),
static_cast<double>(aXGradient.GetBorder()) * 0.01,
static_cast<double>(aXGradient.GetXOffset()) * 0.01,
static_cast<double>(aXGradient.GetYOffset()) * 0.01,
@@ -941,7 +910,7 @@ namespace drawinglayer::primitive2d
}
return attribute::FillGradientAttribute(
XGradientStyleToGradientStyle(rGradient.GetGradientStyle()),
rGradient.GetGradientStyle(),
static_cast<double>(rGradient.GetBorder()) * 0.01,
static_cast<double>(rGradient.GetXOffset()) * 0.01,
static_cast<double>(rGradient.GetYOffset()) * 0.01,
@@ -523,7 +523,7 @@ void AreaPropertyPanelBase::FillStyleChanged(bool bUpdateModel)
mxGradientStyle->set_active(
sal::static_int_cast<sal_Int32>(aGradient.GetGradientStyle()));
if (mxGradientStyle->get_active() == sal_Int32(GradientStyle::Radial))
if (mxGradientStyle->get_active() == sal_Int32(css::awt::GradientStyle_RADIAL))
mxMTRAngle->set_sensitive(false);
else
mxMTRAngle->set_value(toDegrees(aGradient.GetAngle()),
+3 -33
View File
@@ -1250,7 +1250,7 @@ void ImpSdrGDIMetaFileImport::DoAction( MetaCommentAction const & rAct, GDIMetaF
rGrad.GetStartColor().getBColor(),
rGrad.GetEndColor().getBColor()));
aXGradient.SetGradientStyle(static_cast<css::awt::GradientStyle>(rGrad.GetStyle()));
aXGradient.SetGradientStyle(rGrad.GetStyle());
aXGradient.SetAngle(rGrad.GetAngle());
aXGradient.SetBorder(rGrad.GetBorder());
aXGradient.SetXOffset(rGrad.GetOfsX());
@@ -1393,34 +1393,6 @@ void ImpSdrGDIMetaFileImport::DoAction(MetaMaskScalePartAction const & rAct)
InsertObj(pGraf.get());
}
namespace
{
css::awt::GradientStyle getXGradientStyleFromGradientStyle(const GradientStyle& rGradientStyle)
{
css::awt::GradientStyle aXGradientStyle(css::awt::GradientStyle_LINEAR);
switch(rGradientStyle)
{
case GradientStyle::Linear: aXGradientStyle = css::awt::GradientStyle_LINEAR; break;
case GradientStyle::Axial: aXGradientStyle = css::awt::GradientStyle_AXIAL; break;
case GradientStyle::Radial: aXGradientStyle = css::awt::GradientStyle_RADIAL; break;
case GradientStyle::Elliptical: aXGradientStyle = css::awt::GradientStyle_ELLIPTICAL; break;
case GradientStyle::Square: aXGradientStyle = css::awt::GradientStyle_SQUARE; break;
case GradientStyle::Rect: aXGradientStyle = css::awt::GradientStyle_RECT; break;
// Needed due to GradientStyle::FORCE_EQUAL_SIZE; this again is needed
// to force the enum defines in VCL to a defined size for the compilers,
// so despite it is never used it cannot be removed (would break the
// API implementation probably).
case GradientStyle::FORCE_EQUAL_SIZE: break;
default:
break;
}
return aXGradientStyle;
}
}
void ImpSdrGDIMetaFileImport::DoAction(MetaGradientAction const & rAct)
{
basegfx::B2DRange aRange = vcl::unotools::b2DRectangleFromRectangle(rAct.GetRect());
@@ -1440,13 +1412,12 @@ void ImpSdrGDIMetaFileImport::DoAction(MetaGradientAction const & rAct)
ceil(aRange.getMaxY())));
// #i125211# Use the ranges from the SdrObject to create a new empty SfxItemSet
SfxItemSet aGradientAttr(mpModel->GetItemPool(), pRect->GetMergedItemSet().GetRanges());
const css::awt::GradientStyle aXGradientStyle(getXGradientStyleFromGradientStyle(rGradient.GetStyle()));
const XFillGradientItem aXFillGradientItem(
XGradient(
basegfx::utils::createColorStopsFromStartEndColor(
rGradient.GetStartColor().getBColor(),
rGradient.GetEndColor().getBColor()),
aXGradientStyle,
rGradient.GetStyle(),
rGradient.GetAngle(),
rGradient.GetOfsX(),
rGradient.GetOfsY(),
@@ -1503,13 +1474,12 @@ void ImpSdrGDIMetaFileImport::DoAction(MetaGradientExAction const & rAct)
std::move(aSource));
// #i125211# Use the ranges from the SdrObject to create a new empty SfxItemSet
SfxItemSet aGradientAttr(mpModel->GetItemPool(), pPath->GetMergedItemSet().GetRanges());
const css::awt::GradientStyle aXGradientStyle(getXGradientStyleFromGradientStyle(rGradient.GetStyle()));
const XFillGradientItem aXFillGradientItem(
XGradient(
basegfx::utils::createColorStopsFromStartEndColor(
rGradient.GetStartColor().getBColor(),
rGradient.GetEndColor().getBColor()),
aXGradientStyle,
rGradient.GetStyle(),
rGradient.GetAngle(),
rGradient.GetOfsX(),
rGradient.GetOfsY(),
+1 -36
View File
@@ -102,41 +102,6 @@ BitmapEx XGradientList::CreateBitmap( tools::Long nIndex, const Size& rSize ) co
const XGradient& rGradient = GetGradient(nIndex)->GetGradient();
basegfx::ColorStops aColorStops(rGradient.GetColorStops());
drawinglayer::attribute::GradientStyle aGradientStyle(drawinglayer::attribute::GradientStyle::Rect);
switch(rGradient.GetGradientStyle())
{
case css::awt::GradientStyle_LINEAR :
{
aGradientStyle = drawinglayer::attribute::GradientStyle::Linear;
break;
}
case css::awt::GradientStyle_AXIAL :
{
aGradientStyle = drawinglayer::attribute::GradientStyle::Axial;
break;
}
case css::awt::GradientStyle_RADIAL :
{
aGradientStyle = drawinglayer::attribute::GradientStyle::Radial;
break;
}
case css::awt::GradientStyle_ELLIPTICAL :
{
aGradientStyle = drawinglayer::attribute::GradientStyle::Elliptical;
break;
}
case css::awt::GradientStyle_SQUARE :
{
aGradientStyle = drawinglayer::attribute::GradientStyle::Square;
break;
}
default :
{
aGradientStyle = drawinglayer::attribute::GradientStyle::Rect; // css::awt::GradientStyle_RECT
break;
}
}
if (rGradient.GetStartIntens() != 100 || rGradient.GetEndIntens() != 100)
{
@@ -149,7 +114,7 @@ BitmapEx XGradientList::CreateBitmap( tools::Long nIndex, const Size& rSize ) co
}
drawinglayer::attribute::FillGradientAttribute aFillGradient(
aGradientStyle,
rGradient.GetGradientStyle(),
static_cast<double>(rGradient.GetBorder()) * 0.01,
static_cast<double>(rGradient.GetXOffset()) * 0.01,
static_cast<double>(rGradient.GetYOffset()) * 0.01,
+1 -1
View File
@@ -575,7 +575,7 @@ SwTransparentTextGuard::~SwTransparentTextGuard()
Gradient aVCLGradient;
sal_uInt8 nTransPercentVcl = 255 - m_rPaintInf.GetFont()->GetColor().GetAlpha();
const Color aTransColor(nTransPercentVcl, nTransPercentVcl, nTransPercentVcl);
aVCLGradient.SetStyle(GradientStyle::Linear);
aVCLGradient.SetStyle(css::awt::GradientStyle_LINEAR);
aVCLGradient.SetStartColor(aTransColor);
aVCLGradient.SetEndColor(aTransColor);
aVCLGradient.SetAngle(0_deg10);
+1 -1
View File
@@ -469,7 +469,7 @@ void SwAnnotationWin::SetMenuButtonColors()
tools::Rectangle aRect(Point(0, 0), aSize);
xVirDev->SetOutputSizePixel(aSize);
Gradient aGradient(GradientStyle::Linear,
Gradient aGradient(css::awt::GradientStyle_LINEAR,
ColorFromAlphaColor(15, mColorAnchor, mColorDark),
ColorFromAlphaColor(80, mColorAnchor, mColorDark));
xVirDev->DrawGradient(aRect, aGradient);
+1 -1
View File
@@ -152,7 +152,7 @@ void SwFrameButtonPainter::PaintButton(drawinglayer::primitive2d::Primitive2DCon
if (bOnTop)
nAngle = 0;
FillGradientAttribute aFillAttrs(drawinglayer::attribute::GradientStyle::Linear, 0.0, 0.0, 0.0, nAngle,
FillGradientAttribute aFillAttrs(css::awt::GradientStyle_LINEAR, 0.0, 0.0, 0.0, nAngle,
basegfx::utils::createColorStopsFromStartEndColor(aLighterColor, aFillColor));
rSeq.push_back(drawinglayer::primitive2d::Primitive2DReference(
new drawinglayer::primitive2d::FillGradientPrimitive2D(aGradientRect, std::move(aFillAttrs))));
@@ -85,7 +85,7 @@ void ShadowPrimitive::create2DDecomposition(
aRange.expand(basegfx::B2DTuple(getSecondPosition().getX(), getSecondPosition().getY() + (2.0 * getDiscreteUnit())));
::drawinglayer::attribute::FillGradientAttribute aFillGradientAttribute(
drawinglayer::attribute::GradientStyle::Linear,
css::awt::GradientStyle_LINEAR,
0.0,
0.5,
0.5,
@@ -104,7 +104,7 @@ void ShadowPrimitive::create2DDecomposition(
{
aRange.expand(basegfx::B2DTuple(getSecondPosition().getX(), getSecondPosition().getY() + (4.0 * getDiscreteUnit())));
drawinglayer::attribute::FillGradientAttribute aFillGradientAttribute(
drawinglayer::attribute::GradientStyle::Linear,
css::awt::GradientStyle_LINEAR,
0.0,
0.5,
0.5,
@@ -123,7 +123,7 @@ void ShadowPrimitive::create2DDecomposition(
{
aRange.expand(basegfx::B2DTuple(getSecondPosition().getX(), getSecondPosition().getY() + (4.0 * getDiscreteUnit())));
drawinglayer::attribute::FillGradientAttribute aFillGradientAttribute(
drawinglayer::attribute::GradientStyle::Linear,
css::awt::GradientStyle_LINEAR,
0.0,
0.5,
0.5,
+2 -2
View File
@@ -246,12 +246,12 @@ void SidebarTextControl::Paint(vcl::RenderContext& rRenderContext, const tools::
if (mrSidebarWin.IsMouseOverSidebarWin() || HasFocus())
{
rRenderContext.DrawGradient(tools::Rectangle(aPos, rRenderContext.PixelToLogic(aSize)),
Gradient(GradientStyle::Linear, mrSidebarWin.ColorDark(), mrSidebarWin.ColorDark()));
Gradient(css::awt::GradientStyle_LINEAR, mrSidebarWin.ColorDark(), mrSidebarWin.ColorDark()));
}
else
{
rRenderContext.DrawGradient(tools::Rectangle(aPos, rRenderContext.PixelToLogic(aSize)),
Gradient(GradientStyle::Linear, mrSidebarWin.ColorLight(), mrSidebarWin.ColorDark()));
Gradient(css::awt::GradientStyle_LINEAR, mrSidebarWin.ColorLight(), mrSidebarWin.ColorDark()));
}
}
+1 -1
View File
@@ -432,7 +432,7 @@ void VCLXGraphics::drawGradient( sal_Int32 x, sal_Int32 y, sal_Int32 width, sal_
return;
InitOutputDevice( InitOutDevFlags::COLORS );
Gradient aGradient(static_cast<GradientStyle>(rGradient.Style), Color(ColorTransparency, rGradient.StartColor), Color(ColorTransparency, rGradient.EndColor));
Gradient aGradient(rGradient.Style, Color(ColorTransparency, rGradient.StartColor), Color(ColorTransparency, rGradient.EndColor));
aGradient.SetAngle(Degree10(rGradient.Angle));
aGradient.SetBorder(rGradient.Border);
aGradient.SetOfsX(rGradient.XOffset);
+1 -1
View File
@@ -712,7 +712,7 @@ public:
mpVDev->DrawPolyPolygon(polyPolygon);
tools::Rectangle aGradientRect(Point(200, 200), Size(200 + fTime * 300, 200 + fTime * 300));
mpVDev->DrawGradient(aGradientRect, Gradient(GradientStyle::Linear, COL_YELLOW, COL_BLUE));
mpVDev->DrawGradient(aGradientRect, Gradient(css::awt::GradientStyle_LINEAR, COL_YELLOW, COL_BLUE));
rRenderContext.DrawOutDev(Point(), mpVDev->GetOutputSizePixel(),
Point(), mpVDev->GetOutputSizePixel(),
+16 -8
View File
@@ -17,7 +17,8 @@ Bitmap OutputDeviceTestGradient::setupLinearGradient()
{
initialSetup(12, 12, constBackgroundColor);
Gradient aGradient(GradientStyle::Linear, Color(0xFF, 0xFF, 0xFF), Color(0x00, 0x00, 0x00));
Gradient aGradient(css::awt::GradientStyle_LINEAR, Color(0xFF, 0xFF, 0xFF),
Color(0x00, 0x00, 0x00));
aGradient.SetAngle(900_deg10);
tools::Rectangle aDrawRect(maVDRectangle.Left() + 1, maVDRectangle.Top() + 1,
maVDRectangle.Right() - 1, maVDRectangle.Bottom() - 1);
@@ -30,7 +31,8 @@ Bitmap OutputDeviceTestGradient::setupLinearGradientAngled()
{
initialSetup(12, 12, constBackgroundColor);
Gradient aGradient(GradientStyle::Linear, Color(0xFF, 0xFF, 0xFF), Color(0x00, 0x00, 0x00));
Gradient aGradient(css::awt::GradientStyle_LINEAR, Color(0xFF, 0xFF, 0xFF),
Color(0x00, 0x00, 0x00));
aGradient.SetAngle(450_deg10);
tools::Rectangle aDrawRect(maVDRectangle.Left() + 1, maVDRectangle.Top() + 1,
maVDRectangle.Right() - 1, maVDRectangle.Bottom() - 1);
@@ -43,7 +45,8 @@ Bitmap OutputDeviceTestGradient::setupLinearGradientBorder()
{
initialSetup(12, 12, constBackgroundColor);
Gradient aGradient(GradientStyle::Linear, Color(0xFF, 0xFF, 0xFF), Color(0x00, 0x00, 0x00));
Gradient aGradient(css::awt::GradientStyle_LINEAR, Color(0xFF, 0xFF, 0xFF),
Color(0x00, 0x00, 0x00));
aGradient.SetBorder(50);
tools::Rectangle aDrawRect(maVDRectangle.Left() + 1, maVDRectangle.Top() + 1,
maVDRectangle.Right() - 1, maVDRectangle.Bottom() - 1);
@@ -56,7 +59,8 @@ Bitmap OutputDeviceTestGradient::setupLinearGradientIntensity()
{
initialSetup(12, 12, constBackgroundColor);
Gradient aGradient(GradientStyle::Linear, Color(0xFF, 0xFF, 0xFF), Color(0x00, 0x00, 0x00));
Gradient aGradient(css::awt::GradientStyle_LINEAR, Color(0xFF, 0xFF, 0xFF),
Color(0x00, 0x00, 0x00));
aGradient.SetStartIntensity(50);
tools::Rectangle aDrawRect(maVDRectangle.Left() + 1, maVDRectangle.Top() + 1,
maVDRectangle.Right() - 1, maVDRectangle.Bottom() - 1);
@@ -69,7 +73,8 @@ Bitmap OutputDeviceTestGradient::setupLinearGradientSteps()
{
initialSetup(12, 12, constBackgroundColor);
Gradient aGradient(GradientStyle::Linear, Color(0xFF, 0xFF, 0xFF), Color(0x00, 0x00, 0x00));
Gradient aGradient(css::awt::GradientStyle_LINEAR, Color(0xFF, 0xFF, 0xFF),
Color(0x00, 0x00, 0x00));
aGradient.SetAngle(900_deg10);
aGradient.SetSteps(4);
tools::Rectangle aDrawRect(maVDRectangle.Left() + 1, maVDRectangle.Top() + 1,
@@ -83,7 +88,8 @@ Bitmap OutputDeviceTestGradient::setupAxialGradient()
{
initialSetup(13, 13, constBackgroundColor);
Gradient aGradient(GradientStyle::Axial, Color(0xFF, 0xFF, 0xFF), Color(0x00, 0x00, 0x00));
Gradient aGradient(css::awt::GradientStyle_AXIAL, Color(0xFF, 0xFF, 0xFF),
Color(0x00, 0x00, 0x00));
aGradient.SetAngle(900_deg10);
tools::Rectangle aDrawRect(maVDRectangle.Left() + 1, maVDRectangle.Top() + 1,
maVDRectangle.Right() - 1, maVDRectangle.Bottom() - 1);
@@ -96,7 +102,8 @@ Bitmap OutputDeviceTestGradient::setupRadialGradient()
{
initialSetup(12, 12, constBackgroundColor);
Gradient aGradient(GradientStyle::Radial, Color(0xFF, 0xFF, 0xFF), Color(0x00, 0x00, 0x00));
Gradient aGradient(css::awt::GradientStyle_RADIAL, Color(0xFF, 0xFF, 0xFF),
Color(0x00, 0x00, 0x00));
tools::Rectangle aDrawRect(maVDRectangle.Left() + 1, maVDRectangle.Top() + 1,
maVDRectangle.Right() - 1, maVDRectangle.Bottom() - 1);
mpVirtualDevice->DrawGradient(aDrawRect, aGradient);
@@ -108,7 +115,8 @@ Bitmap OutputDeviceTestGradient::setupRadialGradientOfs()
{
initialSetup(12, 12, constBackgroundColor);
Gradient aGradient(GradientStyle::Radial, Color(0xFF, 0xFF, 0xFF), Color(0x00, 0x00, 0x00));
Gradient aGradient(css::awt::GradientStyle_RADIAL, Color(0xFF, 0xFF, 0xFF),
Color(0x00, 0x00, 0x00));
aGradient.SetOfsX(100); // Move center to the bottom-right corner.
aGradient.SetOfsY(100);
tools::Rectangle aDrawRect(maVDRectangle.Left() + 1, maVDRectangle.Top() + 1,
+3 -3
View File
@@ -1283,8 +1283,8 @@ bool CairoCommon::drawAlphaRect(tools::Long nX, tools::Long nY, tools::Long nWid
bool CairoCommon::drawGradient(const tools::PolyPolygon& rPolyPolygon, const Gradient& rGradient,
bool bAntiAlias)
{
if (rGradient.GetStyle() != GradientStyle::Linear
&& rGradient.GetStyle() != GradientStyle::Radial)
if (rGradient.GetStyle() != css::awt::GradientStyle_LINEAR
&& rGradient.GetStyle() != css::awt::GradientStyle_RADIAL)
return false; // unsupported
if (rGradient.GetSteps() != 0)
return false; // We can't tell cairo how many colors to use in the gradient.
@@ -1323,7 +1323,7 @@ bool CairoCommon::drawGradient(const tools::PolyPolygon& rPolyPolygon, const Gra
Color aEndColor = aGradient.GetEndColor();
cairo_pattern_t* pattern;
if (rGradient.GetStyle() == GradientStyle::Linear)
if (rGradient.GetStyle() == css::awt::GradientStyle_LINEAR)
{
tools::Polygon aPoly(aBoundRect);
aPoly.Rotate(aCenter, aGradient.GetAngle() % 3600_deg10);
+3 -2
View File
@@ -89,7 +89,8 @@ TypeSerializerTest::~TypeSerializerTest()
void TypeSerializerTest::testGradient()
{
Gradient aGradient(GradientStyle::Radial, Color(0xFF, 0x00, 0x00), Color(0x00, 0xFF, 0x00));
Gradient aGradient(css::awt::GradientStyle_RADIAL, Color(0xFF, 0x00, 0x00),
Color(0x00, 0xFF, 0x00));
aGradient.SetAngle(900_deg10);
aGradient.SetBorder(5);
aGradient.SetOfsX(11);
@@ -105,7 +106,7 @@ void TypeSerializerTest::testGradient()
Gradient aReadGradient;
aSerializer.readGradient(aReadGradient);
CPPUNIT_ASSERT_EQUAL(GradientStyle::Radial, aReadGradient.GetStyle());
CPPUNIT_ASSERT_EQUAL(css::awt::GradientStyle_RADIAL, aReadGradient.GetStyle());
CPPUNIT_ASSERT_EQUAL(Color(0xFF, 0x00, 0x00), aReadGradient.GetStartColor());
CPPUNIT_ASSERT_EQUAL(Color(0x00, 0xFF, 0x00), aReadGradient.GetEndColor());
CPPUNIT_ASSERT_EQUAL(sal_Int16(900), aReadGradient.GetAngle().get());
+3 -3
View File
@@ -91,7 +91,7 @@ void VclGradientTest::testAddGradientActions_rect_linear()
{
GDIMetaFile aMtf;
tools::Rectangle aRect(Point(10, 10), Size(40, 40));
Gradient aGradient(GradientStyle::Linear, COL_RED, COL_WHITE);
Gradient aGradient(css::awt::GradientStyle_LINEAR, COL_RED, COL_WHITE);
aGradient.SetBorder(100);
aGradient.AddGradientActions(aRect, aMtf);
@@ -166,7 +166,7 @@ void VclGradientTest::testAddGradientActions_rect_axial()
{
GDIMetaFile aMtf;
tools::Rectangle aRect(Point(10, 10), Size(40, 40));
Gradient aGradient(GradientStyle::Axial, COL_RED, COL_WHITE);
Gradient aGradient(css::awt::GradientStyle_AXIAL, COL_RED, COL_WHITE);
aGradient.SetBorder(100);
aGradient.AddGradientActions(aRect, aMtf);
@@ -226,7 +226,7 @@ void VclGradientTest::testAddGradientActions_rect_complex()
{
GDIMetaFile aMtf;
tools::Rectangle aRect(Point(10, 10), Size(40, 40));
Gradient aGradient(GradientStyle::Square, COL_RED, COL_WHITE);
Gradient aGradient(css::awt::GradientStyle_SQUARE, COL_RED, COL_WHITE);
aGradient.SetBorder(10);
aGradient.AddGradientActions(aRect, aMtf);
+5 -5
View File
@@ -2021,7 +2021,7 @@ CPPUNIT_TEST_FIXTURE(VclOutdevTest, testDrawGradient_rect_linear)
tools::Rectangle aRect(Point(10, 10), Size(40, 40));
pVDev->SetOutputSizePixel(Size(100, 100));
Gradient aGradient(GradientStyle::Linear, COL_RED, COL_WHITE);
Gradient aGradient(css::awt::GradientStyle_LINEAR, COL_RED, COL_WHITE);
aGradient.SetBorder(100);
pVDev->DrawGradient(aRect, aGradient);
@@ -2042,7 +2042,7 @@ CPPUNIT_TEST_FIXTURE(VclOutdevTest, testDrawGradient_rect_axial)
tools::Rectangle aRect(Point(10, 10), Size(40, 40));
pVDev->SetOutputSizePixel(Size(100, 100));
Gradient aGradient(GradientStyle::Axial, COL_RED, COL_WHITE);
Gradient aGradient(css::awt::GradientStyle_AXIAL, COL_RED, COL_WHITE);
aGradient.SetBorder(100);
pVDev->DrawGradient(aRect, aGradient);
@@ -2064,7 +2064,7 @@ CPPUNIT_TEST_FIXTURE(VclOutdevTest, testDrawGradient_polygon_linear)
pVDev->SetOutputSizePixel(Size(100, 100));
Gradient aGradient(GradientStyle::Linear, COL_RED, COL_WHITE);
Gradient aGradient(css::awt::GradientStyle_LINEAR, COL_RED, COL_WHITE);
aGradient.SetBorder(100);
pVDev->DrawGradient(aPolyPolygon, aGradient);
@@ -2082,7 +2082,7 @@ CPPUNIT_TEST_FIXTURE(VclOutdevTest, testDrawGradient_polygon_axial)
pVDev->SetOutputSizePixel(Size(100, 100));
Gradient aGradient(GradientStyle::Axial, COL_RED, COL_WHITE);
Gradient aGradient(css::awt::GradientStyle_AXIAL, COL_RED, COL_WHITE);
aGradient.SetBorder(100);
pVDev->DrawGradient(aPolyPolygon, aGradient);
@@ -2099,7 +2099,7 @@ CPPUNIT_TEST_FIXTURE(VclOutdevTest, testDrawGradient_rect_complex)
tools::Rectangle aRect(Point(10, 10), Size(40, 40));
pVDev->SetOutputSizePixel(Size(1000, 1000));
Gradient aGradient(GradientStyle::Square, COL_RED, COL_WHITE);
Gradient aGradient(css::awt::GradientStyle_SQUARE, COL_RED, COL_WHITE);
aGradient.SetBorder(10);
pVDev->DrawGradient(aRect, aGradient);
+5 -5
View File
@@ -1290,13 +1290,13 @@ void SvmTest::testGradient()
tools::Rectangle aRectangle(Point(1, 2), Size(4,5));
Gradient aGradient(GradientStyle::Linear, COL_WHITE, COL_BLACK);
Gradient aGradient(css::awt::GradientStyle_LINEAR, COL_WHITE, COL_BLACK);
pVirtualDev->DrawGradient(aRectangle, aGradient);
tools::Rectangle aRectangle2(Point(3, 4), Size(1,2));
Gradient aGradient2;
aGradient2.SetStyle(GradientStyle::Radial);
aGradient2.SetStyle(css::awt::GradientStyle_RADIAL);
aGradient2.SetStartColor(COL_LIGHTRED);
aGradient2.SetEndColor(COL_LIGHTGREEN);
aGradient2.SetAngle(Degree10(55));
@@ -1384,7 +1384,7 @@ void SvmTest::testGradientEx()
tools::PolyPolygon aPolyPolygon(1);
aPolyPolygon.Insert(aPolygon);
Gradient aGradient(GradientStyle::Linear, COL_WHITE, COL_BLACK);
Gradient aGradient(css::awt::GradientStyle_LINEAR, COL_WHITE, COL_BLACK);
pVirtualDev->DrawGradient(aPolyPolygon, aGradient);
tools::Polygon aPolygon2(2);
@@ -1400,7 +1400,7 @@ void SvmTest::testGradientEx()
aPolyPolygon2.Insert(aPolygon3);
Gradient aGradient2;
aGradient2.SetStyle(GradientStyle::Axial);
aGradient2.SetStyle(css::awt::GradientStyle_AXIAL);
aGradient2.SetStartColor(COL_LIGHTMAGENTA);
aGradient2.SetEndColor(COL_CYAN);
aGradient2.SetAngle(Degree10(55));
@@ -2134,7 +2134,7 @@ void SvmTest::testFloatTransparent()
pVirtualDev1->DrawPixel(Point(1, 8));
pVirtualDev1->DrawPixel(Point(2, 7));
Gradient aGradient(GradientStyle::Linear, COL_WHITE, COL_BLACK);
Gradient aGradient(css::awt::GradientStyle_LINEAR, COL_WHITE, COL_BLACK);
pVirtualDev->DrawTransparent(aGDIMetaFile1, Point(1, 2), Size(3, 4), aGradient);
+5 -5
View File
@@ -1994,9 +1994,9 @@ bool SkiaSalGraphicsImpl::drawAlphaRect(tools::Long nX, tools::Long nY, tools::L
bool SkiaSalGraphicsImpl::drawGradient(const tools::PolyPolygon& rPolyPolygon,
const Gradient& rGradient)
{
if (rGradient.GetStyle() != GradientStyle::Linear
&& rGradient.GetStyle() != GradientStyle::Axial
&& rGradient.GetStyle() != GradientStyle::Radial)
if (rGradient.GetStyle() != css::awt::GradientStyle_LINEAR
&& rGradient.GetStyle() != css::awt::GradientStyle_AXIAL
&& rGradient.GetStyle() != css::awt::GradientStyle_RADIAL)
return false; // unsupported
if (rGradient.GetSteps() != 0)
return false; // We can't tell Skia how many colors to use in the gradient.
@@ -2031,7 +2031,7 @@ bool SkiaSalGraphicsImpl::drawGradient(const tools::PolyPolygon& rPolyPolygon,
SkColor endColor = toSkColorWithIntensity(rGradient.GetEndColor(), rGradient.GetEndIntensity());
sk_sp<SkShader> shader;
if (rGradient.GetStyle() == GradientStyle::Linear)
if (rGradient.GetStyle() == css::awt::GradientStyle_LINEAR)
{
tools::Polygon aPoly(aBoundRect);
aPoly.Rotate(aCenter, aGradient.GetAngle() % 3600_deg10);
@@ -2041,7 +2041,7 @@ bool SkiaSalGraphicsImpl::drawGradient(const tools::PolyPolygon& rPolyPolygon,
SkScalar pos[2] = { SkDoubleToScalar(aGradient.GetBorder() / 100.0), 1.0 };
shader = SkGradientShader::MakeLinear(points, colors, pos, 2, SkTileMode::kClamp);
}
else if (rGradient.GetStyle() == GradientStyle::Axial)
else if (rGradient.GetStyle() == css::awt::GradientStyle_AXIAL)
{
tools::Polygon aPoly(aBoundRect);
aPoly.Rotate(aCenter, aGradient.GetAngle() % 3600_deg10);
+1 -1
View File
@@ -1080,7 +1080,7 @@ void SVMConverter::ImplConvertFromSVM1( SvStream& rIStm, GDIMetaFile& rMtf )
sal_Int16 nAngle(0), nBorder(0), nOfsX(0), nOfsY(0), nIntensityStart(0), nIntensityEnd(0);
rIStm.ReadInt16( nAngle ).ReadInt16( nBorder ).ReadInt16( nOfsX ).ReadInt16( nOfsY ).ReadInt16( nIntensityStart ).ReadInt16( nIntensityEnd );
Gradient aGrad( static_cast<GradientStyle>(nStyle), aStartCol, aEndCol );
Gradient aGrad( static_cast<css::awt::GradientStyle>(nStyle), aStartCol, aEndCol );
aGrad.SetAngle( Degree10(nAngle) );
aGrad.SetBorder( nBorder );
+1 -1
View File
@@ -58,7 +58,7 @@ void TypeSerializer::readGradient(Gradient& rGradient)
mrStream.ReadUInt16(nIntensityEnd);
mrStream.ReadUInt16(nStepCount);
rGradient.SetStyle(static_cast<GradientStyle>(nStyle));
rGradient.SetStyle(static_cast<css::awt::GradientStyle>(nStyle));
rGradient.SetStartColor(aStartColor);
rGradient.SetEndColor(aEndColor);
if (nAngle > 3600)
+14 -14
View File
@@ -26,7 +26,7 @@
class Gradient::Impl
{
public:
GradientStyle meStyle;
css::awt::GradientStyle meStyle;
Color maStartColor;
Color maEndColor;
Degree10 mnAngle;
@@ -38,7 +38,7 @@ public:
sal_uInt16 mnStepCount;
Impl()
: meStyle (GradientStyle::Linear)
: meStyle (css::awt::GradientStyle_LINEAR)
, maStartColor(COL_BLACK)
, maEndColor(COL_WHITE)
, mnAngle(0)
@@ -86,7 +86,7 @@ Gradient::Gradient( const Gradient& ) = default;
Gradient::Gradient( Gradient&& ) = default;
Gradient::Gradient( GradientStyle eStyle,
Gradient::Gradient( css::awt::GradientStyle eStyle,
const Color& rStartColor, const Color& rEndColor )
{
mpImplGradient->meStyle = eStyle;
@@ -97,12 +97,12 @@ Gradient::Gradient( GradientStyle eStyle,
Gradient::~Gradient() = default;
GradientStyle Gradient::GetStyle() const
css::awt::GradientStyle Gradient::GetStyle() const
{
return mpImplGradient->meStyle;
}
void Gradient::SetStyle( GradientStyle eStyle )
void Gradient::SetStyle( css::awt::GradientStyle eStyle )
{
mpImplGradient->meStyle = eStyle;
}
@@ -202,7 +202,7 @@ void Gradient::GetBoundRect( const tools::Rectangle& rRect, tools::Rectangle& rB
tools::Rectangle aRect( rRect );
Degree10 nAngle = GetAngle() % 3600_deg10;
if( GetStyle() == GradientStyle::Linear || GetStyle() == GradientStyle::Axial )
if( GetStyle() == css::awt::GradientStyle_LINEAR || GetStyle() == css::awt::GradientStyle_AXIAL )
{
const double fAngle = toRadians(nAngle);
const double fWidth = aRect.GetWidth();
@@ -223,7 +223,7 @@ void Gradient::GetBoundRect( const tools::Rectangle& rRect, tools::Rectangle& rB
}
else
{
if( GetStyle() == GradientStyle::Square || GetStyle() == GradientStyle::Rect )
if( GetStyle() == css::awt::GradientStyle_SQUARE || GetStyle() == css::awt::GradientStyle_RECT )
{
const double fAngle = toRadians(nAngle);
const double fWidth = aRect.GetWidth();
@@ -242,13 +242,13 @@ void Gradient::GetBoundRect( const tools::Rectangle& rRect, tools::Rectangle& rB
Size aSize( aRect.GetSize() );
if( GetStyle() == GradientStyle::Radial )
if( GetStyle() == css::awt::GradientStyle_RADIAL )
{
// Calculation of radii for circle
aSize.setWidth( static_cast<tools::Long>(0.5 + std::hypot(aSize.Width(), aSize.Height())) );
aSize.setHeight( aSize.Width() );
}
else if( GetStyle() == GradientStyle::Elliptical )
else if( GetStyle() == css::awt::GradientStyle_ELLIPTICAL )
{
// Calculation of radii for ellipse
aSize.setWidth( static_cast<tools::Long>( 0.5 + static_cast<double>(aSize.Width()) * M_SQRT2 ) );
@@ -324,7 +324,7 @@ void Gradient::AddGradientActions(tools::Rectangle const& rRect, GDIMetaFile& rM
if (!GetSteps())
SetSteps(GRADIENT_DEFAULT_STEPCOUNT);
if (GetStyle() == GradientStyle::Linear || GetStyle() == GradientStyle::Axial)
if (GetStyle() == css::awt::GradientStyle_LINEAR || GetStyle() == css::awt::GradientStyle_AXIAL)
DrawLinearGradientToMetafile(aRect, rMetaFile);
else
DrawComplexGradientToMetafile(aRect, rMetaFile);
@@ -340,7 +340,7 @@ tools::Long Gradient::GetMetafileSteps(tools::Rectangle const& rRect) const
if (nStepCount)
return nStepCount;
if (GetStyle() == GradientStyle::Linear || GetStyle() == GradientStyle::Axial)
if (GetStyle() == css::awt::GradientStyle_LINEAR || GetStyle() == css::awt::GradientStyle_AXIAL)
return rRect.GetHeight();
else
return std::min(rRect.GetWidth(), rRect.GetHeight());
@@ -366,7 +366,7 @@ void Gradient::DrawLinearGradientToMetafile(tools::Rectangle const& rRect, GDIMe
GetBoundRect(rRect, aRect, aCenter);
bool bLinear = (GetStyle() == GradientStyle::Linear);
bool bLinear = (GetStyle() == css::awt::GradientStyle_LINEAR);
double fBorder = GetBorder() * aRect.GetHeight() / 100.0;
if ( !bLinear )
{
@@ -593,7 +593,7 @@ void Gradient::DrawComplexGradientToMetafile(tools::Rectangle const& rRect, GDIM
// all gradients are rendered as nested rectangles which shrink
// equally in each dimension - except for 'square' gradients
// which shrink to a central vertex but are not per-se square.
if (GetStyle() != GradientStyle::Square)
if (GetStyle() != css::awt::GradientStyle_SQUARE)
{
fScanIncY = std::min( fScanIncY, fScanIncX );
fScanIncX = fScanIncY;
@@ -623,7 +623,7 @@ void Gradient::DrawComplexGradientToMetafile(tools::Rectangle const& rRect, GDIM
if( ( aRect.GetWidth() < 2 ) || ( aRect.GetHeight() < 2 ) )
break;
if (GetStyle() == GradientStyle::Radial || GetStyle() == GradientStyle::Elliptical)
if (GetStyle() == css::awt::GradientStyle_RADIAL || GetStyle() == css::awt::GradientStyle_ELLIPTICAL)
aPoly = tools::Polygon( aRect.Center(), aRect.GetWidth() >> 1, aRect.GetHeight() >> 1 );
else
aPoly = tools::Polygon( aRect );
+9 -9
View File
@@ -374,17 +374,17 @@ OUString convertFractionToString(const Fraction& aFraction)
return OUString::createFromAscii(ss.str().c_str());
}
OUString convertGradientStyle(GradientStyle eStyle)
OUString convertGradientStyleToOUString(css::awt::GradientStyle eStyle)
{
switch (eStyle)
{
case GradientStyle::Linear: return "Linear";
case GradientStyle::Axial: return "Axial";
case GradientStyle::Radial: return "Radial";
case GradientStyle::Elliptical: return "Elliptical";
case GradientStyle::Square: return "Square";
case GradientStyle::Rect: return "Rect";
case GradientStyle::FORCE_EQUAL_SIZE: return "ForceEqualSize";
case css::awt::GradientStyle_LINEAR: return "Linear";
case css::awt::GradientStyle_AXIAL: return "Axial";
case css::awt::GradientStyle_RADIAL: return "Radial";
case css::awt::GradientStyle_ELLIPTICAL: return "Elliptical";
case css::awt::GradientStyle_SQUARE: return "Square";
case css::awt::GradientStyle_RECT: return "Rect";
case css::awt::GradientStyle::GradientStyle_MAKE_FIXED_SIZE: return "ForceEqualSize";
}
return OUString();
}
@@ -555,7 +555,7 @@ void writeLineInfo(tools::XmlWriter& rWriter, LineInfo const& rLineInfo)
void writeGradient(tools::XmlWriter& rWriter, Gradient const& rGradient)
{
rWriter.attribute("style", convertGradientStyle(rGradient.GetStyle()));
rWriter.attribute("style", convertGradientStyleToOUString(rGradient.GetStyle()));
rWriter.attribute("startcolor", convertColorToString(rGradient.GetStartColor()));
rWriter.attribute("endcolor", convertColorToString(rGradient.GetEndColor()));
rWriter.attribute("angle", rGradient.GetAngle().get());
+13 -13
View File
@@ -8694,9 +8694,9 @@ void PDFWriterImpl::writeTransparentObject( TransparencyEmit& rObject )
bool PDFWriterImpl::writeGradientFunction( GradientEmit const & rObject )
{
// LO internal gradient -> PDF shading type:
// * GradientStyle::Linear: axial shading, using sampled-function with 2 samples
// * css::awt::GradientStyle_LINEAR: axial shading, using sampled-function with 2 samples
// [t=0:colorStart, t=1:colorEnd]
// * GradientStyle::Axial: axial shading, using sampled-function with 3 samples
// * css::awt::GradientStyle_AXIAL: axial shading, using sampled-function with 3 samples
// [t=0:colorEnd, t=0.5:colorStart, t=1:colorEnd]
// * other styles: function shading with aSize.Width() * aSize.Height() samples
sal_Int32 nFunctionObject = createObject();
@@ -8727,8 +8727,8 @@ bool PDFWriterImpl::writeGradientFunction( GradientEmit const & rObject )
"<</FunctionType 0\n");
switch (rObject.m_aGradient.GetStyle())
{
case GradientStyle::Linear:
case GradientStyle::Axial:
case css::awt::GradientStyle_LINEAR:
case css::awt::GradientStyle_AXIAL:
aLine.append("/Domain[ 0 1]\n");
break;
default:
@@ -8737,10 +8737,10 @@ bool PDFWriterImpl::writeGradientFunction( GradientEmit const & rObject )
aLine.append("/Size[ " );
switch (rObject.m_aGradient.GetStyle())
{
case GradientStyle::Linear:
case css::awt::GradientStyle_LINEAR:
aLine.append('2');
break;
case GradientStyle::Axial:
case css::awt::GradientStyle_AXIAL:
aLine.append('3');
break;
default:
@@ -8773,13 +8773,13 @@ bool PDFWriterImpl::writeGradientFunction( GradientEmit const & rObject )
sal_uInt8 aCol[3];
switch (rObject.m_aGradient.GetStyle())
{
case GradientStyle::Axial:
case css::awt::GradientStyle_AXIAL:
aCol[0] = rObject.m_aGradient.GetEndColor().GetRed();
aCol[1] = rObject.m_aGradient.GetEndColor().GetGreen();
aCol[2] = rObject.m_aGradient.GetEndColor().GetBlue();
CHECK_RETURN( writeBufferBytes( aCol, 3 ) );
[[fallthrough]];
case GradientStyle::Linear:
case css::awt::GradientStyle_LINEAR:
{
aCol[0] = rObject.m_aGradient.GetStartColor().GetRed();
aCol[1] = rObject.m_aGradient.GetStartColor().GetGreen();
@@ -8830,8 +8830,8 @@ bool PDFWriterImpl::writeGradientFunction( GradientEmit const & rObject )
aLine.append( " 0 obj\n");
switch (rObject.m_aGradient.GetStyle())
{
case GradientStyle::Linear:
case GradientStyle::Axial:
case css::awt::GradientStyle_LINEAR:
case css::awt::GradientStyle_AXIAL:
aLine.append("<</ShadingType 2\n");
break;
default:
@@ -8853,7 +8853,7 @@ bool PDFWriterImpl::writeGradientFunction( GradientEmit const & rObject )
Degree10 nAngle = rObject.m_aGradient.GetAngle() % 3600_deg10;
rObject.m_aGradient.GetBoundRect( aRect, aBoundRect, aCenter );
const bool bLinear = (rObject.m_aGradient.GetStyle() == GradientStyle::Linear);
const bool bLinear = (rObject.m_aGradient.GetStyle() == css::awt::GradientStyle_LINEAR);
double fBorder = aBoundRect.GetHeight() * rObject.m_aGradient.GetBorder() / 100.0;
if ( !bLinear )
{
@@ -8868,8 +8868,8 @@ bool PDFWriterImpl::writeGradientFunction( GradientEmit const & rObject )
switch (rObject.m_aGradient.GetStyle())
{
case GradientStyle::Linear:
case GradientStyle::Axial:
case css::awt::GradientStyle_LINEAR:
case css::awt::GradientStyle_AXIAL:
{
aLine.append("/Domain[ 0 1 ]\n"
"/Coords[ " );
+2 -2
View File
@@ -1947,8 +1947,8 @@ void PDFWriterImpl::DrawHatchLine_DrawLine(const Point& rStartPoint, const Point
static bool lcl_canUsePDFAxialShading(const Gradient& rGradient) {
switch (rGradient.GetStyle())
{
case GradientStyle::Linear:
case GradientStyle::Axial:
case css::awt::GradientStyle_LINEAR:
case css::awt::GradientStyle_AXIAL:
break;
default:
return false;
+1 -1
View File
@@ -219,7 +219,7 @@ Gradient Wallpaper::ImplGetApplicationGradient()
{
Gradient g;
g.SetAngle( 900_deg10 );
g.SetStyle( GradientStyle::Linear );
g.SetStyle( css::awt::GradientStyle_LINEAR );
g.SetStartColor( Application::GetSettings().GetStyleSettings().GetFaceColor() );
// no 'extreme' gradient when high contrast
if( Application::GetSettings().GetStyleSettings().GetHighContrastMode() )
+5 -5
View File
@@ -133,7 +133,7 @@ void OutputDevice::DrawGradient( const tools::PolyPolygon& rPolyPoly,
// if the clipping polypolygon is a rectangle, then it's the same size as the bounding of the
// polypolygon, so pass in a NULL for the clipping parameter
if( aGradient.GetStyle() == GradientStyle::Linear || rGradient.GetStyle() == GradientStyle::Axial )
if( aGradient.GetStyle() == css::awt::GradientStyle_LINEAR || rGradient.GetStyle() == css::awt::GradientStyle_AXIAL )
DrawLinearGradient( aRect, aGradient, aClixPolyPoly.IsRect() ? nullptr : &aClixPolyPoly );
else
DrawComplexGradient( aRect, aGradient, aClixPolyPoly.IsRect() ? nullptr : &aClixPolyPoly );
@@ -233,7 +233,7 @@ void OutputDevice::DrawLinearGradient( const tools::Rectangle& rRect,
rGradient.GetBoundRect( rRect, aRect, aCenter );
bool bLinear = (rGradient.GetStyle() == GradientStyle::Linear);
bool bLinear = (rGradient.GetStyle() == css::awt::GradientStyle_LINEAR);
double fBorder = rGradient.GetBorder() * aRect.GetHeight() / 100.0;
if ( !bLinear )
{
@@ -464,7 +464,7 @@ void OutputDevice::DrawComplexGradient( const tools::Rectangle& rRect,
// all gradients are rendered as nested rectangles which shrink
// equally in each dimension - except for 'square' gradients
// which shrink to a central vertex but are not per-se square.
if( rGradient.GetStyle() != GradientStyle::Square )
if( rGradient.GetStyle() != css::awt::GradientStyle_SQUARE )
{
fScanIncY = std::min( fScanIncY, fScanIncX );
fScanIncX = fScanIncY;
@@ -510,7 +510,7 @@ void OutputDevice::DrawComplexGradient( const tools::Rectangle& rRect,
if( ( aRect.GetWidth() < 2 ) || ( aRect.GetHeight() < 2 ) )
break;
if( rGradient.GetStyle() == GradientStyle::Radial || rGradient.GetStyle() == GradientStyle::Elliptical )
if( rGradient.GetStyle() == css::awt::GradientStyle_RADIAL || rGradient.GetStyle() == css::awt::GradientStyle_ELLIPTICAL )
aPoly = tools::Polygon( aRect.Center(), aRect.GetWidth() >> 1, aRect.GetHeight() >> 1 );
else
aPoly = tools::Polygon( aRect );
@@ -591,7 +591,7 @@ tools::Long OutputDevice::GetGradientSteps(Gradient const& rGradient, tools::Rec
tools::Long nMinRect = 0;
if (rGradient.GetStyle() == GradientStyle::Linear || rGradient.GetStyle() == GradientStyle::Axial)
if (rGradient.GetStyle() == css::awt::GradientStyle_LINEAR || rGradient.GetStyle() == css::awt::GradientStyle_AXIAL)
nMinRect = rRect.GetHeight();
else
nMinRect = std::min(rRect.GetWidth(), rRect.GetHeight());
+1 -1
View File
@@ -322,7 +322,7 @@ void ToolBox::ImplDrawGradientBackground(vcl::RenderContext& rRenderContext)
Gradient g;
g.SetAngle(Degree10(mbHorz ? 0 : 900));
g.SetStyle(GradientStyle::Linear);
g.SetStyle(css::awt::GradientStyle_LINEAR);
g.SetStartColor(startCol);
g.SetEndColor(endCol);
+1 -1
View File
@@ -265,7 +265,7 @@ void MyWin::Paint(vcl::RenderContext& rRenderContext, const tools::Rectangle& rR
Color const aLightGreen(0, 0xff, 0);
Color const aDarkGreen(0, 0x40, 0);
Gradient aGradient(GradientStyle::Linear, aBlack, aWhite);
Gradient aGradient(css::awt::GradientStyle_LINEAR, aBlack, aWhite);
aGradient.SetAngle(900_deg10);
rRenderContext.DrawGradient(tools::Rectangle(Point(1000, 4500),
Size(aPaperSize.Width() - 2000, 500)),
+7 -7
View File
@@ -244,7 +244,7 @@ public:
Gradient aGradient;
aGradient.SetStartColor(COL_BLUE);
aGradient.SetEndColor(COL_GREEN);
aGradient.SetStyle(GradientStyle::Linear);
aGradient.SetStyle(css::awt::GradientStyle_LINEAR);
rDev.DrawGradient(r, aGradient);
}
@@ -795,11 +795,11 @@ public:
COL_GRAY, COL_GRAY, COL_LIGHTGRAY, COL_LIGHTBLUE, COL_LIGHTCYAN,
COL_BLUE, COL_BLUE, COL_BLUE, COL_CYAN, COL_CYAN
};
GradientStyle eStyles[] = {
GradientStyle::Linear, GradientStyle::Axial, GradientStyle::Radial, GradientStyle::Elliptical, GradientStyle::Square,
GradientStyle::Rect, GradientStyle::FORCE_EQUAL_SIZE, GradientStyle::Linear, GradientStyle::Radial, GradientStyle::Linear,
GradientStyle::Linear, GradientStyle::Axial, GradientStyle::Radial, GradientStyle::Elliptical, GradientStyle::Square,
GradientStyle::Rect, GradientStyle::FORCE_EQUAL_SIZE, GradientStyle::Linear, GradientStyle::Radial, GradientStyle::Linear
css::awt::GradientStyle eStyles[] = {
css::awt::GradientStyle_LINEAR, css::awt::GradientStyle_AXIAL, css::awt::GradientStyle_RADIAL, css::awt::GradientStyle_ELLIPTICAL, css::awt::GradientStyle_SQUARE,
css::awt::GradientStyle_RECT, css::awt::GradientStyle::GradientStyle_MAKE_FIXED_SIZE, css::awt::GradientStyle_LINEAR, css::awt::GradientStyle_RADIAL, css::awt::GradientStyle_LINEAR,
css::awt::GradientStyle_LINEAR, css::awt::GradientStyle_AXIAL, css::awt::GradientStyle_RADIAL, css::awt::GradientStyle_ELLIPTICAL, css::awt::GradientStyle_SQUARE,
css::awt::GradientStyle_RECT, css::awt::GradientStyle::GradientStyle_MAKE_FIXED_SIZE, css::awt::GradientStyle_LINEAR, css::awt::GradientStyle_RADIAL, css::awt::GradientStyle_LINEAR
};
sal_uInt16 nAngles[] = {
0, 0, 0, 0, 0,
@@ -837,7 +837,7 @@ public:
Gradient aGradient;
aGradient.SetStartColor(COL_YELLOW);
aGradient.SetEndColor(COL_RED);
aGradient.SetStyle(GradientStyle::Rect);
aGradient.SetStyle(css::awt::GradientStyle_RECT);
aGradient.SetBorder(r.GetSize().Width()/20);
rDev.DrawGradient(r, aGradient);
}