ShadowTl.h

Go to the documentation of this file.
00001 // $Id: ShadowTl.h 751 2006-03-31 15:43:49Z alex $
00002 /* @@tag:xara-cn@@ DO NOT MODIFY THIS LINE
00003 ================================XARAHEADERSTART===========================
00004  
00005                Xara LX, a vector drawing and manipulation program.
00006                     Copyright (C) 1993-2006 Xara Group Ltd.
00007        Copyright on certain contributions may be held in joint with their
00008               respective authors. See AUTHORS file for details.
00009 
00010 LICENSE TO USE AND MODIFY SOFTWARE
00011 ----------------------------------
00012 
00013 This file is part of Xara LX.
00014 
00015 Xara LX is free software; you can redistribute it and/or modify it
00016 under the terms of the GNU General Public License version 2 as published
00017 by the Free Software Foundation.
00018 
00019 Xara LX and its component source files are distributed in the hope
00020 that it will be useful, but WITHOUT ANY WARRANTY; without even the
00021 implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
00022 See the GNU General Public License for more details.
00023 
00024 You should have received a copy of the GNU General Public License along
00025 with Xara LX (see the file GPL in the root directory of the
00026 distribution); if not, write to the Free Software Foundation, Inc., 51
00027 Franklin St, Fifth Floor, Boston, MA  02110-1301 USA
00028 
00029 
00030 ADDITIONAL RIGHTS
00031 -----------------
00032 
00033 Conditional upon your continuing compliance with the GNU General Public
00034 License described above, Xara Group Ltd grants to you certain additional
00035 rights. 
00036 
00037 The additional rights are to use, modify, and distribute the software
00038 together with the wxWidgets library, the wxXtra library, and the "CDraw"
00039 library and any other such library that any version of Xara LX relased
00040 by Xara Group Ltd requires in order to compile and execute, including
00041 the static linking of that library to XaraLX. In the case of the
00042 "CDraw" library, you may satisfy obligation under the GNU General Public
00043 License to provide source code by providing a binary copy of the library
00044 concerned and a copy of the license accompanying it.
00045 
00046 Nothing in this section restricts any of the rights you have under
00047 the GNU General Public License.
00048 
00049 
00050 SCOPE OF LICENSE
00051 ----------------
00052 
00053 This license applies to this program (XaraLX) and its constituent source
00054 files only, and does not necessarily apply to other Xara products which may
00055 in part share the same code base, and are subject to their own licensing
00056 terms.
00057 
00058 This license does not apply to files in the wxXtra directory, which
00059 are built into a separate library, and are subject to the wxWindows
00060 license contained within that directory in the file "WXXTRA-LICENSE".
00061 
00062 This license does not apply to the binary libraries (if any) within
00063 the "libs" directory, which are subject to a separate license contained
00064 within that directory in the file "LIBS-LICENSE".
00065 
00066 
00067 ARRANGEMENTS FOR CONTRIBUTION OF MODIFICATIONS
00068 ----------------------------------------------
00069 
00070 Subject to the terms of the GNU Public License (see above), you are
00071 free to do whatever you like with your modifications. However, you may
00072 (at your option) wish contribute them to Xara's source tree. You can
00073 find details of how to do this at:
00074   http://www.xaraxtreme.org/developers/
00075 
00076 Prior to contributing your modifications, you will need to complete our
00077 contributor agreement. This can be found at:
00078   http://www.xaraxtreme.org/developers/contribute/
00079 
00080 Please note that Xara will not accept modifications which modify any of
00081 the text between the start and end of this header (marked
00082 XARAHEADERSTART and XARAHEADEREND).
00083 
00084 
00085 MARKS
00086 -----
00087 
00088 Xara, Xara LX, Xara X, Xara X/Xtreme, Xara Xtreme, the Xtreme and Xara
00089 designs are registered or unregistered trademarks, design-marks, and/or
00090 service marks of Xara Group Ltd. All rights in these marks are reserved.
00091 
00092 
00093       Xara Group Ltd, Gaddesden Place, Hemel Hempstead, HP2 6EX, UK.
00094                         http://www.xara.com/
00095 
00096 =================================XARAHEADEREND============================
00097  */
00098 //
00099 
00100 #ifndef  Include_CShadowerFlat
00101 #define  Include_CShadowerFlat
00102 
00103 struct IComShadowerFlat;   // defined in the .cpp file
00104 
00105 typedef float           AFloatPt01;
00106 typedef INT32           APixels;
00107 typedef INT32*          ACoordPixels;    // array of 2 elements please
00108 typedef INT32           ADegrees;
00109 typedef UINT32* AAlphaChannel;   // AlphaRGB or AlphaBGR array (alpha in the high byte)
00110 
00111 /*******************************************************************************
00112 
00113 >   class CShadowerFlat
00114 
00115     Updated by: Mark Howitt 3/8/98
00116 
00117     Author:     Harrison_Ainsworth (Xara Group Ltd) <camelotdev@xara.com>
00118     Created:    21/12/97
00119     Purpose:    'Wrapper' for the COM interface CShadowerFlat, which is itself
00120                 a 'Facade' for the flat shadow generation system.
00121                 Simply delegates to its owned COM component.
00122     See also:   CShadowerFlat ( in CShadowerFlat.cpp )
00123     Errors:     (constructor throws if ::CoCreateInstance() fails) not currently.
00124 
00125     Instructions:   Construction:
00126                         Construct, then call _init_ (if possible, rewrite this wrapper
00127                         class, moving the _Init_() into the costructor).
00128                     Setting/getting choices:
00129                         Pass null pointers for the parameters you don't want to change/read.
00130                         The baseline value means:
00131                             position of baseline / height of image
00132                         where:
00133                             position of baseline  =  no. of pixels from top of image
00134                     Switches:
00135                         You might want to change the default init settings in _Init_(),
00136                         The internal defaults are FALSE, FALSE - alpha channel, right way up
00137                         (top left pixel is lowest address)
00138                     Make shadow functions:
00139                         Positions have their origin at the top left of the image.
00140                         Call CalcShadowBound() to get the size and pos of the shadow,
00141                         then allocate your shadow pixmap, then call DrawShadow() to draw the
00142                         shadow.
00143                         The shadow has zeros in the color channels.
00144                     InverseShadowBoundCalc()
00145                         Purpose:    To calculate/estimate the bound of an unshadowed pixmap,
00146                                     given the bound of a (hypothetical) shadowed pixmap,
00147                                     - the inverse of CalcShadowBound().
00148                         Inputs:     The width, height of a hypothetical pixmap with shadow
00149                                     already applied.
00150                         Outputs:    The width, height and position of the unshadowed pixmap,
00151                                     that would, after having it's shadow added, take up the
00152                                     above input bound.
00153                     CalcShadowBound()
00154                         Purpose:    Calculate the rectangular bound of the shadow that
00155                                     would be produced by DrawShadow() given a particular
00156                                     transparency/alpha map.
00157                                     Call this, use the results to allocate a shadow map,
00158                                     then call DrawShadow().
00159                         Inputs:     A transparency/alpha map, it's width, height and position
00160                         Outputs:    The width, height and position of the shadow
00161                     DrawShadow()
00162                         Purpose:    Draw the shadow cast by a particular transparency/alpha map
00163                         Inputs:     A shadow map, it's width, height and position,
00164                                     A transparency/alpha map, it's width, height and position
00165                         Outputs:    The shadow drawn onto the shadow map
00166 
00167 *******************************************************************************/
00168 
00169 class CShadowerFlat
00170 {
00171 public:
00172     // Standard object management
00173     CShadowerFlat();
00174     virtual ~CShadowerFlat();
00175 
00176     // (Should be in constructor)
00177     virtual HRESULT _Init_();
00178 
00179     // Set choices
00180     virtual VOID SetChoicesToDefault();
00181     virtual VOID SetChoices( const BOOL* MakeWallShadow, const AFloatPt01* Darkness01,
00182                              const APixels* Blurriness, const ACoordPixels  XYPosition,
00183                              const ADegrees* Tilt, const AFloatPt01* YScale01 );
00184 
00185     virtual VOID SetBaseline( const AFloatPt01* Baseline );
00186 
00187     // Get choices
00188     virtual VOID GetChoices( BOOL* MakeWallShadow, AFloatPt01* Darkness01, APixels* Blurriness,
00189                              ACoordPixels  XYPosition, ADegrees* Tilt, AFloatPt01* YScale01 ) const;
00190 
00191     virtual VOID GetBaseline( AFloatPt01* Baseline ) const;
00192 
00193     // Choices range queries
00194     virtual VOID GetDarknessRange( AFloatPt01& Min, AFloatPt01& Max ) const;
00195     virtual VOID GetBlurrinessRange( APixels& Min, APixels& Max ) const;
00196     virtual VOID GetPositionRange( ACoordPixels Min, ACoordPixels Max ) const;
00197 
00198     virtual VOID GetProjectionRange( ADegrees& MinTilt, ADegrees& MaxTilt,
00199                                      AFloatPt01& MinYScale, AFloatPt01& MaxYScale ) const;
00200     // Alpha channel type switches
00201     virtual HRESULT SwitchToTransparencyInsteadOfAlpha( BOOL YesOrNo );
00202     virtual HRESULT SwitchToUpsideDownPixelAddressing( BOOL YesOrNo );
00203 
00204     // Make shadow
00205     virtual HRESULT InverseShadowBoundCalc( ACoordPixels UnshadowedWidHei, ACoordPixels UnshadowedPos,
00206                                             const ACoordPixels& ShadowedWidHei, const AFloatPt01* Baseline ) const;
00207     
00208     virtual HRESULT CalcShadowBound( ACoordPixels ShadowWidHei, ACoordPixels ShadowPos, const AAlphaChannel& TransparencyMap,
00209                                      const ACoordPixels& tWidHei, const ACoordPixels& tPos ) const;
00210     
00211     virtual HRESULT DrawShadow( const AAlphaChannel& ShadowMapOut, const ACoordPixels& sWidHei,
00212                                 const ACoordPixels& sPos, const AAlphaChannel& TransparencyMapIn,
00213                                 const ACoordPixels& tWidHei, const ACoordPixels& tPos ) const;
00214 
00215 protected:
00216 
00217 private:
00218     // ptr to the actual COM component object
00219     IComShadowerFlat* pShadower_m;
00220 
00221     // COM componenent identifiers
00222     static const GUID IID_IComShadowerFlat;
00223     static const GUID CLSID_CComShadowerFlat;
00224 
00225     // prohibit copying
00226     CShadowerFlat( const CShadowerFlat& );
00227     CShadowerFlat& operator= ( const CShadowerFlat& );
00228 };
00229 
00230 /**************************************************************************************
00231 
00232 >   class CCWobJob : public CC_CLASS_MEMDUMP
00233 
00234     Author:
00235     Created:
00236     Purpose:
00237 
00238 **************************************************************************************/
00239 
00240 class CCWobJob : public CC_CLASS_MEMDUMP
00241 {
00242     // Declare the class for memory tracking
00243     CC_DECLARE_MEMDUMP(CCWobJob);
00244 
00245 };
00246 
00247 #endif  //Include_CShadowerFlat

Generated on Sat Nov 10 03:47:56 2007 for Camelot by  doxygen 1.4.4