36 #include <com/sun/star/awt/Rectangle.hpp>
37 #include <com/sun/star/awt/XWindow2.hpp>
38 #include <com/sun/star/beans/XPropertySet.hpp>
39 #include <com/sun/star/geometry/AffineMatrix2D.hpp>
40 #include <com/sun/star/geometry/Matrix2D.hpp>
41 #include <com/sun/star/lang/XServiceInfo.hpp>
42 #include <com/sun/star/rendering/ColorComponentTag.hpp>
43 #include <com/sun/star/rendering/ColorSpaceType.hpp>
44 #include <com/sun/star/rendering/CompositeOperation.hpp>
45 #include <com/sun/star/rendering/IntegerBitmapLayout.hpp>
46 #include <com/sun/star/rendering/RenderState.hpp>
47 #include <com/sun/star/rendering/RenderingIntent.hpp>
48 #include <com/sun/star/rendering/ViewState.hpp>
49 #include <com/sun/star/rendering/XCanvas.hpp>
50 #include <com/sun/star/rendering/XColorSpace.hpp>
51 #include <com/sun/star/rendering/XIntegerBitmapColorSpace.hpp>
52 #include <com/sun/star/util/Endianness.hpp>
54 #include <rtl/instance.hxx>
70 return geometry::RealSize2D(
71 std::numeric_limits<double>::infinity(),
72 std::numeric_limits<double>::infinity() );
79 renderState.Clip.clear();
80 renderState.DeviceColor = uno::Sequence< double >();
81 renderState.CompositeOperation = rendering::CompositeOperation::OVER;
90 viewState.Clip.clear();
96 const rendering::ViewState& viewState )
98 return ::basegfx::unotools::homMatrixFromAffineMatrix( transform, viewState.AffineTransform );
102 const ::basegfx::B2DHomMatrix& transform )
104 ::basegfx::unotools::affineMatrixFromHomMatrix( viewState.AffineTransform, transform );
110 const rendering::RenderState& renderState )
112 return ::basegfx::unotools::homMatrixFromAffineMatrix( transform, renderState.AffineTransform );
116 const ::basegfx::B2DHomMatrix& transform )
118 ::basegfx::unotools::affineMatrixFromHomMatrix( renderState.AffineTransform, transform );
124 const ::basegfx::B2DHomMatrix& rTransform )
133 const ::basegfx::B2DHomMatrix& rTransform )
142 const rendering::ViewState& viewState,
143 const rendering::RenderState& renderState )
147 ::basegfx::unotools::homMatrixFromAffineMatrix( combinedTransform, renderState.AffineTransform );
148 ::basegfx::unotools::homMatrixFromAffineMatrix( viewTransform, viewState.AffineTransform );
151 combinedTransform *= viewTransform;
153 return combinedTransform;
180 class StandardColorSpace :
public cppu::WeakImplHelper< css::rendering::XIntegerBitmapColorSpace >
186 virtual ::sal_Int8 SAL_CALL
getType( )
override
188 return rendering::ColorSpaceType::RGB;
190 virtual uno::Sequence< ::sal_Int8 > SAL_CALL getComponentTags( )
override
194 virtual ::sal_Int8 SAL_CALL getRenderingIntent( )
override
196 return rendering::RenderingIntent::PERCEPTUAL;
198 virtual uno::Sequence< beans::PropertyValue > SAL_CALL getProperties( )
override
200 return uno::Sequence< beans::PropertyValue >();
202 virtual uno::Sequence< double > SAL_CALL convertColorSpace(
const uno::Sequence< double >& deviceColor,
203 const uno::Reference< rendering::XColorSpace >& targetColorSpace )
override
207 uno::Sequence<rendering::ARGBColor> aIntermediate(
208 convertToARGB(deviceColor));
209 return targetColorSpace->convertFromARGB(aIntermediate);
211 virtual uno::Sequence< rendering::RGBColor > SAL_CALL convertToRGB(
const uno::Sequence< double >& deviceColor )
override
213 const double* pIn( deviceColor.getConstArray() );
214 const std::size_t nLen( deviceColor.getLength() );
216 "number of channels no multiple of 4",
217 static_cast<rendering::XColorSpace*>(
this), 0);
219 uno::Sequence< rendering::RGBColor > aRes(nLen/4);
220 rendering::RGBColor*
pOut( aRes.getArray() );
221 for( std::size_t i=0;
i<nLen;
i+=4 )
223 *
pOut++ = rendering::RGBColor(pIn[0],pIn[1],pIn[2]);
228 virtual uno::Sequence< rendering::ARGBColor > SAL_CALL convertToARGB(
const uno::Sequence< double >& deviceColor )
override
230 SAL_WARN_IF(!deviceColor.hasElements(),
"canvas",
"empty deviceColor argument");
231 const double* pIn( deviceColor.getConstArray() );
232 const std::size_t nLen( deviceColor.getLength() );
234 "number of channels no multiple of 4",
235 static_cast<rendering::XColorSpace*>(
this), 0);
237 uno::Sequence< rendering::ARGBColor > aRes(nLen/4);
238 rendering::ARGBColor*
pOut( aRes.getArray() );
239 for( std::size_t i=0;
i<nLen;
i+=4 )
241 *
pOut++ = rendering::ARGBColor(pIn[3],pIn[0],pIn[1],pIn[2]);
246 virtual uno::Sequence< rendering::ARGBColor > SAL_CALL convertToPARGB(
const uno::Sequence< double >& deviceColor )
override
248 const double* pIn( deviceColor.getConstArray() );
249 const std::size_t nLen( deviceColor.getLength() );
251 "number of channels no multiple of 4",
252 static_cast<rendering::XColorSpace*>(
this), 0);
254 uno::Sequence< rendering::ARGBColor > aRes(nLen/4);
255 rendering::ARGBColor*
pOut( aRes.getArray() );
256 for( std::size_t i=0;
i<nLen;
i+=4 )
258 *
pOut++ = rendering::ARGBColor(pIn[3],pIn[3]*pIn[0],pIn[3]*pIn[1],pIn[3]*pIn[2]);
263 virtual uno::Sequence< double > SAL_CALL convertFromRGB(
const uno::Sequence< rendering::RGBColor >& rgbColor )
override
265 const rendering::RGBColor* pIn( rgbColor.getConstArray() );
266 const std::size_t nLen( rgbColor.getLength() );
268 uno::Sequence< double > aRes(nLen*4);
269 double* pColors=aRes.getArray();
270 for( std::size_t i=0;
i<nLen; ++
i )
272 *pColors++ = pIn->Red;
273 *pColors++ = pIn->Green;
274 *pColors++ = pIn->Blue;
280 virtual uno::Sequence< double > SAL_CALL convertFromARGB(
const uno::Sequence< rendering::ARGBColor >& rgbColor )
override
282 const rendering::ARGBColor* pIn( rgbColor.getConstArray() );
283 const std::size_t nLen( rgbColor.getLength() );
285 uno::Sequence< double > aRes(nLen*4);
286 double* pColors=aRes.getArray();
287 for( std::size_t i=0;
i<nLen; ++
i )
289 *pColors++ = pIn->Red;
290 *pColors++ = pIn->Green;
291 *pColors++ = pIn->Blue;
292 *pColors++ = pIn->Alpha;
297 virtual uno::Sequence< double > SAL_CALL convertFromPARGB(
const uno::Sequence< rendering::ARGBColor >& rgbColor )
override
299 const rendering::ARGBColor* pIn( rgbColor.getConstArray() );
300 const std::size_t nLen( rgbColor.getLength() );
302 uno::Sequence< double > aRes(nLen*4);
303 double* pColors=aRes.getArray();
304 for( std::size_t i=0;
i<nLen; ++
i )
306 *pColors++ = pIn->Red/pIn->Alpha;
307 *pColors++ = pIn->Green/pIn->Alpha;
308 *pColors++ = pIn->Blue/pIn->Alpha;
309 *pColors++ = pIn->Alpha;
316 virtual ::sal_Int32 SAL_CALL getBitsPerPixel( )
override
320 virtual uno::Sequence< ::sal_Int32 > SAL_CALL getComponentBitCounts( )
override
324 virtual ::sal_Int8 SAL_CALL getEndianness( )
override
326 return util::Endianness::LITTLE;
328 virtual uno::Sequence<double> SAL_CALL convertFromIntegerColorSpace(
const uno::Sequence< ::sal_Int8 >& deviceColor,
329 const uno::Reference< rendering::XColorSpace >& targetColorSpace )
override
331 if( dynamic_cast<StandardColorSpace*>(targetColorSpace.get()) )
333 const sal_Int8* pIn( deviceColor.getConstArray() );
334 const std::size_t nLen( deviceColor.getLength() );
336 "number of channels no multiple of 4",
337 static_cast<rendering::XColorSpace*>(
this), 0);
339 uno::Sequence<double> aRes(nLen);
340 double*
pOut( aRes.getArray() );
341 for( std::size_t i=0;
i<nLen;
i+=4 )
354 uno::Sequence<rendering::ARGBColor> aIntermediate(
355 convertIntegerToARGB(deviceColor));
356 return targetColorSpace->convertFromARGB(aIntermediate);
359 virtual uno::Sequence< ::sal_Int8 > SAL_CALL convertToIntegerColorSpace(
const uno::Sequence< ::sal_Int8 >& deviceColor,
360 const uno::Reference< rendering::XIntegerBitmapColorSpace >& targetColorSpace )
override
362 if( dynamic_cast<StandardColorSpace*>(targetColorSpace.get()) )
371 uno::Sequence<rendering::ARGBColor> aIntermediate(
372 convertIntegerToARGB(deviceColor));
373 return targetColorSpace->convertIntegerFromARGB(aIntermediate);
376 virtual uno::Sequence< rendering::RGBColor > SAL_CALL convertIntegerToRGB(
const uno::Sequence< ::sal_Int8 >& deviceColor )
override
378 const sal_Int8* pIn( deviceColor.getConstArray() );
379 const std::size_t nLen( deviceColor.getLength() );
381 "number of channels no multiple of 4",
382 static_cast<rendering::XColorSpace*>(
this), 0);
384 uno::Sequence< rendering::RGBColor > aRes(nLen/4);
385 rendering::RGBColor*
pOut( aRes.getArray() );
386 for( std::size_t i=0;
i<nLen;
i+=4 )
388 *
pOut++ = rendering::RGBColor(
397 virtual uno::Sequence< rendering::ARGBColor > SAL_CALL convertIntegerToARGB(
const uno::Sequence< ::sal_Int8 >& deviceColor )
override
399 const sal_Int8* pIn( deviceColor.getConstArray() );
400 const std::size_t nLen( deviceColor.getLength() );
402 "number of channels no multiple of 4",
403 static_cast<rendering::XColorSpace*>(
this), 0);
405 uno::Sequence< rendering::ARGBColor > aRes(nLen/4);
406 rendering::ARGBColor*
pOut( aRes.getArray() );
407 for( std::size_t i=0;
i<nLen;
i+=4 )
409 *
pOut++ = rendering::ARGBColor(
419 virtual uno::Sequence< rendering::ARGBColor > SAL_CALL convertIntegerToPARGB(
const uno::Sequence< ::sal_Int8 >& deviceColor )
override
421 const sal_Int8* pIn( deviceColor.getConstArray() );
422 const std::size_t nLen( deviceColor.getLength() );
424 "number of channels no multiple of 4",
425 static_cast<rendering::XColorSpace*>(
this), 0);
427 uno::Sequence< rendering::ARGBColor > aRes(nLen/4);
428 rendering::ARGBColor*
pOut( aRes.getArray() );
429 for( std::size_t i=0;
i<nLen;
i+=4 )
432 *
pOut++ = rendering::ARGBColor(
442 virtual uno::Sequence< ::sal_Int8 > SAL_CALL convertIntegerFromRGB(
const uno::Sequence< rendering::RGBColor >& rgbColor )
override
444 const rendering::RGBColor* pIn( rgbColor.getConstArray() );
445 const std::size_t nLen( rgbColor.getLength() );
447 uno::Sequence< sal_Int8 > aRes(nLen*4);
449 for( std::size_t i=0;
i<nLen; ++
i )
460 virtual uno::Sequence< ::sal_Int8 > SAL_CALL convertIntegerFromARGB(
const uno::Sequence< rendering::ARGBColor >& rgbColor )
override
462 const rendering::ARGBColor* pIn( rgbColor.getConstArray() );
463 const std::size_t nLen( rgbColor.getLength() );
465 uno::Sequence< sal_Int8 > aRes(nLen*4);
467 for( std::size_t i=0;
i<nLen; ++
i )
478 virtual uno::Sequence< ::sal_Int8 > SAL_CALL convertIntegerFromPARGB(
const uno::Sequence< rendering::ARGBColor >& rgbColor )
override
480 const rendering::ARGBColor* pIn( rgbColor.getConstArray() );
481 const std::size_t nLen( rgbColor.getLength() );
483 uno::Sequence< sal_Int8 > aRes(nLen*4);
485 for( std::size_t i=0;
i<nLen; ++
i )
497 StandardColorSpace() :
501 sal_Int8* pTags = maComponentTags.getArray();
502 sal_Int32* pBitCounts = maBitCounts.getArray();
503 pTags[0] = rendering::ColorComponentTag::RGB_RED;
504 pTags[1] = rendering::ColorComponentTag::RGB_GREEN;
505 pTags[2] = rendering::ColorComponentTag::RGB_BLUE;
506 pTags[3] = rendering::ColorComponentTag::ALPHA;
515 class StandardNoAlphaColorSpace :
public cppu::WeakImplHelper< css::rendering::XIntegerBitmapColorSpace >
521 virtual ::sal_Int8 SAL_CALL
getType( )
override
523 return rendering::ColorSpaceType::RGB;
525 virtual uno::Sequence< ::sal_Int8 > SAL_CALL getComponentTags( )
override
529 virtual ::sal_Int8 SAL_CALL getRenderingIntent( )
override
531 return rendering::RenderingIntent::PERCEPTUAL;
533 virtual uno::Sequence< beans::PropertyValue > SAL_CALL getProperties( )
override
535 return uno::Sequence< beans::PropertyValue >();
537 virtual uno::Sequence< double > SAL_CALL convertColorSpace(
const uno::Sequence< double >& deviceColor,
538 const uno::Reference< rendering::XColorSpace >& targetColorSpace )
override
542 uno::Sequence<rendering::ARGBColor> aIntermediate(
543 convertToARGB(deviceColor));
544 return targetColorSpace->convertFromARGB(aIntermediate);
546 virtual uno::Sequence< rendering::RGBColor > SAL_CALL convertToRGB(
const uno::Sequence< double >& deviceColor )
override
548 const double* pIn( deviceColor.getConstArray() );
549 const std::size_t nLen( deviceColor.getLength() );
551 "number of channels no multiple of 4",
552 static_cast<rendering::XColorSpace*>(
this), 0);
554 uno::Sequence< rendering::RGBColor > aRes(nLen/4);
555 rendering::RGBColor*
pOut( aRes.getArray() );
556 for( std::size_t i=0;
i<nLen;
i+=4 )
558 *
pOut++ = rendering::RGBColor(pIn[0],pIn[1],pIn[2]);
563 virtual uno::Sequence< rendering::ARGBColor > SAL_CALL convertToARGB(
const uno::Sequence< double >& deviceColor )
override
565 const double* pIn( deviceColor.getConstArray() );
566 const std::size_t nLen( deviceColor.getLength() );
568 "number of channels no multiple of 4",
569 static_cast<rendering::XColorSpace*>(
this), 0);
571 uno::Sequence< rendering::ARGBColor > aRes(nLen/4);
572 rendering::ARGBColor*
pOut( aRes.getArray() );
573 for( std::size_t i=0;
i<nLen;
i+=4 )
575 *
pOut++ = rendering::ARGBColor(1.0,pIn[0],pIn[1],pIn[2]);
580 virtual uno::Sequence< rendering::ARGBColor > SAL_CALL convertToPARGB(
const uno::Sequence< double >& deviceColor )
override
582 const double* pIn( deviceColor.getConstArray() );
583 const std::size_t nLen( deviceColor.getLength() );
585 "number of channels no multiple of 4",
586 static_cast<rendering::XColorSpace*>(
this), 0);
588 uno::Sequence< rendering::ARGBColor > aRes(nLen/4);
589 rendering::ARGBColor*
pOut( aRes.getArray() );
590 for( std::size_t i=0;
i<nLen;
i+=4 )
592 *
pOut++ = rendering::ARGBColor(1.0,pIn[0],pIn[1],pIn[2]);
597 virtual uno::Sequence< double > SAL_CALL convertFromRGB(
const uno::Sequence< rendering::RGBColor >& rgbColor )
override
599 const rendering::RGBColor* pIn( rgbColor.getConstArray() );
600 const std::size_t nLen( rgbColor.getLength() );
602 uno::Sequence< double > aRes(nLen*4);
603 double* pColors=aRes.getArray();
604 for( std::size_t i=0;
i<nLen; ++
i )
606 *pColors++ = pIn->Red;
607 *pColors++ = pIn->Green;
608 *pColors++ = pIn->Blue;
614 virtual uno::Sequence< double > SAL_CALL convertFromARGB(
const uno::Sequence< rendering::ARGBColor >& rgbColor )
override
616 const rendering::ARGBColor* pIn( rgbColor.getConstArray() );
617 const std::size_t nLen( rgbColor.getLength() );
619 uno::Sequence< double > aRes(nLen*4);
620 double* pColors=aRes.getArray();
621 for( std::size_t i=0;
i<nLen; ++
i )
623 *pColors++ = pIn->Red;
624 *pColors++ = pIn->Green;
625 *pColors++ = pIn->Blue;
631 virtual uno::Sequence< double > SAL_CALL convertFromPARGB(
const uno::Sequence< rendering::ARGBColor >& rgbColor )
override
633 const rendering::ARGBColor* pIn( rgbColor.getConstArray() );
634 const std::size_t nLen( rgbColor.getLength() );
636 uno::Sequence< double > aRes(nLen*4);
637 double* pColors=aRes.getArray();
638 for( std::size_t i=0;
i<nLen; ++
i )
640 *pColors++ = pIn->Red/pIn->Alpha;
641 *pColors++ = pIn->Green/pIn->Alpha;
642 *pColors++ = pIn->Blue/pIn->Alpha;
650 virtual ::sal_Int32 SAL_CALL getBitsPerPixel( )
override
654 virtual uno::Sequence< ::sal_Int32 > SAL_CALL getComponentBitCounts( )
override
658 virtual ::sal_Int8 SAL_CALL getEndianness( )
override
660 return util::Endianness::LITTLE;
662 virtual uno::Sequence<double> SAL_CALL convertFromIntegerColorSpace(
const uno::Sequence< ::sal_Int8 >& deviceColor,
663 const uno::Reference< rendering::XColorSpace >& targetColorSpace )
override
665 if( dynamic_cast<StandardNoAlphaColorSpace*>(targetColorSpace.get()) )
667 const sal_Int8* pIn( deviceColor.getConstArray() );
668 const std::size_t nLen( deviceColor.getLength() );
670 "number of channels no multiple of 4",
671 static_cast<rendering::XColorSpace*>(
this), 0);
673 uno::Sequence<double> aRes(nLen);
674 double*
pOut( aRes.getArray() );
675 for( std::size_t i=0;
i<nLen;
i+=4 )
680 *
pOut++ = 1.0; pIn++;
688 uno::Sequence<rendering::ARGBColor> aIntermediate(
689 convertIntegerToARGB(deviceColor));
690 return targetColorSpace->convertFromARGB(aIntermediate);
693 virtual uno::Sequence< ::sal_Int8 > SAL_CALL convertToIntegerColorSpace(
const uno::Sequence< ::sal_Int8 >& deviceColor,
694 const uno::Reference< rendering::XIntegerBitmapColorSpace >& targetColorSpace )
override
696 if( dynamic_cast<StandardNoAlphaColorSpace*>(targetColorSpace.get()) )
705 uno::Sequence<rendering::ARGBColor> aIntermediate(
706 convertIntegerToARGB(deviceColor));
707 return targetColorSpace->convertIntegerFromARGB(aIntermediate);
710 virtual uno::Sequence< rendering::RGBColor > SAL_CALL convertIntegerToRGB(
const uno::Sequence< ::sal_Int8 >& deviceColor )
override
712 const sal_Int8* pIn( deviceColor.getConstArray() );
713 const std::size_t nLen( deviceColor.getLength() );
715 "number of channels no multiple of 4",
716 static_cast<rendering::XColorSpace*>(
this), 0);
718 uno::Sequence< rendering::RGBColor > aRes(nLen/4);
719 rendering::RGBColor*
pOut( aRes.getArray() );
720 for( std::size_t i=0;
i<nLen;
i+=4 )
722 *
pOut++ = rendering::RGBColor(
731 virtual uno::Sequence< rendering::ARGBColor > SAL_CALL convertIntegerToARGB(
const uno::Sequence< ::sal_Int8 >& deviceColor )
override
733 const sal_Int8* pIn( deviceColor.getConstArray() );
734 const std::size_t nLen( deviceColor.getLength() );
736 "number of channels no multiple of 4",
737 static_cast<rendering::XColorSpace*>(
this), 0);
739 uno::Sequence< rendering::ARGBColor > aRes(nLen/4);
740 rendering::ARGBColor*
pOut( aRes.getArray() );
741 for( std::size_t i=0;
i<nLen;
i+=4 )
743 *
pOut++ = rendering::ARGBColor(
753 virtual uno::Sequence< rendering::ARGBColor > SAL_CALL convertIntegerToPARGB(
const uno::Sequence< ::sal_Int8 >& deviceColor )
override
755 const sal_Int8* pIn( deviceColor.getConstArray() );
756 const std::size_t nLen( deviceColor.getLength() );
758 "number of channels no multiple of 4",
759 static_cast<rendering::XColorSpace*>(
this), 0);
761 uno::Sequence< rendering::ARGBColor > aRes(nLen/4);
762 rendering::ARGBColor*
pOut( aRes.getArray() );
763 for( std::size_t i=0;
i<nLen;
i+=4 )
765 *
pOut++ = rendering::ARGBColor(
775 virtual uno::Sequence< ::sal_Int8 > SAL_CALL convertIntegerFromRGB(
const uno::Sequence< rendering::RGBColor >& rgbColor )
override
777 const rendering::RGBColor* pIn( rgbColor.getConstArray() );
778 const std::size_t nLen( rgbColor.getLength() );
780 uno::Sequence< sal_Int8 > aRes(nLen*4);
782 for( std::size_t i=0;
i<nLen; ++
i )
793 virtual uno::Sequence< ::sal_Int8 > SAL_CALL convertIntegerFromARGB(
const uno::Sequence< rendering::ARGBColor >& rgbColor )
override
795 const rendering::ARGBColor* pIn( rgbColor.getConstArray() );
796 const std::size_t nLen( rgbColor.getLength() );
798 uno::Sequence< sal_Int8 > aRes(nLen*4);
800 for( std::size_t i=0;
i<nLen; ++
i )
811 virtual uno::Sequence< ::sal_Int8 > SAL_CALL convertIntegerFromPARGB(
const uno::Sequence< rendering::ARGBColor >& rgbColor )
override
813 const rendering::ARGBColor* pIn( rgbColor.getConstArray() );
814 const std::size_t nLen( rgbColor.getLength() );
816 uno::Sequence< sal_Int8 > aRes(nLen*4);
818 for( std::size_t i=0;
i<nLen; ++
i )
830 StandardNoAlphaColorSpace() :
834 sal_Int8* pTags = maComponentTags.getArray();
835 sal_Int32* pBitCounts = maBitCounts.getArray();
836 pTags[0] = rendering::ColorComponentTag::RGB_RED;
837 pTags[1] = rendering::ColorComponentTag::RGB_GREEN;
838 pTags[2] = rendering::ColorComponentTag::RGB_BLUE;
846 struct StandardColorSpaceHolder :
public rtl::StaticWithInit<uno::Reference<rendering::XIntegerBitmapColorSpace>,
847 StandardColorSpaceHolder>
849 uno::Reference<rendering::XIntegerBitmapColorSpace> operator()()
851 return new StandardColorSpace();
855 struct StandardNoAlphaColorSpaceHolder :
public rtl::StaticWithInit<uno::Reference<rendering::XIntegerBitmapColorSpace>,
856 StandardNoAlphaColorSpaceHolder>
858 uno::Reference<rendering::XIntegerBitmapColorSpace> operator()()
860 return new StandardNoAlphaColorSpace();
867 return StandardColorSpaceHolder::get();
872 return StandardNoAlphaColorSpaceHolder::get();
877 rendering::IntegerBitmapLayout aLayout;
879 aLayout.ScanLines = rBmpSize.Height;
880 aLayout.ScanLineBytes = rBmpSize.Width*4;
881 aLayout.ScanLineStride = aLayout.ScanLineBytes;
882 aLayout.PlaneStride = 0;
884 aLayout.Palette.clear();
885 aLayout.IsMsbFirst =
false;
892 uno::Sequence<sal_Int8> aRet(4);
895 pCols[0] = rColor.GetRed();
896 pCols[1] = rColor.GetGreen();
897 pCols[2] = rColor.GetBlue();
898 pCols[3] = 255-rColor.GetTransparency();
900 *
reinterpret_cast<sal_Int32*
>(pCols) = sal_Int32(rColor);
911 const ::basegfx::B2DRange& i_srcRect,
912 const ::basegfx::B2DHomMatrix& i_transformation )
914 if( i_srcRect.isEmpty() )
916 o_transform = i_transformation;
932 o_transform = aCorrectedTransform * i_transformation;
938 const ::basegfx::B2DRange& inRect,
939 const ::basegfx::B2DHomMatrix& transformation )
943 if( inRect.isEmpty() )
950 outRect.
expand( transformation * inRect.getMinimum() );
953 outRect.
expand( transformation * inRect.getMaximum() );
958 aPoint.
setX( inRect.getMaxX() );
959 aPoint.
setY( inRect.getMinY() );
961 aPoint *= transformation;
965 aPoint.
setX( inRect.getMinX() );
966 aPoint.
setY( inRect.getMaxY() );
968 aPoint *= transformation;
975 bool isInside( const ::basegfx::B2DRange& rContainedRect,
976 const ::basegfx::B2DRange& rTransformRect,
977 const ::basegfx::B2DHomMatrix& rTransformation )
979 if( rContainedRect.isEmpty() || rTransformRect.isEmpty() )
997 const ::basegfx::B2IRange& rSourceBounds,
998 const ::basegfx::B2IRange& rDestBounds )
1000 const ::basegfx::B2IPoint aSourceTopLeft(
1006 aLocalSourceArea.intersect( rSourceBounds );
1008 if( aLocalSourceArea.isEmpty() )
1013 const ::basegfx::B2IVector aUpperLeftOffset(
1014 aLocalSourceArea.getMinimum()-aSourceTopLeft );
1015 const ::basegfx::B2IVector aLowerRightOffset(
1016 aLocalSourceArea.getMaximum()-aSourceTopLeft );
1019 io_rDestPoint + aLowerRightOffset );
1022 aLocalDestArea.intersect( rDestBounds );
1024 if( aLocalDestArea.isEmpty() )
1029 const ::basegfx::B2IVector aDestUpperLeftOffset(
1030 aLocalDestArea.getMinimum()-io_rDestPoint );
1031 const ::basegfx::B2IVector aDestLowerRightOffset(
1032 aLocalDestArea.getMaximum()-io_rDestPoint );
1035 aSourceTopLeft + aDestLowerRightOffset );
1036 io_rDestPoint = aLocalDestArea.getMinimum();
1039 *o_pDestArea = aLocalDestArea;
1047 std::vector< ::basegfx::B2IRange >& o_ClippedAreas,
1048 const ::basegfx::B2IRange& rBounds )
1054 const ::basegfx::B2I64Tuple& rRange( io_rSourceArea.
getRange() );
1056 io_rDestPoint.
getY(),
1057 (io_rDestPoint.
getX()
1058 +
static_cast<sal_Int32
>(rRange.getX())),
1059 (io_rDestPoint.
getY()
1060 +
static_cast<sal_Int32
>(rRange.getY())) );
1065 if( !clipAreaImpl( &aResultingDestArea,
1074 ::basegfx::computeSetDifference( o_ClippedAreas,
1076 aResultingDestArea );
1083 if( rRange.isEmpty() )
1084 return ::basegfx::B2IRange();
1086 const ::basegfx::B2IPoint aTopLeft( ::
basegfx::fround( rRange.getMinX() ),
1088 return ::basegfx::B2IRange( aTopLeft,
1094 uno::Sequence< uno::Any >&
getDeviceInfo(
const uno::Reference< rendering::XCanvas >& i_rxCanvas,
1095 uno::Sequence< uno::Any >& o_rxParams )
1097 o_rxParams.realloc( 0 );
1099 if( i_rxCanvas.is() )
1103 uno::Reference< rendering::XGraphicDevice > xDevice( i_rxCanvas->getDevice(),
1104 uno::UNO_SET_THROW );
1106 uno::Reference< lang::XServiceInfo > xServiceInfo( xDevice,
1107 uno::UNO_QUERY_THROW );
1108 uno::Reference< beans::XPropertySet > xPropSet( xDevice,
1109 uno::UNO_QUERY_THROW );
1111 o_rxParams.realloc( 2 );
1113 o_rxParams[ 0 ] <<= xServiceInfo->getImplementationName();
1114 o_rxParams[ 1 ] = xPropSet->getPropertyValue(
"DeviceHandle" );
1116 catch(
const uno::Exception& )
1126 const uno::Reference< awt::XWindow2 >& xWin )
1128 awt::Rectangle aRetVal( rRect );
1133 ::Point aPoint( aRetVal.X,
1138 aRetVal.X = aPoint.X();
1139 aRetVal.Y = aPoint.Y();
1150 const double nX0( rRange.getMinX() );
1151 const double nY0( rRange.getMinY() );
1152 const double nX1( rRange.getMaxX() );
1153 const double nY1( rRange.getMaxY() );
1185 aPolyPoly.
append( aPoly );
1191 const rendering::ViewState& viewState,
1192 const rendering::RenderState& renderState,
1193 const rendering::Texture& texture,
1201 ::basegfx::unotools::homMatrixFromAffineMatrix( rTotalTransform,
1202 texture.AffineTransform );
1206 rTotalTransform *= aMatrix;
1215 aLeftTop *= rTotalTransform;
1216 aLeftBottom *= rTotalTransform;
1217 aRightTop *= rTotalTransform;
1218 aRightBottom*= rTotalTransform;
1221 const int nGradientSize(
1228 const int nStripSize( nGradientSize < 50 ? 2 : 4 );
1234 nGradientSize / nStripSize,
1239 const rendering::RenderState& renderState,
1246 if( viewState.Clip.is() )
1251 if( aClipPoly.
count() )
1257 viewState.AffineTransform ) );
1268 if( renderState.Clip.is() )
1279 if( aClipPoly.
count() )
1298 if( aClipRegion.
IsNull() )
1315 sal_uInt32 &rEmphasisMark)
1317 for(
const beans::PropertyValue& rPropVal : rExtraFontProperties)
1319 if (rPropVal.Name ==
"EmphasisMark")
1320 rPropVal.Value >>= rEmphasisMark;
void intersect(const B2IRange &rRange)
void expand(const B2DTuple &rTuple)
void append(const basegfx::B2DPoint &rPoint, sal_uInt32 nCount)
bool getType(BSTR name, Type &type)
B2I64Tuple getRange() const
static vcl::Region GetRegionFromPolyPolygon(const tools::PolyPolygon &rPolyPoly)
static vcl::Window * GetWindow(const css::uno::Reference< css::awt::XWindow > &rxWindow)
B2IRange fround(const B2DRange &rRange)
B2DPolygon createPolygonFromRect(const B2DRectangle &rRect, double fRadiusX, double fRadiusY)
B2IPoint getMinimum() const
#define ENSURE_ARG_OR_THROW2(c, m, ifc, arg)
void transform(const basegfx::B2DHomMatrix &rMatrix)
void Intersect(const tools::Rectangle &rRegion)
void transform(const basegfx::B2DHomMatrix &rMatrix)
void append(const B2DPolygon &rPolygon, sal_uInt32 nCount=1)
#define SAL_WARN_IF(condition, area, stream)
double getLength(const B2DPolygon &rCandidate)
Point OutputToScreenPixel(const Point &rPos) const
B2DHomMatrix createTranslateB2DHomMatrix(double fTranslateX, double fTranslateY)