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>
69 return geometry::RealSize2D(
70 std::numeric_limits<double>::infinity(),
71 std::numeric_limits<double>::infinity() );
78 renderState.Clip.clear();
79 renderState.DeviceColor = uno::Sequence< double >();
80 renderState.CompositeOperation = rendering::CompositeOperation::OVER;
89 viewState.Clip.clear();
95 const rendering::ViewState& viewState )
97 return ::basegfx::unotools::homMatrixFromAffineMatrix( transform, viewState.AffineTransform );
101 const ::basegfx::B2DHomMatrix& transform )
103 ::basegfx::unotools::affineMatrixFromHomMatrix( viewState.AffineTransform, transform );
109 const rendering::RenderState& renderState )
111 return ::basegfx::unotools::homMatrixFromAffineMatrix( transform, renderState.AffineTransform );
115 const ::basegfx::B2DHomMatrix& transform )
117 ::basegfx::unotools::affineMatrixFromHomMatrix( renderState.AffineTransform, transform );
123 const ::basegfx::B2DHomMatrix& rTransform )
132 const ::basegfx::B2DHomMatrix& rTransform )
141 const rendering::ViewState& viewState,
142 const rendering::RenderState& renderState )
146 ::basegfx::unotools::homMatrixFromAffineMatrix( combinedTransform, renderState.AffineTransform );
147 ::basegfx::unotools::homMatrixFromAffineMatrix( viewTransform, viewState.AffineTransform );
150 combinedTransform *= viewTransform;
152 return combinedTransform;
179 class StandardColorSpace :
public cppu::WeakImplHelper< css::rendering::XIntegerBitmapColorSpace >
185 virtual ::sal_Int8 SAL_CALL
getType( )
override
187 return rendering::ColorSpaceType::RGB;
189 virtual uno::Sequence< ::sal_Int8 > SAL_CALL getComponentTags( )
override
193 virtual ::sal_Int8 SAL_CALL getRenderingIntent( )
override
195 return rendering::RenderingIntent::PERCEPTUAL;
197 virtual uno::Sequence< beans::PropertyValue > SAL_CALL getProperties( )
override
199 return uno::Sequence< beans::PropertyValue >();
201 virtual uno::Sequence< double > SAL_CALL convertColorSpace(
const uno::Sequence< double >& deviceColor,
202 const uno::Reference< rendering::XColorSpace >& targetColorSpace )
override
206 uno::Sequence<rendering::ARGBColor> aIntermediate(
207 convertToARGB(deviceColor));
208 return targetColorSpace->convertFromARGB(aIntermediate);
210 virtual uno::Sequence< rendering::RGBColor > SAL_CALL convertToRGB(
const uno::Sequence< double >& deviceColor )
override
212 const double* pIn( deviceColor.getConstArray() );
213 const std::size_t nLen( deviceColor.getLength() );
215 "number of channels no multiple of 4",
216 static_cast<rendering::XColorSpace*
>(
this), 0);
218 uno::Sequence< rendering::RGBColor > aRes(nLen/4);
219 rendering::RGBColor*
pOut( aRes.getArray() );
220 for( std::size_t i=0;
i<nLen;
i+=4 )
222 *
pOut++ = rendering::RGBColor(pIn[0],pIn[1],pIn[2]);
227 virtual uno::Sequence< rendering::ARGBColor > SAL_CALL convertToARGB(
const uno::Sequence< double >& deviceColor )
override
229 SAL_WARN_IF(!deviceColor.hasElements(),
"canvas",
"empty deviceColor argument");
230 const double* pIn( deviceColor.getConstArray() );
231 const std::size_t nLen( deviceColor.getLength() );
233 "number of channels no multiple of 4",
234 static_cast<rendering::XColorSpace*
>(
this), 0);
236 uno::Sequence< rendering::ARGBColor > aRes(nLen/4);
237 rendering::ARGBColor*
pOut( aRes.getArray() );
238 for( std::size_t i=0;
i<nLen;
i+=4 )
240 *
pOut++ = rendering::ARGBColor(pIn[3],pIn[0],pIn[1],pIn[2]);
245 virtual uno::Sequence< rendering::ARGBColor > SAL_CALL convertToPARGB(
const uno::Sequence< double >& deviceColor )
override
247 const double* pIn( deviceColor.getConstArray() );
248 const std::size_t nLen( deviceColor.getLength() );
250 "number of channels no multiple of 4",
251 static_cast<rendering::XColorSpace*
>(
this), 0);
253 uno::Sequence< rendering::ARGBColor > aRes(nLen/4);
254 rendering::ARGBColor*
pOut( aRes.getArray() );
255 for( std::size_t i=0;
i<nLen;
i+=4 )
257 *
pOut++ = rendering::ARGBColor(pIn[3],pIn[3]*pIn[0],pIn[3]*pIn[1],pIn[3]*pIn[2]);
262 virtual uno::Sequence< double > SAL_CALL convertFromRGB(
const uno::Sequence< rendering::RGBColor >& rgbColor )
override
264 const rendering::RGBColor* pIn( rgbColor.getConstArray() );
265 const std::size_t nLen( rgbColor.getLength() );
267 uno::Sequence< double > aRes(nLen*4);
268 double* pColors=aRes.getArray();
269 for( std::size_t i=0;
i<nLen; ++
i )
271 *pColors++ = pIn->Red;
272 *pColors++ = pIn->Green;
273 *pColors++ = pIn->Blue;
279 virtual uno::Sequence< double > SAL_CALL convertFromARGB(
const uno::Sequence< rendering::ARGBColor >& rgbColor )
override
281 const rendering::ARGBColor* pIn( rgbColor.getConstArray() );
282 const std::size_t nLen( rgbColor.getLength() );
284 uno::Sequence< double > aRes(nLen*4);
285 double* pColors=aRes.getArray();
286 for( std::size_t i=0;
i<nLen; ++
i )
288 *pColors++ = pIn->Red;
289 *pColors++ = pIn->Green;
290 *pColors++ = pIn->Blue;
291 *pColors++ = pIn->Alpha;
296 virtual uno::Sequence< double > SAL_CALL convertFromPARGB(
const uno::Sequence< rendering::ARGBColor >& rgbColor )
override
298 const rendering::ARGBColor* pIn( rgbColor.getConstArray() );
299 const std::size_t nLen( rgbColor.getLength() );
301 uno::Sequence< double > aRes(nLen*4);
302 double* pColors=aRes.getArray();
303 for( std::size_t i=0;
i<nLen; ++
i )
305 *pColors++ = pIn->Red/pIn->Alpha;
306 *pColors++ = pIn->Green/pIn->Alpha;
307 *pColors++ = pIn->Blue/pIn->Alpha;
308 *pColors++ = pIn->Alpha;
315 virtual ::sal_Int32 SAL_CALL getBitsPerPixel( )
override
319 virtual uno::Sequence< ::sal_Int32 > SAL_CALL getComponentBitCounts( )
override
323 virtual ::sal_Int8 SAL_CALL getEndianness( )
override
325 return util::Endianness::LITTLE;
327 virtual uno::Sequence<double> SAL_CALL convertFromIntegerColorSpace(
const uno::Sequence< ::sal_Int8 >& deviceColor,
328 const uno::Reference< rendering::XColorSpace >& targetColorSpace )
override
330 if(
dynamic_cast<StandardColorSpace*
>(targetColorSpace.get()) )
332 const sal_Int8* pIn( deviceColor.getConstArray() );
333 const std::size_t nLen( deviceColor.getLength() );
335 "number of channels no multiple of 4",
336 static_cast<rendering::XColorSpace*
>(
this), 0);
338 uno::Sequence<double> aRes(nLen);
339 double*
pOut( aRes.getArray() );
340 for( std::size_t i=0;
i<nLen;
i+=4 )
353 uno::Sequence<rendering::ARGBColor> aIntermediate(
354 convertIntegerToARGB(deviceColor));
355 return targetColorSpace->convertFromARGB(aIntermediate);
358 virtual uno::Sequence< ::sal_Int8 > SAL_CALL convertToIntegerColorSpace(
const uno::Sequence< ::sal_Int8 >& deviceColor,
359 const uno::Reference< rendering::XIntegerBitmapColorSpace >& targetColorSpace )
override
361 if(
dynamic_cast<StandardColorSpace*
>(targetColorSpace.get()) )
370 uno::Sequence<rendering::ARGBColor> aIntermediate(
371 convertIntegerToARGB(deviceColor));
372 return targetColorSpace->convertIntegerFromARGB(aIntermediate);
375 virtual uno::Sequence< rendering::RGBColor > SAL_CALL convertIntegerToRGB(
const uno::Sequence< ::sal_Int8 >& deviceColor )
override
377 const sal_Int8* pIn( deviceColor.getConstArray() );
378 const std::size_t nLen( deviceColor.getLength() );
380 "number of channels no multiple of 4",
381 static_cast<rendering::XColorSpace*
>(
this), 0);
383 uno::Sequence< rendering::RGBColor > aRes(nLen/4);
384 rendering::RGBColor*
pOut( aRes.getArray() );
385 for( std::size_t i=0;
i<nLen;
i+=4 )
387 *
pOut++ = rendering::RGBColor(
396 virtual uno::Sequence< rendering::ARGBColor > SAL_CALL convertIntegerToARGB(
const uno::Sequence< ::sal_Int8 >& deviceColor )
override
398 const sal_Int8* pIn( deviceColor.getConstArray() );
399 const std::size_t nLen( deviceColor.getLength() );
401 "number of channels no multiple of 4",
402 static_cast<rendering::XColorSpace*
>(
this), 0);
404 uno::Sequence< rendering::ARGBColor > aRes(nLen/4);
405 rendering::ARGBColor*
pOut( aRes.getArray() );
406 for( std::size_t i=0;
i<nLen;
i+=4 )
408 *
pOut++ = rendering::ARGBColor(
418 virtual uno::Sequence< rendering::ARGBColor > SAL_CALL convertIntegerToPARGB(
const uno::Sequence< ::sal_Int8 >& deviceColor )
override
420 const sal_Int8* pIn( deviceColor.getConstArray() );
421 const std::size_t nLen( deviceColor.getLength() );
423 "number of channels no multiple of 4",
424 static_cast<rendering::XColorSpace*
>(
this), 0);
426 uno::Sequence< rendering::ARGBColor > aRes(nLen/4);
427 rendering::ARGBColor*
pOut( aRes.getArray() );
428 for( std::size_t i=0;
i<nLen;
i+=4 )
431 *
pOut++ = rendering::ARGBColor(
441 virtual uno::Sequence< ::sal_Int8 > SAL_CALL convertIntegerFromRGB(
const uno::Sequence< rendering::RGBColor >& rgbColor )
override
443 const rendering::RGBColor* pIn( rgbColor.getConstArray() );
444 const std::size_t nLen( rgbColor.getLength() );
446 uno::Sequence< sal_Int8 > aRes(nLen*4);
448 for( std::size_t i=0;
i<nLen; ++
i )
459 virtual uno::Sequence< ::sal_Int8 > SAL_CALL convertIntegerFromARGB(
const uno::Sequence< rendering::ARGBColor >& rgbColor )
override
461 const rendering::ARGBColor* pIn( rgbColor.getConstArray() );
462 const std::size_t nLen( rgbColor.getLength() );
464 uno::Sequence< sal_Int8 > aRes(nLen*4);
466 for( std::size_t i=0;
i<nLen; ++
i )
477 virtual uno::Sequence< ::sal_Int8 > SAL_CALL convertIntegerFromPARGB(
const uno::Sequence< rendering::ARGBColor >& rgbColor )
override
479 const rendering::ARGBColor* pIn( rgbColor.getConstArray() );
480 const std::size_t nLen( rgbColor.getLength() );
482 uno::Sequence< sal_Int8 > aRes(nLen*4);
484 for( std::size_t i=0;
i<nLen; ++
i )
496 StandardColorSpace() :
502 pTags[0] = rendering::ColorComponentTag::RGB_RED;
503 pTags[1] = rendering::ColorComponentTag::RGB_GREEN;
504 pTags[2] = rendering::ColorComponentTag::RGB_BLUE;
505 pTags[3] = rendering::ColorComponentTag::ALPHA;
514 class StandardNoAlphaColorSpace :
public cppu::WeakImplHelper< css::rendering::XIntegerBitmapColorSpace >
520 virtual ::sal_Int8 SAL_CALL
getType( )
override
522 return rendering::ColorSpaceType::RGB;
524 virtual uno::Sequence< ::sal_Int8 > SAL_CALL getComponentTags( )
override
528 virtual ::sal_Int8 SAL_CALL getRenderingIntent( )
override
530 return rendering::RenderingIntent::PERCEPTUAL;
532 virtual uno::Sequence< beans::PropertyValue > SAL_CALL getProperties( )
override
534 return uno::Sequence< beans::PropertyValue >();
536 virtual uno::Sequence< double > SAL_CALL convertColorSpace(
const uno::Sequence< double >& deviceColor,
537 const uno::Reference< rendering::XColorSpace >& targetColorSpace )
override
541 uno::Sequence<rendering::ARGBColor> aIntermediate(
542 convertToARGB(deviceColor));
543 return targetColorSpace->convertFromARGB(aIntermediate);
545 virtual uno::Sequence< rendering::RGBColor > SAL_CALL convertToRGB(
const uno::Sequence< double >& deviceColor )
override
547 const double* pIn( deviceColor.getConstArray() );
548 const std::size_t nLen( deviceColor.getLength() );
550 "number of channels no multiple of 4",
551 static_cast<rendering::XColorSpace*
>(
this), 0);
553 uno::Sequence< rendering::RGBColor > aRes(nLen/4);
554 rendering::RGBColor*
pOut( aRes.getArray() );
555 for( std::size_t i=0;
i<nLen;
i+=4 )
557 *
pOut++ = rendering::RGBColor(pIn[0],pIn[1],pIn[2]);
562 virtual uno::Sequence< rendering::ARGBColor > SAL_CALL convertToARGB(
const uno::Sequence< double >& deviceColor )
override
564 const double* pIn( deviceColor.getConstArray() );
565 const std::size_t nLen( deviceColor.getLength() );
567 "number of channels no multiple of 4",
568 static_cast<rendering::XColorSpace*
>(
this), 0);
570 uno::Sequence< rendering::ARGBColor > aRes(nLen/4);
571 rendering::ARGBColor*
pOut( aRes.getArray() );
572 for( std::size_t i=0;
i<nLen;
i+=4 )
574 *
pOut++ = rendering::ARGBColor(1.0,pIn[0],pIn[1],pIn[2]);
579 virtual uno::Sequence< rendering::ARGBColor > SAL_CALL convertToPARGB(
const uno::Sequence< double >& deviceColor )
override
581 const double* pIn( deviceColor.getConstArray() );
582 const std::size_t nLen( deviceColor.getLength() );
584 "number of channels no multiple of 4",
585 static_cast<rendering::XColorSpace*
>(
this), 0);
587 uno::Sequence< rendering::ARGBColor > aRes(nLen/4);
588 rendering::ARGBColor*
pOut( aRes.getArray() );
589 for( std::size_t i=0;
i<nLen;
i+=4 )
591 *
pOut++ = rendering::ARGBColor(1.0,pIn[0],pIn[1],pIn[2]);
596 virtual uno::Sequence< double > SAL_CALL convertFromRGB(
const uno::Sequence< rendering::RGBColor >& rgbColor )
override
598 const rendering::RGBColor* pIn( rgbColor.getConstArray() );
599 const std::size_t nLen( rgbColor.getLength() );
601 uno::Sequence< double > aRes(nLen*4);
602 double* pColors=aRes.getArray();
603 for( std::size_t i=0;
i<nLen; ++
i )
605 *pColors++ = pIn->Red;
606 *pColors++ = pIn->Green;
607 *pColors++ = pIn->Blue;
613 virtual uno::Sequence< double > SAL_CALL convertFromARGB(
const uno::Sequence< rendering::ARGBColor >& rgbColor )
override
615 const rendering::ARGBColor* pIn( rgbColor.getConstArray() );
616 const std::size_t nLen( rgbColor.getLength() );
618 uno::Sequence< double > aRes(nLen*4);
619 double* pColors=aRes.getArray();
620 for( std::size_t i=0;
i<nLen; ++
i )
622 *pColors++ = pIn->Red;
623 *pColors++ = pIn->Green;
624 *pColors++ = pIn->Blue;
630 virtual uno::Sequence< double > SAL_CALL convertFromPARGB(
const uno::Sequence< rendering::ARGBColor >& rgbColor )
override
632 const rendering::ARGBColor* pIn( rgbColor.getConstArray() );
633 const std::size_t nLen( rgbColor.getLength() );
635 uno::Sequence< double > aRes(nLen*4);
636 double* pColors=aRes.getArray();
637 for( std::size_t i=0;
i<nLen; ++
i )
639 *pColors++ = pIn->Red/pIn->Alpha;
640 *pColors++ = pIn->Green/pIn->Alpha;
641 *pColors++ = pIn->Blue/pIn->Alpha;
649 virtual ::sal_Int32 SAL_CALL getBitsPerPixel( )
override
653 virtual uno::Sequence< ::sal_Int32 > SAL_CALL getComponentBitCounts( )
override
657 virtual ::sal_Int8 SAL_CALL getEndianness( )
override
659 return util::Endianness::LITTLE;
661 virtual uno::Sequence<double> SAL_CALL convertFromIntegerColorSpace(
const uno::Sequence< ::sal_Int8 >& deviceColor,
662 const uno::Reference< rendering::XColorSpace >& targetColorSpace )
override
664 if(
dynamic_cast<StandardNoAlphaColorSpace*
>(targetColorSpace.get()) )
666 const sal_Int8* pIn( deviceColor.getConstArray() );
667 const std::size_t nLen( deviceColor.getLength() );
669 "number of channels no multiple of 4",
670 static_cast<rendering::XColorSpace*
>(
this), 0);
672 uno::Sequence<double> aRes(nLen);
673 double*
pOut( aRes.getArray() );
674 for( std::size_t i=0;
i<nLen;
i+=4 )
679 *
pOut++ = 1.0; pIn++;
687 uno::Sequence<rendering::ARGBColor> aIntermediate(
688 convertIntegerToARGB(deviceColor));
689 return targetColorSpace->convertFromARGB(aIntermediate);
692 virtual uno::Sequence< ::sal_Int8 > SAL_CALL convertToIntegerColorSpace(
const uno::Sequence< ::sal_Int8 >& deviceColor,
693 const uno::Reference< rendering::XIntegerBitmapColorSpace >& targetColorSpace )
override
695 if(
dynamic_cast<StandardNoAlphaColorSpace*
>(targetColorSpace.get()) )
704 uno::Sequence<rendering::ARGBColor> aIntermediate(
705 convertIntegerToARGB(deviceColor));
706 return targetColorSpace->convertIntegerFromARGB(aIntermediate);
709 virtual uno::Sequence< rendering::RGBColor > SAL_CALL convertIntegerToRGB(
const uno::Sequence< ::sal_Int8 >& deviceColor )
override
711 const sal_Int8* pIn( deviceColor.getConstArray() );
712 const std::size_t nLen( deviceColor.getLength() );
714 "number of channels no multiple of 4",
715 static_cast<rendering::XColorSpace*
>(
this), 0);
717 uno::Sequence< rendering::RGBColor > aRes(nLen/4);
718 rendering::RGBColor*
pOut( aRes.getArray() );
719 for( std::size_t i=0;
i<nLen;
i+=4 )
721 *
pOut++ = rendering::RGBColor(
730 virtual uno::Sequence< rendering::ARGBColor > SAL_CALL convertIntegerToARGB(
const uno::Sequence< ::sal_Int8 >& deviceColor )
override
732 const sal_Int8* pIn( deviceColor.getConstArray() );
733 const std::size_t nLen( deviceColor.getLength() );
735 "number of channels no multiple of 4",
736 static_cast<rendering::XColorSpace*
>(
this), 0);
738 uno::Sequence< rendering::ARGBColor > aRes(nLen/4);
739 rendering::ARGBColor*
pOut( aRes.getArray() );
740 for( std::size_t i=0;
i<nLen;
i+=4 )
742 *
pOut++ = rendering::ARGBColor(
752 virtual uno::Sequence< rendering::ARGBColor > SAL_CALL convertIntegerToPARGB(
const uno::Sequence< ::sal_Int8 >& deviceColor )
override
754 const sal_Int8* pIn( deviceColor.getConstArray() );
755 const std::size_t nLen( deviceColor.getLength() );
757 "number of channels no multiple of 4",
758 static_cast<rendering::XColorSpace*
>(
this), 0);
760 uno::Sequence< rendering::ARGBColor > aRes(nLen/4);
761 rendering::ARGBColor*
pOut( aRes.getArray() );
762 for( std::size_t i=0;
i<nLen;
i+=4 )
764 *
pOut++ = rendering::ARGBColor(
774 virtual uno::Sequence< ::sal_Int8 > SAL_CALL convertIntegerFromRGB(
const uno::Sequence< rendering::RGBColor >& rgbColor )
override
776 const rendering::RGBColor* pIn( rgbColor.getConstArray() );
777 const std::size_t nLen( rgbColor.getLength() );
779 uno::Sequence< sal_Int8 > aRes(nLen*4);
781 for( std::size_t i=0;
i<nLen; ++
i )
792 virtual uno::Sequence< ::sal_Int8 > SAL_CALL convertIntegerFromARGB(
const uno::Sequence< rendering::ARGBColor >& rgbColor )
override
794 const rendering::ARGBColor* pIn( rgbColor.getConstArray() );
795 const std::size_t nLen( rgbColor.getLength() );
797 uno::Sequence< sal_Int8 > aRes(nLen*4);
799 for( std::size_t i=0;
i<nLen; ++
i )
810 virtual uno::Sequence< ::sal_Int8 > SAL_CALL convertIntegerFromPARGB(
const uno::Sequence< rendering::ARGBColor >& rgbColor )
override
812 const rendering::ARGBColor* pIn( rgbColor.getConstArray() );
813 const std::size_t nLen( rgbColor.getLength() );
815 uno::Sequence< sal_Int8 > aRes(nLen*4);
817 for( std::size_t i=0;
i<nLen; ++
i )
829 StandardNoAlphaColorSpace() :
835 pTags[0] = rendering::ColorComponentTag::RGB_RED;
836 pTags[1] = rendering::ColorComponentTag::RGB_GREEN;
837 pTags[2] = rendering::ColorComponentTag::RGB_BLUE;
849 static uno::Reference<rendering::XIntegerBitmapColorSpace>
SPACE =
new StandardColorSpace();
855 static uno::Reference<rendering::XIntegerBitmapColorSpace>
SPACE =
new StandardNoAlphaColorSpace();
861 rendering::IntegerBitmapLayout aLayout;
863 aLayout.ScanLines = rBmpSize.Height;
864 aLayout.ScanLineBytes = rBmpSize.Width*4;
865 aLayout.ScanLineStride = aLayout.ScanLineBytes;
866 aLayout.PlaneStride = 0;
868 aLayout.Palette.clear();
869 aLayout.IsMsbFirst =
false;
876 uno::Sequence<sal_Int8> aRet(4);
879 pCols[0] = rColor.GetRed();
880 pCols[1] = rColor.GetGreen();
881 pCols[2] = rColor.GetBlue();
882 pCols[3] = rColor.GetAlpha();
884 *
reinterpret_cast<sal_Int32*
>(pCols) = sal_Int32(rColor);
895 const ::basegfx::B2DRange& i_srcRect,
896 const ::basegfx::B2DHomMatrix& i_transformation )
898 if( i_srcRect.isEmpty() )
900 o_transform = i_transformation;
916 o_transform = aCorrectedTransform * i_transformation;
922 const ::basegfx::B2DRange& inRect,
923 const ::basegfx::B2DHomMatrix& transformation )
927 if( inRect.isEmpty() )
934 outRect.
expand( transformation * inRect.getMinimum() );
937 outRect.
expand( transformation * inRect.getMaximum() );
942 aPoint.
setX( inRect.getMaxX() );
943 aPoint.
setY( inRect.getMinY() );
945 aPoint *= transformation;
949 aPoint.
setX( inRect.getMinX() );
950 aPoint.
setY( inRect.getMaxY() );
952 aPoint *= transformation;
959 bool isInside( const ::basegfx::B2DRange& rContainedRect,
960 const ::basegfx::B2DRange& rTransformRect,
961 const ::basegfx::B2DHomMatrix& rTransformation )
963 if( rContainedRect.isEmpty() || rTransformRect.isEmpty() )
967 ::basegfx::utils::createPolygonFromRect( rTransformRect ) );
971 ::basegfx::utils::createPolygonFromRect(
981 const ::basegfx::B2IRange& rSourceBounds,
982 const ::basegfx::B2IRange& rDestBounds )
984 const ::basegfx::B2IPoint aSourceTopLeft(
990 aLocalSourceArea.intersect( rSourceBounds );
992 if( aLocalSourceArea.isEmpty() )
997 const ::basegfx::B2IVector aUpperLeftOffset(
998 aLocalSourceArea.getMinimum()-aSourceTopLeft );
999 const ::basegfx::B2IVector aLowerRightOffset(
1000 aLocalSourceArea.getMaximum()-aSourceTopLeft );
1003 io_rDestPoint + aLowerRightOffset );
1006 aLocalDestArea.intersect( rDestBounds );
1008 if( aLocalDestArea.isEmpty() )
1013 const ::basegfx::B2IVector aDestUpperLeftOffset(
1014 aLocalDestArea.getMinimum()-io_rDestPoint );
1015 const ::basegfx::B2IVector aDestLowerRightOffset(
1016 aLocalDestArea.getMaximum()-io_rDestPoint );
1019 aSourceTopLeft + aDestLowerRightOffset );
1020 io_rDestPoint = aLocalDestArea.getMinimum();
1023 *o_pDestArea = aLocalDestArea;
1031 std::vector< ::basegfx::B2IRange >& o_ClippedAreas,
1032 const ::basegfx::B2IRange& rBounds )
1038 const ::basegfx::B2I64Tuple& rRange( io_rSourceArea.
getRange() );
1040 io_rDestPoint.
getY(),
1041 (io_rDestPoint.
getX()
1042 +
static_cast<sal_Int32
>(rRange.getX())),
1043 (io_rDestPoint.
getY()
1044 +
static_cast<sal_Int32
>(rRange.getY())) );
1049 if( !clipAreaImpl( &aResultingDestArea,
1058 ::basegfx::computeSetDifference( o_ClippedAreas,
1060 aResultingDestArea );
1067 if( rRange.isEmpty() )
1068 return ::basegfx::B2IRange();
1070 const ::basegfx::B2IPoint aTopLeft( ::basegfx::fround( rRange.getMinX() ),
1071 ::basegfx::fround( rRange.getMinY() ) );
1072 return ::basegfx::B2IRange( aTopLeft,
1074 ::basegfx::fround( rRange.getWidth() ),
1075 ::basegfx::fround( rRange.getHeight() ) ) );
1078 uno::Sequence< uno::Any >&
getDeviceInfo(
const uno::Reference< rendering::XCanvas >& i_rxCanvas,
1079 uno::Sequence< uno::Any >& o_rxParams )
1081 o_rxParams.realloc( 0 );
1083 if( !i_rxCanvas.is() )
1088 uno::Reference< rendering::XGraphicDevice > xDevice( i_rxCanvas->getDevice(),
1089 uno::UNO_SET_THROW );
1091 uno::Reference< lang::XServiceInfo > xServiceInfo( xDevice,
1092 uno::UNO_QUERY_THROW );
1093 uno::Reference< beans::XPropertySet > xPropSet( xDevice,
1094 uno::UNO_QUERY_THROW );
1096 o_rxParams = {
uno::Any(xServiceInfo->getImplementationName()),
1097 xPropSet->getPropertyValue(
"DeviceHandle" ) };
1099 catch(
const uno::Exception& )
1108 const uno::Reference< awt::XWindow2 >& xWin )
1110 awt::Rectangle aRetVal( rRect );
1118 aPoint = pWindow->OutputToScreenPixel( aPoint );
1120 aRetVal.X = aPoint.
X();
1121 aRetVal.Y = aPoint.
Y();
1132 const double nX0( rRange.getMinX() );
1133 const double nY0( rRange.getMinY() );
1134 const double nX1( rRange.getMaxX() );
1135 const double nY1( rRange.getMaxY() );
1167 aPolyPoly.
append( aPoly );
1173 const rendering::ViewState& viewState,
1174 const rendering::RenderState& renderState,
1175 const rendering::Texture& texture,
1183 ::basegfx::unotools::homMatrixFromAffineMatrix( rTotalTransform,
1184 texture.AffineTransform );
1188 rTotalTransform *= aMatrix;
1197 aLeftTop *= rTotalTransform;
1198 aLeftBottom *= rTotalTransform;
1199 aRightTop *= rTotalTransform;
1200 aRightBottom*= rTotalTransform;
1203 const int nGradientSize(
1210 const int nStripSize( nGradientSize < 50 ? 2 : 4 );
1216 nGradientSize / nStripSize,
1221 const rendering::RenderState& renderState,
1228 if( viewState.Clip.is() )
1231 ::basegfx::unotools::b2DPolyPolygonFromXPolyPolygon2D(viewState.Clip) );
1233 if( aClipPoly.
count() )
1238 ::basegfx::unotools::homMatrixFromAffineMatrix( aMatrix,
1239 viewState.AffineTransform ) );
1250 if( renderState.Clip.is() )
1253 ::basegfx::unotools::b2DPolyPolygonFromXPolyPolygon2D(renderState.Clip) );
1261 if( aClipPoly.
count() )
1280 if( aClipRegion.
IsNull() )
1297 sal_uInt32 &rEmphasisMark)
1299 for(
const beans::PropertyValue& rPropVal : rExtraFontProperties)
1301 if (rPropVal.Name ==
"EmphasisMark")
1302 rPropVal.Value >>= rEmphasisMark;
constexpr tools::Long Y() const
constexpr tools::Long X() const
static vcl::Window * GetWindow(const css::uno::Reference< css::awt::XWindow > &rxWindow)
void append(const B2DPolygon &rPolygon, sal_uInt32 nCount=1)
void transform(const basegfx::B2DHomMatrix &rMatrix)
void transform(const basegfx::B2DHomMatrix &rMatrix)
void append(const basegfx::B2DPoint &rPoint, sal_uInt32 nCount)
B2IPoint getMinimum() const
B2I64Tuple getRange() const
void expand(const Tuple2D< TYPE > &rTuple)
void intersect(const Range2D &rRange)
void Intersect(const tools::Rectangle &rRegion)
static vcl::Region GetRegionFromPolyPolygon(const tools::PolyPolygon &rPolyPoly)
#define ENSURE_ARG_OR_THROW2(c, m, ifc, arg)
#define SAL_WARN_IF(condition, area, stream)
double getLength(const B2DPolygon &rCandidate)
B2DHomMatrix createTranslateB2DHomMatrix(double fTranslateX, double fTranslateY)
bool getType(BSTR name, Type &type)