polypolygonprimitive2d.cxx (464702f4) | polypolygonprimitive2d.cxx (035a2f44) |
---|---|
1/************************************************************** 2 * 3 * Licensed to the Apache Software Foundation (ASF) under one 4 * or more contributor license agreements. See the NOTICE file 5 * distributed with this work for additional information 6 * regarding copyright ownership. The ASF licenses this file 7 * to you under the Apache License, Version 2.0 (the 8 * "License"); you may not use this file except in compliance --- 17 unchanged lines hidden (view full) --- 26 27#include <drawinglayer/primitive2d/polypolygonprimitive2d.hxx> 28#include <basegfx/polygon/b2dpolypolygontools.hxx> 29#include <basegfx/tools/canvastools.hxx> 30#include <drawinglayer/primitive2d/fillgradientprimitive2d.hxx> 31#include <drawinglayer/primitive2d/maskprimitive2d.hxx> 32#include <drawinglayer/primitive2d/fillhatchprimitive2d.hxx> 33#include <basegfx/matrix/b2dhommatrix.hxx> | 1/************************************************************** 2 * 3 * Licensed to the Apache Software Foundation (ASF) under one 4 * or more contributor license agreements. See the NOTICE file 5 * distributed with this work for additional information 6 * regarding copyright ownership. The ASF licenses this file 7 * to you under the Apache License, Version 2.0 (the 8 * "License"); you may not use this file except in compliance --- 17 unchanged lines hidden (view full) --- 26 27#include <drawinglayer/primitive2d/polypolygonprimitive2d.hxx> 28#include <basegfx/polygon/b2dpolypolygontools.hxx> 29#include <basegfx/tools/canvastools.hxx> 30#include <drawinglayer/primitive2d/fillgradientprimitive2d.hxx> 31#include <drawinglayer/primitive2d/maskprimitive2d.hxx> 32#include <drawinglayer/primitive2d/fillhatchprimitive2d.hxx> 33#include <basegfx/matrix/b2dhommatrix.hxx> |
34#include <drawinglayer/primitive2d/fillbitmapprimitive2d.hxx> | 34#include <drawinglayer/primitive2d/fillgraphicprimitive2d.hxx> |
35#include <drawinglayer/primitive2d/polygonprimitive2d.hxx> 36#include <drawinglayer/primitive2d/drawinglayer_primitivetypes2d.hxx> | 35#include <drawinglayer/primitive2d/polygonprimitive2d.hxx> 36#include <drawinglayer/primitive2d/drawinglayer_primitivetypes2d.hxx> |
37#include <basegfx/matrix/b2dhommatrixtools.hxx> 38#include <vcl/graph.hxx> |
|
37 38////////////////////////////////////////////////////////////////////////////// 39 40using namespace com::sun::star; 41 42////////////////////////////////////////////////////////////////////////////// 43 44namespace drawinglayer --- 460 unchanged lines hidden (view full) --- 505} // end of namespace drawinglayer 506 507////////////////////////////////////////////////////////////////////////////// 508 509namespace drawinglayer 510{ 511 namespace primitive2d 512 { | 39 40////////////////////////////////////////////////////////////////////////////// 41 42using namespace com::sun::star; 43 44////////////////////////////////////////////////////////////////////////////// 45 46namespace drawinglayer --- 460 unchanged lines hidden (view full) --- 507} // end of namespace drawinglayer 508 509////////////////////////////////////////////////////////////////////////////// 510 511namespace drawinglayer 512{ 513 namespace primitive2d 514 { |
513 Primitive2DSequence PolyPolygonBitmapPrimitive2D::create2DDecomposition(const geometry::ViewInformation2D& /*rViewInformation*/) const | 515 Primitive2DSequence PolyPolygonGraphicPrimitive2D::create2DDecomposition(const geometry::ViewInformation2D& /*rViewInformation*/) const |
514 { | 516 { |
515 if(!getFillBitmap().isDefault()) | 517 if(!getFillGraphic().isDefault()) |
516 { | 518 { |
517 // create SubSequence with FillBitmapPrimitive2D 518 const basegfx::B2DRange aPolyPolygonRange(getB2DPolyPolygon().getB2DRange()); 519 basegfx::B2DHomMatrix aNewObjectTransform; 520 aNewObjectTransform.set(0, 0, aPolyPolygonRange.getWidth()); 521 aNewObjectTransform.set(1, 1, aPolyPolygonRange.getHeight()); 522 aNewObjectTransform.set(0, 2, aPolyPolygonRange.getMinX()); 523 aNewObjectTransform.set(1, 2, aPolyPolygonRange.getMinY()); 524 FillBitmapPrimitive2D* pNewBitmap = new FillBitmapPrimitive2D(aNewObjectTransform, getFillBitmap()); 525 const Primitive2DReference xSubRef(pNewBitmap); 526 const Primitive2DSequence aSubSequence(&xSubRef, 1L); | 519 const Graphic& rGraphic = getFillGraphic().getGraphic(); 520 const GraphicType aType(rGraphic.GetType()); |
527 | 521 |
528 // create mask primitive 529 MaskPrimitive2D* pNewMask = new MaskPrimitive2D(getB2DPolyPolygon(), aSubSequence); 530 const Primitive2DReference xRef(pNewMask); 531 532 return Primitive2DSequence(&xRef, 1); | 522 // is there a bitmap or a metafile (do we have content)? 523 if(GRAPHIC_BITMAP == aType || GRAPHIC_GDIMETAFILE == aType) 524 { 525 const Size aPrefSize(rGraphic.GetPrefSize()); 526 527 // does content have a size? 528 if(aPrefSize.Width() && aPrefSize.Height()) 529 { 530 // create SubSequence with FillGraphicPrimitive2D based on polygon range 531 const basegfx::B2DRange aPolyPolygonRange(getB2DPolyPolygon().getB2DRange()); 532 const basegfx::B2DHomMatrix aNewObjectTransform( 533 basegfx::tools::createScaleTranslateB2DHomMatrix( 534 aPolyPolygonRange.getRange(), 535 aPolyPolygonRange.getMinimum())); 536 const Primitive2DReference xSubRef( 537 new FillGraphicPrimitive2D( 538 aNewObjectTransform, 539 getFillGraphic())); 540 541 // embed to mask primitive 542 const Primitive2DReference xRef( 543 new MaskPrimitive2D( 544 getB2DPolyPolygon(), 545 Primitive2DSequence(&xSubRef, 1))); 546 547 return Primitive2DSequence(&xRef, 1); 548 } 549 } |
533 } | 550 } |
534 else 535 { 536 return Primitive2DSequence(); 537 } | 551 552 return Primitive2DSequence(); |
538 } 539 | 553 } 554 |
540 PolyPolygonBitmapPrimitive2D::PolyPolygonBitmapPrimitive2D( | 555 PolyPolygonGraphicPrimitive2D::PolyPolygonGraphicPrimitive2D( |
541 const basegfx::B2DPolyPolygon& rPolyPolygon, | 556 const basegfx::B2DPolyPolygon& rPolyPolygon, |
542 const attribute::FillBitmapAttribute& rFillBitmap) | 557 const attribute::FillGraphicAttribute& rFillGraphic) |
543 : BufferedDecompositionPrimitive2D(), 544 maPolyPolygon(rPolyPolygon), | 558 : BufferedDecompositionPrimitive2D(), 559 maPolyPolygon(rPolyPolygon), |
545 maFillBitmap(rFillBitmap) | 560 maFillGraphic(rFillGraphic) |
546 { 547 } 548 | 561 { 562 } 563 |
549 bool PolyPolygonBitmapPrimitive2D::operator==(const BasePrimitive2D& rPrimitive) const | 564 bool PolyPolygonGraphicPrimitive2D::operator==(const BasePrimitive2D& rPrimitive) const |
550 { 551 if(BufferedDecompositionPrimitive2D::operator==(rPrimitive)) 552 { | 565 { 566 if(BufferedDecompositionPrimitive2D::operator==(rPrimitive)) 567 { |
553 const PolyPolygonBitmapPrimitive2D& rCompare = (PolyPolygonBitmapPrimitive2D&)rPrimitive; | 568 const PolyPolygonGraphicPrimitive2D& rCompare = (PolyPolygonGraphicPrimitive2D&)rPrimitive; |
554 | 569 |
555 return (getFillBitmap() == rCompare.getFillBitmap()); | 570 return (getFillGraphic() == rCompare.getFillGraphic()); |
556 } 557 558 return false; 559 } 560 561 // provide unique ID | 571 } 572 573 return false; 574 } 575 576 // provide unique ID |
562 ImplPrimitrive2DIDBlock(PolyPolygonBitmapPrimitive2D, PRIMITIVE2D_ID_POLYPOLYGONBITMAPPRIMITIVE2D) | 577 ImplPrimitrive2DIDBlock(PolyPolygonGraphicPrimitive2D, PRIMITIVE2D_ID_POLYPOLYGONGRAPHICPRIMITIVE2D) |
563 564 } // end of namespace primitive2d 565} // end of namespace drawinglayer 566 567////////////////////////////////////////////////////////////////////////////// 568// eof | 578 579 } // end of namespace primitive2d 580} // end of namespace drawinglayer 581 582////////////////////////////////////////////////////////////////////////////// 583// eof |