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 9 * with the License. You may obtain a copy of the License at 10 * 11 * http://www.apache.org/licenses/LICENSE-2.0 12 * 13 * Unless required by applicable law or agreed to in writing, 14 * software distributed under the License is distributed on an 15 * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 16 * KIND, either express or implied. See the License for the 17 * specific language governing permissions and limitations 18 * under the License. 19 * 20 *************************************************************/ 21 22 23 24 // MARKER(update_precomp.py): autogen include statement, do not remove 25 #include "precompiled_svx.hxx" 26 #include <drawinglayer/primitive2d/unifiedtransparenceprimitive2d.hxx> 27 #include <svx/sdr/overlay/overlaybitmapex.hxx> 28 #include <vcl/salbtype.hxx> 29 #include <vcl/outdev.hxx> 30 #include <basegfx/matrix/b2dhommatrix.hxx> 31 #include <svx/sdr/overlay/overlaytools.hxx> 32 33 ////////////////////////////////////////////////////////////////////////////// 34 35 namespace sdr 36 { 37 namespace overlay 38 { 39 drawinglayer::primitive2d::Primitive2DSequence OverlayBitmapEx::createOverlayObjectPrimitive2DSequence() 40 { 41 drawinglayer::primitive2d::Primitive2DReference aReference( 42 new drawinglayer::primitive2d::OverlayBitmapExPrimitive( 43 getBitmapEx(), 44 getBasePosition(), 45 getCenterX(), 46 getCenterY())); 47 48 if(basegfx::fTools::more(mfAlpha, 0.0)) 49 { 50 const drawinglayer::primitive2d::Primitive2DSequence aNewTransPrimitiveVector(&aReference, 1L); 51 aReference = drawinglayer::primitive2d::Primitive2DReference( 52 new drawinglayer::primitive2d::UnifiedTransparencePrimitive2D(aNewTransPrimitiveVector, mfAlpha)); 53 } 54 55 return drawinglayer::primitive2d::Primitive2DSequence(&aReference, 1); 56 } 57 58 OverlayBitmapEx::OverlayBitmapEx( 59 const basegfx::B2DPoint& rBasePos, 60 const BitmapEx& rBitmapEx, 61 sal_uInt16 nCenX, sal_uInt16 nCenY, double fAlpha) 62 : OverlayObjectWithBasePosition(rBasePos, Color(COL_WHITE)), 63 maBitmapEx(rBitmapEx), 64 mnCenterX(nCenX), 65 mnCenterY(nCenY), 66 mfAlpha(fAlpha) 67 { 68 } 69 70 OverlayBitmapEx::~OverlayBitmapEx() 71 { 72 } 73 74 void OverlayBitmapEx::setBitmapEx(const BitmapEx& rNew) 75 { 76 if(rNew != maBitmapEx) 77 { 78 // remember new Bitmap 79 maBitmapEx = rNew; 80 81 // register change (after change) 82 objectChange(); 83 } 84 } 85 86 void OverlayBitmapEx::setCenterXY(sal_uInt16 nNewX, sal_uInt16 nNewY) 87 { 88 if(nNewX != mnCenterX || nNewY != mnCenterY) 89 { 90 // remember new values 91 if(nNewX != mnCenterX) 92 { 93 mnCenterX = nNewX; 94 } 95 96 if(nNewY != mnCenterY) 97 { 98 mnCenterY = nNewY; 99 } 100 101 // register change (after change) 102 objectChange(); 103 } 104 } 105 } // end of namespace overlay 106 } // end of namespace sdr 107 108 ////////////////////////////////////////////////////////////////////////////// 109 // eof 110