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 #ifndef _CPPCANVAS_TRANSPARENCYGROUPACTION_HXX 25 #define _CPPCANVAS_TRANSPARENCYGROUPACTION_HXX 26 27 #include <cppcanvas/canvas.hxx> 28 #include <cppcanvas/renderer.hxx> 29 #include <action.hxx> 30 31 #include <memory> // auto_ptr 32 33 namespace basegfx { 34 class B2DPoint; 35 class B2DVector; 36 } 37 38 class GDIMetaFile; 39 class Gradient; 40 41 42 /* Definition of internal::TransparencyGroupActionFactory class */ 43 44 namespace cppcanvas 45 { 46 namespace internal 47 { 48 struct OutDevState; 49 50 typedef ::std::auto_ptr< GDIMetaFile > MtfAutoPtr; 51 typedef ::std::auto_ptr< Gradient > GradientAutoPtr; 52 53 /** Transparency group action. 54 55 This action groups a bunch of other actions, to be 56 rendered with the given transparency setting against the 57 background. 58 59 Creates encapsulated converters between GDIMetaFile and 60 XCanvas. The Canvas argument is deliberately placed at the 61 constructor, to force reconstruction of this object for a 62 new canvas. This considerably eases internal state 63 handling, since a lot of the internal state (e.g. fonts, 64 text layout) is Canvas-dependent. 65 */ 66 class TransparencyGroupActionFactory 67 { 68 public: 69 /** Create new transparency group action. 70 71 @param rGroupMtf 72 Metafile that groups all actions to be rendered 73 transparent 74 75 @param rParms 76 Render parameters 77 78 @param rDstPoint 79 Left, top edge of destination, in current state 80 coordinate system 81 82 @param rDstSize 83 Size of the transparency group object, in current 84 state coordinate system. 85 86 @param nAlpha 87 Alpha value, must be in the range [0,1] 88 */ 89 static ActionSharedPtr createTransparencyGroupAction( MtfAutoPtr& rGroupMtf, 90 const Renderer::Parameters& rParms, 91 const ::basegfx::B2DPoint& rDstPoint, 92 const ::basegfx::B2DVector& rDstSize, 93 double nAlpha, 94 const CanvasSharedPtr& rCanvas, 95 const OutDevState& rState ); 96 97 /** Create new transparency group action. 98 99 @param rGroupMtf 100 Metafile that groups all actions to be rendered 101 transparent. 102 103 @param rAlphaGradient 104 VCL gradient, to be rendered into the action's alpha 105 channel. 106 107 @param rParms 108 Render parameters 109 110 @param rDstPoint 111 Left, top edge of destination, in current state 112 coordinate system 113 114 @param rDstSize 115 Size of the transparency group object, in current 116 state coordinate system. 117 */ 118 static ActionSharedPtr createTransparencyGroupAction( MtfAutoPtr& rGroupMtf, 119 GradientAutoPtr& rAlphaGradient, 120 const Renderer::Parameters& rParms, 121 const ::basegfx::B2DPoint& rDstPoint, 122 const ::basegfx::B2DVector& rDstSize, 123 const CanvasSharedPtr& rCanvas, 124 const OutDevState& rState ); 125 126 private: 127 // static factory, disable big four 128 TransparencyGroupActionFactory(); 129 ~TransparencyGroupActionFactory(); 130 TransparencyGroupActionFactory(const TransparencyGroupActionFactory&); 131 TransparencyGroupActionFactory& operator=( const TransparencyGroupActionFactory& ); 132 }; 133 } 134 } 135 136 #endif /*_CPPCANVAS_TRANSPARENCYGROUPACTION_HXX */ 137