1*2d788491SAndrew Rist /************************************************************** 2cdf0e10cSrcweir * 3*2d788491SAndrew Rist * Licensed to the Apache Software Foundation (ASF) under one 4*2d788491SAndrew Rist * or more contributor license agreements. See the NOTICE file 5*2d788491SAndrew Rist * distributed with this work for additional information 6*2d788491SAndrew Rist * regarding copyright ownership. The ASF licenses this file 7*2d788491SAndrew Rist * to you under the Apache License, Version 2.0 (the 8*2d788491SAndrew Rist * "License"); you may not use this file except in compliance 9*2d788491SAndrew Rist * with the License. You may obtain a copy of the License at 10*2d788491SAndrew Rist * 11*2d788491SAndrew Rist * http://www.apache.org/licenses/LICENSE-2.0 12*2d788491SAndrew Rist * 13*2d788491SAndrew Rist * Unless required by applicable law or agreed to in writing, 14*2d788491SAndrew Rist * software distributed under the License is distributed on an 15*2d788491SAndrew Rist * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 16*2d788491SAndrew Rist * KIND, either express or implied. See the License for the 17*2d788491SAndrew Rist * specific language governing permissions and limitations 18*2d788491SAndrew Rist * under the License. 19*2d788491SAndrew Rist * 20*2d788491SAndrew Rist *************************************************************/ 21*2d788491SAndrew Rist 22*2d788491SAndrew Rist 23cdf0e10cSrcweir 24cdf0e10cSrcweir #ifndef _CPPCANVAS_TRANSPARENCYGROUPACTION_HXX 25cdf0e10cSrcweir #define _CPPCANVAS_TRANSPARENCYGROUPACTION_HXX 26cdf0e10cSrcweir 27cdf0e10cSrcweir #include <cppcanvas/canvas.hxx> 28cdf0e10cSrcweir #include <cppcanvas/renderer.hxx> 29cdf0e10cSrcweir #include <action.hxx> 30cdf0e10cSrcweir 31cdf0e10cSrcweir #include <memory> // auto_ptr 32cdf0e10cSrcweir 33cdf0e10cSrcweir namespace basegfx { 34cdf0e10cSrcweir class B2DPoint; 35cdf0e10cSrcweir class B2DVector; 36cdf0e10cSrcweir } 37cdf0e10cSrcweir 38cdf0e10cSrcweir class GDIMetaFile; 39cdf0e10cSrcweir class Gradient; 40cdf0e10cSrcweir 41cdf0e10cSrcweir 42cdf0e10cSrcweir /* Definition of internal::TransparencyGroupActionFactory class */ 43cdf0e10cSrcweir 44cdf0e10cSrcweir namespace cppcanvas 45cdf0e10cSrcweir { 46cdf0e10cSrcweir namespace internal 47cdf0e10cSrcweir { 48cdf0e10cSrcweir struct OutDevState; 49cdf0e10cSrcweir 50cdf0e10cSrcweir typedef ::std::auto_ptr< GDIMetaFile > MtfAutoPtr; 51cdf0e10cSrcweir typedef ::std::auto_ptr< Gradient > GradientAutoPtr; 52cdf0e10cSrcweir 53cdf0e10cSrcweir /** Transparency group action. 54cdf0e10cSrcweir 55cdf0e10cSrcweir This action groups a bunch of other actions, to be 56cdf0e10cSrcweir rendered with the given transparency setting against the 57cdf0e10cSrcweir background. 58cdf0e10cSrcweir 59cdf0e10cSrcweir Creates encapsulated converters between GDIMetaFile and 60cdf0e10cSrcweir XCanvas. The Canvas argument is deliberately placed at the 61cdf0e10cSrcweir constructor, to force reconstruction of this object for a 62cdf0e10cSrcweir new canvas. This considerably eases internal state 63cdf0e10cSrcweir handling, since a lot of the internal state (e.g. fonts, 64cdf0e10cSrcweir text layout) is Canvas-dependent. 65cdf0e10cSrcweir */ 66cdf0e10cSrcweir class TransparencyGroupActionFactory 67cdf0e10cSrcweir { 68cdf0e10cSrcweir public: 69cdf0e10cSrcweir /** Create new transparency group action. 70cdf0e10cSrcweir 71cdf0e10cSrcweir @param rGroupMtf 72cdf0e10cSrcweir Metafile that groups all actions to be rendered 73cdf0e10cSrcweir transparent 74cdf0e10cSrcweir 75cdf0e10cSrcweir @param rParms 76cdf0e10cSrcweir Render parameters 77cdf0e10cSrcweir 78cdf0e10cSrcweir @param rDstPoint 79cdf0e10cSrcweir Left, top edge of destination, in current state 80cdf0e10cSrcweir coordinate system 81cdf0e10cSrcweir 82cdf0e10cSrcweir @param rDstSize 83cdf0e10cSrcweir Size of the transparency group object, in current 84cdf0e10cSrcweir state coordinate system. 85cdf0e10cSrcweir 86cdf0e10cSrcweir @param nAlpha 87cdf0e10cSrcweir Alpha value, must be in the range [0,1] 88cdf0e10cSrcweir */ 89cdf0e10cSrcweir static ActionSharedPtr createTransparencyGroupAction( MtfAutoPtr& rGroupMtf, 90cdf0e10cSrcweir const Renderer::Parameters& rParms, 91cdf0e10cSrcweir const ::basegfx::B2DPoint& rDstPoint, 92cdf0e10cSrcweir const ::basegfx::B2DVector& rDstSize, 93cdf0e10cSrcweir double nAlpha, 94cdf0e10cSrcweir const CanvasSharedPtr& rCanvas, 95cdf0e10cSrcweir const OutDevState& rState ); 96cdf0e10cSrcweir 97cdf0e10cSrcweir /** Create new transparency group action. 98cdf0e10cSrcweir 99cdf0e10cSrcweir @param rGroupMtf 100cdf0e10cSrcweir Metafile that groups all actions to be rendered 101cdf0e10cSrcweir transparent. 102cdf0e10cSrcweir 103cdf0e10cSrcweir @param rAlphaGradient 104cdf0e10cSrcweir VCL gradient, to be rendered into the action's alpha 105cdf0e10cSrcweir channel. 106cdf0e10cSrcweir 107cdf0e10cSrcweir @param rParms 108cdf0e10cSrcweir Render parameters 109cdf0e10cSrcweir 110cdf0e10cSrcweir @param rDstPoint 111cdf0e10cSrcweir Left, top edge of destination, in current state 112cdf0e10cSrcweir coordinate system 113cdf0e10cSrcweir 114cdf0e10cSrcweir @param rDstSize 115cdf0e10cSrcweir Size of the transparency group object, in current 116cdf0e10cSrcweir state coordinate system. 117cdf0e10cSrcweir */ 118cdf0e10cSrcweir static ActionSharedPtr createTransparencyGroupAction( MtfAutoPtr& rGroupMtf, 119cdf0e10cSrcweir GradientAutoPtr& rAlphaGradient, 120cdf0e10cSrcweir const Renderer::Parameters& rParms, 121cdf0e10cSrcweir const ::basegfx::B2DPoint& rDstPoint, 122cdf0e10cSrcweir const ::basegfx::B2DVector& rDstSize, 123cdf0e10cSrcweir const CanvasSharedPtr& rCanvas, 124cdf0e10cSrcweir const OutDevState& rState ); 125cdf0e10cSrcweir 126cdf0e10cSrcweir private: 127cdf0e10cSrcweir // static factory, disable big four 128cdf0e10cSrcweir TransparencyGroupActionFactory(); 129cdf0e10cSrcweir ~TransparencyGroupActionFactory(); 130cdf0e10cSrcweir TransparencyGroupActionFactory(const TransparencyGroupActionFactory&); 131cdf0e10cSrcweir TransparencyGroupActionFactory& operator=( const TransparencyGroupActionFactory& ); 132cdf0e10cSrcweir }; 133cdf0e10cSrcweir } 134cdf0e10cSrcweir } 135cdf0e10cSrcweir 136cdf0e10cSrcweir #endif /*_CPPCANVAS_TRANSPARENCYGROUPACTION_HXX */ 137