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