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 .
21 #include <ctype.h> // don't ask. msdev breaks otherwise...
22 #include <basegfx/numeric/ftools.hxx>
24 #include <canvas/debug.hxx>
25 #include <canvas/verbosetrace.hxx>
26 #include <tools/diagnose_ex.h>
28 #include <com/sun/star/lang/XServiceInfo.hpp>
29 #include <com/sun/star/lang/XUnoTunnel.hpp>
30 #include <com/sun/star/geometry/RealPoint2D.hpp>
31 #include <com/sun/star/geometry/IntegerRectangle2D.hpp>
33 #include <basegfx/matrix/b2dhommatrix.hxx>
34 #include <basegfx/range/b2irectangle.hxx>
35 #include <basegfx/range/b2drectangle.hxx>
36 #include <basegfx/polygon/b2dpolygon.hxx>
37 #include <basegfx/polygon/b2dpolypolygon.hxx>
38 #include <basegfx/tools/canvastools.hxx>
40 #include <canvas/canvastools.hxx>
41 #include <canvas/verifyinput.hxx>
43 #include "dx_impltools.hxx"
44 #include "dx_vcltools.hxx"
45 #include "dx_linepolypolygon.hxx"
46 #include "dx_canvasbitmap.hxx"
47 #include "dx_canvasfont.hxx"
48 #include "dx_canvas.hxx"
49 #include "dx_spritecanvas.hxx"
51 #include <boost/scoped_array.hpp>
57 using namespace ::com::sun::star
;
64 ::basegfx::B2DPolyPolygon
polyPolygonFromXPolyPolygon2D( const uno::Reference
< rendering::XPolyPolygon2D
>& xPoly
)
66 LinePolyPolygon
* pPolyImpl
= dynamic_cast< LinePolyPolygon
* >( xPoly
.get() );
70 return pPolyImpl
->getPolyPolygon();
74 const sal_Int32
nPolys( xPoly
->getNumberOfPolygons() );
76 // not a known implementation object - try data source
78 uno::Reference
< rendering::XBezierPolyPolygon2D
> xBezierPoly(
82 if( xBezierPoly
.is() )
84 return ::basegfx::unotools::polyPolygonFromBezier2DSequenceSequence(
85 xBezierPoly
->getBezierSegments( 0,
92 uno::Reference
< rendering::XLinePolyPolygon2D
> xLinePoly(
96 // no implementation class and no data provider
97 // found - contract violation.
98 ENSURE_ARG_OR_THROW( xLinePoly
.is(),
99 "VCLCanvas::polyPolygonFromXPolyPolygon2D(): Invalid input "
100 "poly-polygon, cannot retrieve vertex data" );
102 return ::basegfx::unotools::polyPolygonFromPoint2DSequenceSequence(
103 xLinePoly
->getPoints( 0,
111 void setupGraphics( Gdiplus::Graphics
& rGraphics
)
113 // setup graphics with (somewhat arbitrary) defaults
114 //rGraphics.SetCompositingQuality( Gdiplus::CompositingQualityHighQuality );
115 rGraphics
.SetCompositingQuality( Gdiplus::CompositingQualityHighSpeed
);
116 //rGraphics.SetInterpolationMode( Gdiplus::InterpolationModeHighQualityBilinear ); // with prefiltering for shrinks
117 rGraphics
.SetInterpolationMode( Gdiplus::InterpolationModeBilinear
);
119 // #122683# Switched precedence of pixel offset
120 // mode. Seemingly, polygon stroking needs
121 // PixelOffsetModeNone to achieve visually pleasing
122 // results, whereas all other operations (e.g. polygon
123 // fills, bitmaps) look better with PixelOffsetModeHalf.
124 rGraphics
.SetPixelOffsetMode( Gdiplus::PixelOffsetModeHalf
); // Pixel center at (0.5, 0.5) etc.
125 //rGraphics.SetPixelOffsetMode( Gdiplus::PixelOffsetModeNone );
127 //rGraphics.SetSmoothingMode( Gdiplus::SmoothingModeHighSpeed ); // no line/curve antialiasing
128 //rGraphics.SetSmoothingMode( Gdiplus::SmoothingModeHighQuality );
129 rGraphics
.SetSmoothingMode( Gdiplus::SmoothingModeAntiAlias
);
130 //rGraphics.SetTextRenderingHint( Gdiplus::TextRenderingHintAntiAlias );
131 rGraphics
.SetTextRenderingHint( Gdiplus::TextRenderingHintSystemDefault
);
132 rGraphics
.SetPageUnit(Gdiplus::UnitPixel
);
135 Gdiplus::Graphics
* createGraphicsFromHDC(HDC aHDC
)
137 Gdiplus::Graphics
* pRet
= new Gdiplus::Graphics(aHDC
);
139 setupGraphics( *pRet
);
143 Gdiplus::Graphics
* createGraphicsFromBitmap(const BitmapSharedPtr
& rBitmap
)
145 Gdiplus::Graphics
* pRet
= Gdiplus::Graphics::FromImage(rBitmap
.get());
147 setupGraphics( *pRet
);
151 void gdiPlusMatrixFromB2DHomMatrix( Gdiplus::Matrix
& rGdiplusMatrix
, const ::basegfx::B2DHomMatrix
& rMatrix
)
153 rGdiplusMatrix
.SetElements( static_cast<Gdiplus::REAL
>(rMatrix
.get(0,0)),
154 static_cast<Gdiplus::REAL
>(rMatrix
.get(1,0)),
155 static_cast<Gdiplus::REAL
>(rMatrix
.get(0,1)),
156 static_cast<Gdiplus::REAL
>(rMatrix
.get(1,1)),
157 static_cast<Gdiplus::REAL
>(rMatrix
.get(0,2)),
158 static_cast<Gdiplus::REAL
>(rMatrix
.get(1,2)) );
161 void gdiPlusMatrixFromAffineMatrix2D( Gdiplus::Matrix
& rGdiplusMatrix
,
162 const geometry::AffineMatrix2D
& rMatrix
)
164 rGdiplusMatrix
.SetElements( static_cast<Gdiplus::REAL
>(rMatrix
.m00
),
165 static_cast<Gdiplus::REAL
>(rMatrix
.m10
),
166 static_cast<Gdiplus::REAL
>(rMatrix
.m01
),
167 static_cast<Gdiplus::REAL
>(rMatrix
.m11
),
168 static_cast<Gdiplus::REAL
>(rMatrix
.m02
),
169 static_cast<Gdiplus::REAL
>(rMatrix
.m12
) );
174 // TODO(P2): Check whether this gets inlined. If not, make functor
176 inline Gdiplus::PointF
implGdiPlusPointFromRealPoint2D( const ::com::sun::star::geometry::RealPoint2D
& rPoint
)
178 return Gdiplus::PointF( static_cast<Gdiplus::REAL
>(rPoint
.X
),
179 static_cast<Gdiplus::REAL
>(rPoint
.Y
) );
182 void graphicsPathFromB2DPolygon( GraphicsPathSharedPtr
& rOutput
,
183 ::std::vector
< Gdiplus::PointF
>& rPoints
,
184 const ::basegfx::B2DPolygon
& rPoly
,
187 const sal_uInt32
nPoints( rPoly
.count() );
192 rOutput
->StartFigure();
194 const bool bClosedPolygon( rPoly
.isClosed() );
196 if( rPoly
.areControlPointsUsed() )
198 // control points used -> for now, add all
199 // segments as curves to GraphicsPath
201 // If the polygon is closed, we need to add the
202 // first point, thus, one more (can't simply
203 // GraphicsPath::CloseFigure() it, since the last
204 // point cannot have any control points for GDI+)
205 rPoints
.resize( 3*nPoints
+ bClosedPolygon
);
207 sal_uInt32 nCurrOutput
=0;
208 for( sal_uInt32 nCurrPoint
=0; nCurrPoint
<nPoints
; ++nCurrPoint
)
210 const ::basegfx::B2DPoint
& rPoint( rPoly
.getB2DPoint( nCurrPoint
) );
211 rPoints
[nCurrOutput
++] = Gdiplus::PointF( static_cast<Gdiplus::REAL
>(rPoint
.getX()),
212 static_cast<Gdiplus::REAL
>(rPoint
.getY()) );
214 const ::basegfx::B2DPoint
& rControlPointA( rPoly
.getNextControlPoint( nCurrPoint
) );
215 rPoints
[nCurrOutput
++] = Gdiplus::PointF( static_cast<Gdiplus::REAL
>(rControlPointA
.getX()),
216 static_cast<Gdiplus::REAL
>(rControlPointA
.getY()) );
218 const ::basegfx::B2DPoint
& rControlPointB( rPoly
.getPrevControlPoint( (nCurrPoint
+ 1) % nPoints
) );
219 rPoints
[nCurrOutput
++] = Gdiplus::PointF( static_cast<Gdiplus::REAL
>(rControlPointB
.getX()),
220 static_cast<Gdiplus::REAL
>(rControlPointB
.getY()) );
225 // add first point again (to be able to pass
226 // control points for the last point, see
228 const ::basegfx::B2DPoint
& rPoint( rPoly
.getB2DPoint(0) );
229 rPoints
[nCurrOutput
++] = Gdiplus::PointF( static_cast<Gdiplus::REAL
>(rPoint
.getX()),
230 static_cast<Gdiplus::REAL
>(rPoint
.getY()) );
232 if(bNoLineJoin
&& nCurrOutput
> 7)
234 for(sal_uInt32
a(3); a
< nCurrOutput
; a
+=3)
236 rOutput
->StartFigure();
237 rOutput
->AddBezier(rPoints
[a
- 3], rPoints
[a
- 2], rPoints
[a
- 1], rPoints
[a
]);
242 rOutput
->AddBeziers( &rPoints
[0], nCurrOutput
);
247 // GraphicsPath expects 3(n-1)+1 points (i.e. the
248 // last point must not have any trailing control
250 // Therefore, simply don't pass the last two
252 if( nCurrOutput
> 3 )
254 if(bNoLineJoin
&& nCurrOutput
> 7)
256 for(sal_uInt32
a(3); a
< nCurrOutput
; a
+=3)
258 rOutput
->StartFigure();
259 rOutput
->AddBezier(rPoints
[a
- 3], rPoints
[a
- 2], rPoints
[a
- 1], rPoints
[a
]);
264 rOutput
->AddBeziers( &rPoints
[0], nCurrOutput
-2 );
271 // no control points -> no curves, simply add
272 // straigt lines to GraphicsPath
273 rPoints
.resize( nPoints
);
275 for( sal_uInt32 nCurrPoint
=0; nCurrPoint
<nPoints
; ++nCurrPoint
)
277 const ::basegfx::B2DPoint
& rPoint( rPoly
.getB2DPoint( nCurrPoint
) );
278 rPoints
[nCurrPoint
] = Gdiplus::PointF( static_cast<Gdiplus::REAL
>(rPoint
.getX()),
279 static_cast<Gdiplus::REAL
>(rPoint
.getY()) );
282 if(bNoLineJoin
&& nPoints
> 2)
284 for(sal_uInt32
a(1); a
< nPoints
; a
++)
286 rOutput
->StartFigure();
287 rOutput
->AddLine(rPoints
[a
- 1], rPoints
[a
]);
292 rOutput
->StartFigure();
293 rOutput
->AddLine(rPoints
[nPoints
- 1], rPoints
[0]);
298 rOutput
->AddLines( &rPoints
[0], nPoints
);
302 if( bClosedPolygon
&& !bNoLineJoin
)
303 rOutput
->CloseFigure();
307 Gdiplus::PointF
gdiPlusPointFromRealPoint2D( const ::com::sun::star::geometry::RealPoint2D
& rPoint
)
309 return implGdiPlusPointFromRealPoint2D( rPoint
);
312 Gdiplus::Rect
gdiPlusRectFromIntegerRectangle2D( const geometry::IntegerRectangle2D
& rRect
)
314 return Gdiplus::Rect( rRect
.X1
,
317 rRect
.Y2
- rRect
.Y1
);
320 Gdiplus::RectF
gdiPlusRectFFromRectangle2D( const geometry::RealRectangle2D
& rRect
)
322 return Gdiplus::RectF( static_cast<Gdiplus::REAL
>(rRect
.X1
),
323 static_cast<Gdiplus::REAL
>(rRect
.Y1
),
324 static_cast<Gdiplus::REAL
>(rRect
.X2
- rRect
.X1
),
325 static_cast<Gdiplus::REAL
>(rRect
.Y2
- rRect
.Y1
) );
328 RECT
gdiRectFromB2IRect( const ::basegfx::B2IRange
& rRect
)
330 RECT aRect
= {rRect
.getMinX(),
338 geometry::RealPoint2D
realPoint2DFromGdiPlusPointF( const Gdiplus::PointF
& rPoint
)
340 return geometry::RealPoint2D( rPoint
.X
, rPoint
.Y
);
343 geometry::RealRectangle2D
realRectangle2DFromGdiPlusRectF( const Gdiplus::RectF
& rRect
)
345 return geometry::RealRectangle2D( rRect
.X
, rRect
.Y
,
346 rRect
.X
+ rRect
.Width
,
347 rRect
.Y
+ rRect
.Height
);
350 ::basegfx::B2DPoint
b2dPointFromGdiPlusPointF( const Gdiplus::PointF
& rPoint
)
352 return ::basegfx::B2DPoint( rPoint
.X
, rPoint
.Y
);
355 ::basegfx::B2DRange
b2dRangeFromGdiPlusRectF( const Gdiplus::RectF
& rRect
)
357 return ::basegfx::B2DRange( rRect
.X
, rRect
.Y
,
358 rRect
.X
+ rRect
.Width
,
359 rRect
.Y
+ rRect
.Height
);
362 uno::Sequence
< double > argbToDoubleSequence( const Gdiplus::ARGB
& rColor
)
364 // TODO(F1): handle color space conversions, when defined on canvas/graphicDevice
365 uno::Sequence
< double > aRet(4);
367 aRet
[0] = ((rColor
>> 16) & 0xFF) / 255.0; // red
368 aRet
[1] = ((rColor
>> 8) & 0xFF) / 255.0; // green
369 aRet
[2] = (rColor
& 0xFF) / 255.0; // blue
370 aRet
[3] = ((rColor
>> 24) & 0xFF) / 255.0; // alpha
375 uno::Sequence
< sal_Int8
> argbToIntSequence( const Gdiplus::ARGB
& rColor
)
377 // TODO(F1): handle color space conversions, when defined on canvas/graphicDevice
378 uno::Sequence
< sal_Int8
> aRet(4);
380 aRet
[0] = static_cast<sal_Int8
>((rColor
>> 16) & 0xFF); // red
381 aRet
[1] = static_cast<sal_Int8
>((rColor
>> 8) & 0xFF); // green
382 aRet
[2] = static_cast<sal_Int8
>(rColor
& 0xFF); // blue
383 aRet
[3] = static_cast<sal_Int8
>((rColor
>> 24) & 0xFF); // alpha
388 Gdiplus::ARGB
sequenceToArgb( const uno::Sequence
< sal_Int8
>& rColor
)
390 ENSURE_OR_THROW( rColor
.getLength() > 2,
391 "sequenceToArgb: need at least three channels" );
393 // TODO(F1): handle color space conversions, when defined on canvas/graphicDevice
394 Gdiplus::ARGB aColor
;
396 aColor
= (static_cast<sal_uInt8
>(rColor
[0]) << 16) | (static_cast<sal_uInt8
>(rColor
[1]) << 8) | static_cast<sal_uInt8
>(rColor
[2]);
398 if( rColor
.getLength() > 3 )
399 aColor
|= static_cast<sal_uInt8
>(rColor
[3]) << 24;
404 Gdiplus::ARGB
sequenceToArgb( const uno::Sequence
< double >& rColor
)
406 ENSURE_OR_THROW( rColor
.getLength() > 2,
407 "sequenceToColor: need at least three channels" );
409 // TODO(F1): handle color space conversions, when defined on canvas/graphicDevice
410 Gdiplus::ARGB aColor
;
412 ::canvas::tools::verifyRange(rColor
[0],0.0,1.0);
413 ::canvas::tools::verifyRange(rColor
[1],0.0,1.0);
414 ::canvas::tools::verifyRange(rColor
[2],0.0,1.0);
417 (static_cast<sal_uInt8
>( ::basegfx::fround( 255*rColor
[0] ) ) << 16) |
418 (static_cast<sal_uInt8
>( ::basegfx::fround( 255*rColor
[1] ) ) << 8) |
419 static_cast<sal_uInt8
>( ::basegfx::fround( 255*rColor
[2] ) );
421 if( rColor
.getLength() > 3 )
423 ::canvas::tools::verifyRange(rColor
[3],0.0,1.0);
424 aColor
|= static_cast<sal_uInt8
>( ::basegfx::fround( 255*rColor
[3] ) ) << 24;
430 GraphicsPathSharedPtr
graphicsPathFromRealPoint2DSequence( const uno::Sequence
< uno::Sequence
< geometry::RealPoint2D
> >& points
)
432 GraphicsPathSharedPtr
pRes( new Gdiplus::GraphicsPath() );
433 ::std::vector
< Gdiplus::PointF
> aPoints
;
436 for( nCurrPoly
=0; nCurrPoly
<points
.getLength(); ++nCurrPoly
)
438 const sal_Int32
nCurrSize( points
[nCurrPoly
].getLength() );
441 aPoints
.resize( nCurrSize
);
443 // TODO(F1): Closed/open polygons
445 // convert from RealPoint2D array to Gdiplus::PointF array
446 ::std::transform( points
[nCurrPoly
].getConstArray(),
447 points
[nCurrPoly
].getConstArray()+nCurrSize
,
449 implGdiPlusPointFromRealPoint2D
);
451 pRes
->AddLines( &aPoints
[0], nCurrSize
);
458 GraphicsPathSharedPtr
graphicsPathFromB2DPolygon( const ::basegfx::B2DPolygon
& rPoly
, bool bNoLineJoin
)
460 GraphicsPathSharedPtr
pRes( new Gdiplus::GraphicsPath() );
461 ::std::vector
< Gdiplus::PointF
> aPoints
;
463 graphicsPathFromB2DPolygon( pRes
, aPoints
, rPoly
, bNoLineJoin
);
468 GraphicsPathSharedPtr
graphicsPathFromB2DPolyPolygon( const ::basegfx::B2DPolyPolygon
& rPoly
, bool bNoLineJoin
)
470 GraphicsPathSharedPtr
pRes( new Gdiplus::GraphicsPath() );
471 ::std::vector
< Gdiplus::PointF
> aPoints
;
473 const sal_uInt32
nPolies( rPoly
.count() );
474 for( sal_uInt32 nCurrPoly
=0; nCurrPoly
<nPolies
; ++nCurrPoly
)
476 graphicsPathFromB2DPolygon( pRes
,
478 rPoly
.getB2DPolygon( nCurrPoly
),
485 GraphicsPathSharedPtr
graphicsPathFromXPolyPolygon2D( const uno::Reference
< rendering::XPolyPolygon2D
>& xPoly
, bool bNoLineJoin
)
487 LinePolyPolygon
* pPolyImpl
= dynamic_cast< LinePolyPolygon
* >( xPoly
.get() );
491 return pPolyImpl
->getGraphicsPath( bNoLineJoin
);
495 return tools::graphicsPathFromB2DPolyPolygon(
496 polyPolygonFromXPolyPolygon2D( xPoly
), bNoLineJoin
);
500 bool drawGdiPlusBitmap( const GraphicsSharedPtr
& rGraphics
,
501 const BitmapSharedPtr
& rBitmap
)
503 Gdiplus::PointF aPoint
;
504 return (Gdiplus::Ok
== rGraphics
->DrawImage( rBitmap
.get(),
508 bool drawDIBits( const GraphicsSharedPtr
& rGraphics
,
509 const BITMAPINFO
& rBI
,
512 BitmapSharedPtr
pBitmap(
513 Gdiplus::Bitmap::FromBITMAPINFO( &rBI
,
516 return drawGdiPlusBitmap( rGraphics
,
520 bool drawRGBABits( const GraphicsSharedPtr
& rGraphics
,
521 const RawRGBABitmap
& rRawRGBAData
)
523 BitmapSharedPtr
pBitmap( new Gdiplus::Bitmap( rRawRGBAData
.mnWidth
,
524 rRawRGBAData
.mnHeight
,
525 PixelFormat32bppARGB
) );
527 Gdiplus::BitmapData aBmpData
;
528 aBmpData
.Width
= rRawRGBAData
.mnWidth
;
529 aBmpData
.Height
= rRawRGBAData
.mnHeight
;
530 aBmpData
.Stride
= 4*aBmpData
.Width
; // bottom-up format
531 aBmpData
.PixelFormat
= PixelFormat32bppARGB
;
532 aBmpData
.Scan0
= rRawRGBAData
.mpBitmapData
.get();
534 const Gdiplus::Rect
aRect( 0,0,aBmpData
.Width
,aBmpData
.Height
);
535 if( Gdiplus::Ok
!= pBitmap
->LockBits( &aRect
,
536 Gdiplus::ImageLockModeWrite
| Gdiplus::ImageLockModeUserInputBuf
,
537 PixelFormat32bppARGB
,
543 // commit data to bitmap
544 pBitmap
->UnlockBits( &aBmpData
);
546 return drawGdiPlusBitmap( rGraphics
,
550 BitmapSharedPtr
bitmapFromXBitmap( const uno::Reference
< rendering::XBitmap
>& xBitmap
)
552 BitmapProvider
* pBitmapProvider
= dynamic_cast< BitmapProvider
* >(xBitmap
.get());
554 if( pBitmapProvider
)
556 IBitmapSharedPtr
pBitmap( pBitmapProvider
->getBitmap() );
557 return pBitmap
->getBitmap();
561 // not a native CanvasBitmap, extract VCL bitmap and
562 // render into GDI+ bitmap of similar size
563 // =================================================
565 const geometry::IntegerSize2D
aBmpSize( xBitmap
->getSize() );
566 BitmapSharedPtr pBitmap
;
568 if( xBitmap
->hasAlpha() )
570 // TODO(P2): At least for the alpha bitmap case, it
571 // would be possible to generate the corresponding
573 pBitmap
.reset( new Gdiplus::Bitmap( aBmpSize
.Width
,
575 PixelFormat32bppARGB
) );
579 // TODO(F2): Might be wise to create bitmap compatible
580 // to the VCL bitmap. Also, check whether the VCL
581 // bitmap's system handles can be used to create the
582 // GDI+ bitmap (currently, it does not seem so).
583 pBitmap
.reset( new Gdiplus::Bitmap( aBmpSize
.Width
,
585 PixelFormat24bppRGB
) );
588 GraphicsSharedPtr
pGraphics(createGraphicsFromBitmap(pBitmap
));
589 tools::setupGraphics(*pGraphics
);
590 if( !drawVCLBitmapFromXBitmap(
601 CanvasFont::ImplRef
canvasFontFromXFont( const uno::Reference
< rendering::XCanvasFont
>& xFont
)
603 CanvasFont
* pCanvasFont
= dynamic_cast< CanvasFont
* >(xFont
.get());
605 ENSURE_ARG_OR_THROW( pCanvasFont
,
606 "canvasFontFromXFont(): Invalid XFont (or incompatible font for this XCanvas)" );
608 return CanvasFont::ImplRef( pCanvasFont
);
611 void setModulateImageAttributes( Gdiplus::ImageAttributes
& o_rAttr
,
612 double nRedModulation
,
613 double nGreenModulation
,
614 double nBlueModulation
,
615 double nAlphaModulation
)
617 // This gets rather verbose, but we have to setup a color
618 // transformation matrix, in order to incorporate the global
619 // alpha value mfAlpha into the bitmap rendering.
620 Gdiplus::ColorMatrix aColorMatrix
;
622 aColorMatrix
.m
[0][0] = static_cast<Gdiplus::REAL
>(nRedModulation
);
623 aColorMatrix
.m
[0][1] = 0.0;
624 aColorMatrix
.m
[0][2] = 0.0;
625 aColorMatrix
.m
[0][3] = 0.0;
626 aColorMatrix
.m
[0][4] = 0.0;
628 aColorMatrix
.m
[1][0] = 0.0;
629 aColorMatrix
.m
[1][1] = static_cast<Gdiplus::REAL
>(nGreenModulation
);
630 aColorMatrix
.m
[1][2] = 0.0;
631 aColorMatrix
.m
[1][3] = 0.0;
632 aColorMatrix
.m
[1][4] = 0.0;
634 aColorMatrix
.m
[2][0] = 0.0;
635 aColorMatrix
.m
[2][1] = 0.0;
636 aColorMatrix
.m
[2][2] = static_cast<Gdiplus::REAL
>(nBlueModulation
);
637 aColorMatrix
.m
[2][3] = 0.0;
638 aColorMatrix
.m
[2][4] = 0.0;
640 aColorMatrix
.m
[3][0] = 0.0;
641 aColorMatrix
.m
[3][1] = 0.0;
642 aColorMatrix
.m
[3][2] = 0.0;
643 aColorMatrix
.m
[3][3] = static_cast<Gdiplus::REAL
>(nAlphaModulation
);
644 aColorMatrix
.m
[3][4] = 0.0;
646 aColorMatrix
.m
[4][0] = 0.0;
647 aColorMatrix
.m
[4][1] = 0.0;
648 aColorMatrix
.m
[4][2] = 0.0;
649 aColorMatrix
.m
[4][3] = 0.0;
650 aColorMatrix
.m
[4][4] = 1.0;
652 o_rAttr
.SetColorMatrix( &aColorMatrix
,
653 Gdiplus::ColorMatrixFlagsDefault
,
654 Gdiplus::ColorAdjustTypeDefault
);
658 } // namespace dxcanvas
660 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */