// -------------------------------------------------------------------------- // ========================================================================== // // File: TDDBltFX.CPP // Created: 12th February 2009 // Author: BCB_Code_Generator v2.10, // Darren John Dwyer // ( // data entry, // source code, // documentation, // help files, // project files, // tutorials, // demos, // website // ) // // Hugh Dunbar Edwards // ( // data entry creation, // documentation creation, // icon creation // ) // // Description: This file contains the code for the TDDBltFX Component // // "TDx_Library v1.90" // "TDx_Draw_Library v1.90" // // (c) 2009 Darren John Dwyer, Australia. // All Rights Reserved. // // Refer to the 'License.Txt' file for licencing & copyright information. // ========================================================================== // -------------------------------------------------------------------------- // #includes ... // -------------------------------------------------------------------------- #include #pragma hdrstop // -------------------------------------------------------------------------- #include "TDDBltFX.H" // -------------------------------------------------------------------------- #pragma link "TDx_Library_Defns" #pragma link "TDx_Library_Functions" #pragma link "TDx_Draw_Library_Defns" #pragma link "TDx_Draw_Library_Functions" // -------------------------------------------------------------------------- // Object Registration... // -------------------------------------------------------------------------- #if (__BORLANDC__ >= 0x0530) // BCB Version 3+ #pragma package(smart_init) #endif // -------------------------------------------------------------------------- static inline void ValidCtrCheck(TDDBltFX*) { new TDDBltFX(NULL); } // -------------------------------------------------------------------------- namespace Tddbltfx { #if (__BORLANDC__ >= 0x0530) // BCB Version 3+ void __fastcall PACKAGE Register() #else void __fastcall Register() #endif { TComponentClass classes[1] = {__classid(TDDBltFX)}; RegisterComponents("TDx_Draw", classes, 0); } } // -------------------------------------------------------------------------- // Constructor: TDDBltFX::TDDBltFX() // Description: The default constructor for the TDDBltFX (Wrapper) object. // -------------------------------------------------------------------------- __fastcall TDDBltFX::TDDBltFX(TComponent* Owner) : TComponent(Owner) { Clear(); fFX_Strings=NULL; } // -------------------------------------------------------------------------- // Destructor: TDDBltFX::~TDDBltFX() // Description: The destructor for the TDDBltFX(Wrapper) object. // -------------------------------------------------------------------------- __fastcall TDDBltFX::~TDDBltFX() { if (fFX_Strings!=NULL) delete fFX_Strings; } // -------------------------------------------------------------------------- // Property: AlphaDest // Description: The AlphaDest property references the surface used as the // destination alpha channel when DDBLT_ALPHADESTSURFACEOVERRIDE // is set in the Flags parameter of TDx_DrawSurface::Blt(). // The DDBLT_ALPHADESTSURFACEOVERRIDE flag is not currently // supported. // -------------------------------------------------------------------------- TDx_DrawSurface* __fastcall TDDBltFX::FGetAlphaDest() { if (ComponentState.Contains(csDesigning) && (fAlphaDest!=NULL) && (Owner!=NULL)) { bool component_exists = false; for (int i=0;iComponentCount;i++) if (Owner->Components[i]==fAlphaDest) { component_exists = true; break; } if (!component_exists) fAlphaDest=NULL; } return fAlphaDest; } // -------------------------------------------------------------------------- void __fastcall TDDBltFX::FSetAlphaDest( TDx_DrawSurface* pAlphaDest ) { if (fAlphaDest!=NULL) { fDDBLTFX.lpDDSAlphaDest = (LPDIRECTDRAWSURFACE) fAlphaDest->Internal_LPDIRECTDRAWSURFACE7; } } // -------------------------------------------------------------------------- // Property: AlphaDestConst // Description: The AlphaDestConst property defines the constant alpha value // used as the destination alpha channel when // DDBLT_ALPHADESTCONSTOVERRIDE is set in the Flags parameter of // TDx_DrawSurface::Blt(). // The DDBLT_ALPHADESTCONSTOVERRIDE flag is not currently // supported. // -------------------------------------------------------------------------- dword __fastcall TDDBltFX::FGetAlphaDestConst() { return fDDBLTFX.dwAlphaDestConst; } // -------------------------------------------------------------------------- void __fastcall TDDBltFX::FSetAlphaDestConst( dword pAlphaDestConst ) { fDDBLTFX.dwAlphaDestConst = pAlphaDestConst; } // -------------------------------------------------------------------------- // Property: AlphaDestConstBitDepth // Description: The AlphaDestConstBitDepth property defines the bit depth of // the alpha constant contained in TDDBltFX::AlphaDestConst. // -------------------------------------------------------------------------- dword __fastcall TDDBltFX::FGetAlphaDestConstBitDepth() { return fDDBLTFX.dwAlphaDestConstBitDepth; } // -------------------------------------------------------------------------- void __fastcall TDDBltFX::FSetAlphaDestConstBitDepth( dword pAlphaDestConstBitDepth ) { fDDBLTFX.dwAlphaDestConstBitDepth = pAlphaDestConstBitDepth; } // -------------------------------------------------------------------------- // Property: AlphaEdgeBlend // Description: The AlphaEdgeBlend property defines the alpha constant used // for alpha edge blending when DDBLT_ALPHAEDGEBLEND is set in // the Flags parameter of TDx_DrawSurface::Blt(). // The DDBLT_ALPHAEDGEBLEND flag is not currently supported. // -------------------------------------------------------------------------- dword __fastcall TDDBltFX::FGetAlphaEdgeBlend() { return fDDBLTFX.dwAlphaEdgeBlend; } // -------------------------------------------------------------------------- void __fastcall TDDBltFX::FSetAlphaEdgeBlend( dword pAlphaEdgeBlend ) { fDDBLTFX.dwAlphaEdgeBlend = pAlphaEdgeBlend; } // -------------------------------------------------------------------------- // Property: AlphaEdgeBlendBitDepth // Description: The AlphaEdgeBlendBitDepth property defines the bit depth of // the alpha constant contained in TDDBltFX::AlphaEdgeBlend. // -------------------------------------------------------------------------- dword __fastcall TDDBltFX::FGetAlphaEdgeBlendBitDepth() { return fDDBLTFX.dwAlphaEdgeBlendBitDepth; } // -------------------------------------------------------------------------- void __fastcall TDDBltFX::FSetAlphaEdgeBlendBitDepth( dword pAlphaEdgeBlendBitDepth ) { fDDBLTFX.dwAlphaEdgeBlendBitDepth = pAlphaEdgeBlendBitDepth; } // -------------------------------------------------------------------------- // Property: AlphaSrc // Description: The AlphaSrc property references the surface used as the // source alpha channel when DDBLT_ALPHASRCSURFACEOVERRIDE is // set in the Flags parameter of TDx_DrawSurface::Blt(). // The DDBLT_ALPHASRCSURFACEOVERRIDE flag is not currently // supported. // -------------------------------------------------------------------------- TDx_DrawSurface* __fastcall TDDBltFX::FGetAlphaSrc() { if (ComponentState.Contains(csDesigning) && (fAlphaSrc!=NULL) && (Owner!=NULL)) { bool component_exists = false; for (int i=0;iComponentCount;i++) if (Owner->Components[i]==fAlphaSrc) { component_exists = true; break; } if (!component_exists) fAlphaSrc=NULL; } return fAlphaSrc; } // -------------------------------------------------------------------------- void __fastcall TDDBltFX::FSetAlphaSrc( TDx_DrawSurface* pAlphaSrc ) { if (fAlphaSrc!=NULL) { fDDBLTFX.lpDDSAlphaSrc = (LPDIRECTDRAWSURFACE) fAlphaSrc->Internal_LPDIRECTDRAWSURFACE7; } } // -------------------------------------------------------------------------- // Property: AlphaSrcConst // Description: The AlphaSrcConst property defines a constant alpha value // used as the source alpha channel when // DDBLT_ALPHASRCCONSTOVERRIDE is set in the Flags parameter of // TDx_DrawSurface::Blt(). // The DDBLT_ALPHASRCCONSTOVERRIDE flag is not currently // supported. // -------------------------------------------------------------------------- dword __fastcall TDDBltFX::FGetAlphaSrcConst() { return fDDBLTFX.dwAlphaSrcConst; } // -------------------------------------------------------------------------- void __fastcall TDDBltFX::FSetAlphaSrcConst( dword pAlphaSrcConst ) { fDDBLTFX.dwAlphaSrcConst = pAlphaSrcConst; } // -------------------------------------------------------------------------- // Property: AlphaSrcConstBitDepth // Description: The AlphaSrcConstBitDepth property defines the bit depth of // the alpha constant contained in TDDBltFX::AlphaSrcConst. // -------------------------------------------------------------------------- dword __fastcall TDDBltFX::FGetAlphaSrcConstBitDepth() { return fDDBLTFX.dwAlphaSrcConstBitDepth; } // -------------------------------------------------------------------------- void __fastcall TDDBltFX::FSetAlphaSrcConstBitDepth( dword pAlphaSrcConstBitDepth ) { fDDBLTFX.dwAlphaSrcConstBitDepth = pAlphaSrcConstBitDepth; } // -------------------------------------------------------------------------- // Property: DDRop // Description: The DDRop property defines a non standard raster operation // code. // TDx_Draw::GetCaps() can be used to retrieve the available // raster operations. // -------------------------------------------------------------------------- dword __fastcall TDDBltFX::FGetDDRop() { return fDDBLTFX.dwDDROP; } // -------------------------------------------------------------------------- void __fastcall TDDBltFX::FSetDDRop( dword pDDRop ) { fDDBLTFX.dwDDROP = pDDRop; } // -------------------------------------------------------------------------- // Property: DestColorkey // Description: The DestColorkey property references the color key used as // the destination color key when DDBLT_KEYDESTOVERRIDE is set // in the Flags parameter of TDx_DrawSurface::Blt(). // -------------------------------------------------------------------------- TDDColorKey* __fastcall TDDBltFX::FGetDestColorkey() { if (ComponentState.Contains(csDesigning) && (fDestColorkey!=NULL) && (Owner!=NULL)) { bool component_exists = false; for (int i=0;iComponentCount;i++) if (Owner->Components[i]==fDestColorkey) { component_exists = true; break; } if (!component_exists) fDestColorkey=NULL; } return fDestColorkey; } // -------------------------------------------------------------------------- void __fastcall TDDBltFX::FSetDestColorkey( TDDColorKey* pDestColorkey ) { fDestColorkey = pDestColorkey; } // -------------------------------------------------------------------------- // Property: ErrorValue // Description: The ErrorValue property contains the last error value // returned from a call to a TDDBltFX method or fget/fset. eg. // DD_OK or DDERR_SURFACELOST or TDX_ERROR // -------------------------------------------------------------------------- HRESULT __fastcall TDDBltFX::FGetErrorValue() { return fErrorValue; } // -------------------------------------------------------------------------- void __fastcall TDDBltFX::FSetErrorValue( HRESULT pErrorValue ) { fErrorValue = pErrorValue; } // -------------------------------------------------------------------------- // Property: FX // Description: The FX property defines flags that control or modify the type // of FX operations performed when blitting. // The described effect applies when the flag is set. // Flags: DDBLTFX_ARITHSTRETCHY - // Blitting is to be performed with a different Y dimension by // using arithmetic stretching. // DDBLTFX_MIRRORLEFTRIGHT - // Perform blitting while mirroring from left to right by // turning the surface on its Y axis. // DDBLTFX_MIRRORUPDOWN - // Perform blitting while mirroring from top to bottom by // turning the surface on its X axis. // DDBLTFX_NOTEARING - // Schedule blitting to synchronise with the vertical blank. // Blits are performed asynchronously by default. // Synchronous blitting can help avoid artifacts such as // tearing. // DDBLTFX_ROTATE180 - // Perform blitting while rotating the image 180 degrees // clockwise. // This will result in the blitted image being displayed // upside down. // DDBLTFX_ROTATE270 - // Perform blitting while rotating 270 degrees clockwise. // This will result in the blitted image being turned onto its // left hand side. // DDBLTFX_ROTATE90 - // Perform blitting while rotating 90 degrees clockwise. // This will result in the blitted image being turned onto its // right hand side. // DDBLTFX_ZBUFFERBASEDEST - // Perform z-buffer blitting by adding // TDDBltFX::ZBufferBaseDest to each of the source z-values // before comparison with the destination z-values. // DDBLTFX_ZBUFFERRANGE - // Perform z-buffer blitting, using only those pixels of the // source surface that have z-orders between the values of // TDDBltFX::ZBufferLow and TDDBltFX::ZBufferHigh. // -------------------------------------------------------------------------- dword __fastcall TDDBltFX::FGetFX() { return fDDBLTFX.dwDDFX; } // -------------------------------------------------------------------------- void __fastcall TDDBltFX::FSetFX( dword pFX ) { fDDBLTFX.dwDDFX = pFX; } // -------------------------------------------------------------------------- // Property: FillColor // Description: The FillColor property defines the color value used for // filling a surface when DDBLT_COLORFILL is set in the Flags // parameter of TDx_DrawSurface::Blt(). // This value may be a palette index or a pixel value of the // appropriate bit depth depending on the pixel format of the // destination surface. // -------------------------------------------------------------------------- dword __fastcall TDDBltFX::FGetFillColor() { return fDDBLTFX.dwFillColor; } // -------------------------------------------------------------------------- void __fastcall TDDBltFX::FSetFillColor( dword pFillColor ) { fDDBLTFX.dwFillColor = pFillColor; } // -------------------------------------------------------------------------- // Property: FillDepth // Description: The FillDepth property defines the z-order value specifying // the depth at which a color fill takes place on a z-buffered // blit. // -------------------------------------------------------------------------- dword __fastcall TDDBltFX::FGetFillDepth() { return fDDBLTFX.dwFillDepth; } // -------------------------------------------------------------------------- void __fastcall TDDBltFX::FSetFillDepth( dword pFillDepth ) { fDDBLTFX.dwFillDepth = pFillDepth; } // -------------------------------------------------------------------------- // Property: FillPixel // Description: The FillPixel property defines the pixel value used for RGBA // or RGBZ fills when DDBLT_COLORFILL is set in the Flags // parameter of TDx_DrawSurface::Blt(). // When using RGBZ fills this property should be used rather // than TDDBltFX::FillColor or TDDBltFX::FillDepth. // -------------------------------------------------------------------------- dword __fastcall TDDBltFX::FGetFillPixel() { return fDDBLTFX.dwFillPixel; } // -------------------------------------------------------------------------- void __fastcall TDDBltFX::FSetFillPixel( dword pFillPixel ) { fDDBLTFX.dwFillPixel = pFillPixel; } // -------------------------------------------------------------------------- // Property: Pattern // Description: The Pattern property references a surface to be used as a // blit pattern. // -------------------------------------------------------------------------- TDx_DrawSurface* __fastcall TDDBltFX::FGetPattern() { if (ComponentState.Contains(csDesigning) && (fPattern!=NULL) && (Owner!=NULL)) { bool component_exists = false; for (int i=0;iComponentCount;i++) if (Owner->Components[i]==fPattern) { component_exists = true; break; } if (!component_exists) fPattern=NULL; } return fPattern; } // -------------------------------------------------------------------------- void __fastcall TDDBltFX::FSetPattern( TDx_DrawSurface* pPattern ) { if (fPattern!=NULL) { fDDBLTFX.lpDDSPattern = (LPDIRECTDRAWSURFACE) fPattern->Internal_LPDIRECTDRAWSURFACE7; } } // -------------------------------------------------------------------------- // Property: Rop // Description: The Rop property defines a standard windows raster operation // code. // The standard raster operations are listed in the Win32 API // help files. // TDx_Draw::GetCaps() can be used to retrieve the available // raster operations. // -------------------------------------------------------------------------- dword __fastcall TDDBltFX::FGetRop() { return fDDBLTFX.dwROP; } // -------------------------------------------------------------------------- void __fastcall TDDBltFX::FSetRop( dword pRop ) { fDDBLTFX.dwROP = pRop; } // -------------------------------------------------------------------------- // Property: RotationAngle // Description: The RotationAngle property defines the rotation angle, in // 100th's of a degree, to be applied before blitting when // DDBLT_ROTATIONANGLE is set in the Flags parameter of // TDx_DrawSurface::Blt(). // -------------------------------------------------------------------------- dword __fastcall TDDBltFX::FGetRotationAngle() { return fDDBLTFX.dwRotationAngle; } // -------------------------------------------------------------------------- void __fastcall TDDBltFX::FSetRotationAngle( dword pRotationAngle ) { fDDBLTFX.dwRotationAngle = pRotationAngle; } // -------------------------------------------------------------------------- // Property: Size // Description: The Size property defines the size, in bytes, of the internal // structure used by this component. // -------------------------------------------------------------------------- dword __fastcall TDDBltFX::FGetSize() { return fDDBLTFX.dwSize; } // -------------------------------------------------------------------------- void __fastcall TDDBltFX::FSetSize( dword pSize ) { fDDBLTFX.dwSize = pSize; } // -------------------------------------------------------------------------- // Property: SrcColorkey // Description: The SrcColorkey property references a color key used as the // source color key when DDBLT_KEYSRCOVERRIDE is set in the Flag // parameter of TDx_DrawSurface::Blt(). // -------------------------------------------------------------------------- TDDColorKey* __fastcall TDDBltFX::FGetSrcColorkey() { if (ComponentState.Contains(csDesigning) && (fSrcColorkey!=NULL) && (Owner!=NULL)) { bool component_exists = false; for (int i=0;iComponentCount;i++) if (Owner->Components[i]==fSrcColorkey) { component_exists = true; break; } if (!component_exists) fSrcColorkey=NULL; } return fSrcColorkey; } // -------------------------------------------------------------------------- void __fastcall TDDBltFX::FSetSrcColorkey( TDDColorKey* pSrcColorkey ) { fSrcColorkey = pSrcColorkey; } // -------------------------------------------------------------------------- // Property: ZBufferBaseDest // Description: The ZBufferBaseDest property defines a value to be added to // each source z-value before comparison with the destination // z-values when the TDDBltFX::FX->DDBLTFX_ZBUFFERBASEDEST flag // is set. // -------------------------------------------------------------------------- dword __fastcall TDDBltFX::FGetZBufferBaseDest() { return fDDBLTFX.dwZBufferBaseDest; } // -------------------------------------------------------------------------- void __fastcall TDDBltFX::FSetZBufferBaseDest( dword pZBufferBaseDest ) { fDDBLTFX.dwZBufferBaseDest = pZBufferBaseDest; } // -------------------------------------------------------------------------- // Property: ZBufferDest // Description: The ZBufferDest property references a surface that will // substitute for the destination z-buffer when // DDBLT_ZBUFFERDESTOVERRIDE is set in the Flags parameter of // TDx_DrawSurface::Blt(). // The DDBLT_ZBUFFERDESTOVERRIDE flag is not currently // supported. // -------------------------------------------------------------------------- TDx_DrawSurface* __fastcall TDDBltFX::FGetZBufferDest() { if (ComponentState.Contains(csDesigning) && (fZBufferDest!=NULL) && (Owner!=NULL)) { bool component_exists = false; for (int i=0;iComponentCount;i++) if (Owner->Components[i]==fZBufferDest) { component_exists = true; break; } if (!component_exists) fZBufferDest=NULL; } return fZBufferDest; } // -------------------------------------------------------------------------- void __fastcall TDDBltFX::FSetZBufferDest( TDx_DrawSurface* pZBufferDest ) { if (fZBufferDest!=NULL) { fDDBLTFX.lpDDSZBufferDest = (LPDIRECTDRAWSURFACE) fZBufferDest->Internal_LPDIRECTDRAWSURFACE7; } } // -------------------------------------------------------------------------- // Property: ZBufferHigh // Description: The ZBufferHigh property defines the highest z-value within // the source rectangle that may be copied to the // destination surface when the // TDDBltFX::FX->DDBLTFX_ZBUFFERRANGE flag is set. // -------------------------------------------------------------------------- dword __fastcall TDDBltFX::FGetZBufferHigh() { return fDDBLTFX.dwZBufferHigh; } // -------------------------------------------------------------------------- void __fastcall TDDBltFX::FSetZBufferHigh( dword pZBufferHigh ) { fDDBLTFX.dwZBufferHigh = pZBufferHigh; } // -------------------------------------------------------------------------- // Property: ZBufferLow // Description: The ZBufferLow property defines the lowest z-value within the // source rectangle that may be copied to the destination // surface when the TDDBltFX::FX->DDBLTFX_ZBUFFERRANGE flag is // set. // -------------------------------------------------------------------------- dword __fastcall TDDBltFX::FGetZBufferLow() { return fDDBLTFX.dwZBufferLow; } // -------------------------------------------------------------------------- void __fastcall TDDBltFX::FSetZBufferLow( dword pZBufferLow ) { fDDBLTFX.dwZBufferLow = pZBufferLow; } // -------------------------------------------------------------------------- // Property: ZBufferOpCode // Description: The ZBufferOpCode property defines the operation code used // when comparing source and destination z-buffers to determine // whether or not pixels should be blitted to the destination // surface. // -------------------------------------------------------------------------- dword __fastcall TDDBltFX::FGetZBufferOpCode() { return fDDBLTFX.dwZBufferOpCode; } // -------------------------------------------------------------------------- void __fastcall TDDBltFX::FSetZBufferOpCode( dword pZBufferOpCode ) { fDDBLTFX.dwZBufferOpCode = pZBufferOpCode; } // -------------------------------------------------------------------------- // Property: ZBufferSrc // Description: The ZBufferSrc property references the surface that will // substitute for the source z-buffer when // DDBLT_ZBUFFERSRCOVERRIDE is set in the Flags parameter of // TDx_DrawSurface::Blt(). // The DDBLT_ZBUFFERSRCOVERRIDE flag is not currently supported. // -------------------------------------------------------------------------- TDx_DrawSurface* __fastcall TDDBltFX::FGetZBufferSrc() { if (ComponentState.Contains(csDesigning) && (fZBufferSrc!=NULL) && (Owner!=NULL)) { bool component_exists = false; for (int i=0;iComponentCount;i++) if (Owner->Components[i]==fZBufferSrc) { component_exists = true; break; } if (!component_exists) fZBufferSrc=NULL; } return fZBufferSrc; } // -------------------------------------------------------------------------- void __fastcall TDDBltFX::FSetZBufferSrc( TDx_DrawSurface* pZBufferSrc ) { if (fZBufferSrc!=NULL) { fDDBLTFX.lpDDSZBufferSrc = (LPDIRECTDRAWSURFACE) fZBufferSrc->Internal_LPDIRECTDRAWSURFACE7; } } // -------------------------------------------------------------------------- // Property: ZDestConst // Description: The ZDestConst property defines a constant z-value which will // substitute for the destination z-buffer when // DDBLT_ZBUFFERDESTCONSTOVERRIDE is set in the Flags parameter // of TDx_DrawSurface::Blt(). // The DDBLT_ZBUFFERDESTCONSTOVERRIDE flag is not currently // supported. // -------------------------------------------------------------------------- dword __fastcall TDDBltFX::FGetZDestConst() { return fDDBLTFX.dwZDestConst; } // -------------------------------------------------------------------------- void __fastcall TDDBltFX::FSetZDestConst( dword pZDestConst ) { fDDBLTFX.dwZDestConst = pZDestConst; } // -------------------------------------------------------------------------- // Property: ZDestConstBitDepth // Description: The ZDestConstBitDepth property defines the bit depth of the // z-value constant contained in TDDBltFX::ZDestConst. // -------------------------------------------------------------------------- dword __fastcall TDDBltFX::FGetZDestConstBitDepth() { return fDDBLTFX.dwZDestConstBitDepth; } // -------------------------------------------------------------------------- void __fastcall TDDBltFX::FSetZDestConstBitDepth( dword pZDestConstBitDepth ) { fDDBLTFX.dwZDestConstBitDepth = pZDestConstBitDepth; } // -------------------------------------------------------------------------- // Property: ZSrcConst // Description: The ZSrcConst property defines a constant z-value used to // substitute for the source z-buffer when // DDBLT_ZBUFFERSRCCONSTOVERRIDE is set in the Flags parameter // of TDx_DrawSurface::Blt(). // The DDBLT_ZBUFFERSRCCONSTOVERRIDE flag is not currently // supported. // -------------------------------------------------------------------------- dword __fastcall TDDBltFX::FGetZSrcConst() { return fDDBLTFX.dwZSrcConst; } // -------------------------------------------------------------------------- void __fastcall TDDBltFX::FSetZSrcConst( dword pZSrcConst ) { fDDBLTFX.dwZSrcConst = pZSrcConst; } // -------------------------------------------------------------------------- // Property: ZSrcConstBitDepth // Description: The ZSrcConstBitDepth property defines the bit depth of the // z-value constant contained in TDDBltFX::ZSrcConst. // -------------------------------------------------------------------------- dword __fastcall TDDBltFX::FGetZSrcConstBitDepth() { return fDDBLTFX.dwZSrcConstBitDepth; } // -------------------------------------------------------------------------- void __fastcall TDDBltFX::FSetZSrcConstBitDepth( dword pZSrcConstBitDepth ) { fDDBLTFX.dwZSrcConstBitDepth = pZSrcConstBitDepth; } // -------------------------------------------------------------------------- // Method: Clear() // Description: The Clear() method can be used to clear the contents of the // TDDBltFX's internal DDBLTFX structure. // Note: if you have manually linked a structure member to a // chunk of memory, make sure you release this memory before // calling Clear(). // -------------------------------------------------------------------------- void __fastcall TDDBltFX::Clear() { fAlphaDest = NULL; fDDBLTFX.dwAlphaDestConst = 0; fDDBLTFX.dwAlphaDestConstBitDepth = 0; fDDBLTFX.dwAlphaEdgeBlend = 0; fDDBLTFX.dwAlphaEdgeBlendBitDepth = 0; fAlphaSrc = NULL; fDDBLTFX.dwAlphaSrcConst = 0; fDDBLTFX.dwAlphaSrcConstBitDepth = 0; fDDBLTFX.dwDDROP = 0; fDestColorkey = NULL; fErrorValue = DD_OK; fDDBLTFX.dwDDFX = 0; fDDBLTFX.dwFillColor = 0; fDDBLTFX.dwFillDepth = 0; fDDBLTFX.dwFillPixel = 0; fPattern = NULL; fDDBLTFX.dwROP = 0; fDDBLTFX.dwRotationAngle = 0; fDDBLTFX.dwSize = sizeof(DDBLTFX); fSrcColorkey = NULL; fDDBLTFX.dwZBufferBaseDest = 0; fZBufferDest = NULL; fDDBLTFX.dwZBufferHigh = 0; fDDBLTFX.dwZBufferLow = 0; fDDBLTFX.dwZBufferOpCode = 0; fZBufferSrc = NULL; fDDBLTFX.dwZDestConst = 0; fDDBLTFX.dwZDestConstBitDepth = 0; fDDBLTFX.dwZSrcConst = 0; fDDBLTFX.dwZSrcConstBitDepth = 0; } // -------------------------------------------------------------------------- // Internal Structure Access // -------------------------------------------------------------------------- DDBLTFX* __fastcall TDDBltFX::FGetInternal_DDBLTFX_Ptr() { if (fDestColorkey!=NULL) CopyMemory( &fDDBLTFX.ddckDestColorkey, fDestColorkey->Internal_DDCOLORKEY_Ptr, sizeof(DDCOLORKEY) ); if (fSrcColorkey!=NULL) CopyMemory( &fDDBLTFX.ddckSrcColorkey, fSrcColorkey->Internal_DDCOLORKEY_Ptr, sizeof(DDCOLORKEY) ); return &fDDBLTFX; } // -------------------------------------------------------------------------- void __fastcall TDDBltFX::FSetInternal_DDBLTFX( DDBLTFX* pDDBLTFX ) { if (pDDBLTFX==NULL) { fErrorValue = TDX_ERROR; if (FOnError) FOnError(this, "TDDBltFX::FSetInternal_DDBLTFX()", "TDX_ERROR", "The supplied DDBLTFX* was NULL" ); return; } CopyMemory( &fDDBLTFX, pDDBLTFX, sizeof(DDBLTFX) ); Internal_DDBLTFX_Update(); } // -------------------------------------------------------------------------- void __fastcall TDDBltFX::Internal_DDBLTFX_Update() { if (fDestColorkey!=NULL) CopyMemory( fDestColorkey->Internal_DDCOLORKEY_Ptr, &fDDBLTFX.ddckDestColorkey, sizeof(DDCOLORKEY) ); if (fSrcColorkey!=NULL) CopyMemory( fSrcColorkey->Internal_DDCOLORKEY_Ptr, &fDDBLTFX.ddckSrcColorkey, sizeof(DDCOLORKEY) ); } // -------------------------------------------------------------------------- // Method: FGetFX_ // Description: This method returns a TDDBltFX_FX_Set<> of the flags in the // current fDDBLTFX.dwDDFX. // Note: Wrapper components use the following method to modify flags // via the BCB Object Inspector. // -------------------------------------------------------------------------- TDDBltFX_FX_Set __fastcall TDDBltFX::FGetFX_() { TDDBltFX_FX_Set TempFX_; TempFX_.Clear(); if (fDDBLTFX.dwDDFX & DDBLTFX_ARITHSTRETCHY) TempFX_ = TempFX_ << ddbltfx_arithstretchy; if (fDDBLTFX.dwDDFX & DDBLTFX_MIRRORLEFTRIGHT) TempFX_ = TempFX_ << ddbltfx_mirrorleftright; if (fDDBLTFX.dwDDFX & DDBLTFX_MIRRORUPDOWN) TempFX_ = TempFX_ << ddbltfx_mirrorupdown; if (fDDBLTFX.dwDDFX & DDBLTFX_NOTEARING) TempFX_ = TempFX_ << ddbltfx_notearing; if (fDDBLTFX.dwDDFX & DDBLTFX_ROTATE180) TempFX_ = TempFX_ << ddbltfx_rotate180; if (fDDBLTFX.dwDDFX & DDBLTFX_ROTATE270) TempFX_ = TempFX_ << ddbltfx_rotate270; if (fDDBLTFX.dwDDFX & DDBLTFX_ROTATE90) TempFX_ = TempFX_ << ddbltfx_rotate90; if (fDDBLTFX.dwDDFX & DDBLTFX_ZBUFFERBASEDEST) TempFX_ = TempFX_ << ddbltfx_zbufferbasedest; if (fDDBLTFX.dwDDFX & DDBLTFX_ZBUFFERRANGE) TempFX_ = TempFX_ << ddbltfx_zbufferrange; return TempFX_; } // -------------------------------------------------------------------------- void __fastcall TDDBltFX::FSetFX_( TDDBltFX_FX_Set pFX_ ) { fDDBLTFX.dwDDFX = 0; if (pFX_.Contains(ddbltfx_arithstretchy)) fDDBLTFX.dwDDFX |= DDBLTFX_ARITHSTRETCHY; if (pFX_.Contains(ddbltfx_mirrorleftright)) fDDBLTFX.dwDDFX |= DDBLTFX_MIRRORLEFTRIGHT; if (pFX_.Contains(ddbltfx_mirrorupdown)) fDDBLTFX.dwDDFX |= DDBLTFX_MIRRORUPDOWN; if (pFX_.Contains(ddbltfx_notearing)) fDDBLTFX.dwDDFX |= DDBLTFX_NOTEARING; if (pFX_.Contains(ddbltfx_rotate180)) fDDBLTFX.dwDDFX |= DDBLTFX_ROTATE180; if (pFX_.Contains(ddbltfx_rotate270)) fDDBLTFX.dwDDFX |= DDBLTFX_ROTATE270; if (pFX_.Contains(ddbltfx_rotate90)) fDDBLTFX.dwDDFX |= DDBLTFX_ROTATE90; if (pFX_.Contains(ddbltfx_zbufferbasedest)) fDDBLTFX.dwDDFX |= DDBLTFX_ZBUFFERBASEDEST; if (pFX_.Contains(ddbltfx_zbufferrange)) fDDBLTFX.dwDDFX |= DDBLTFX_ZBUFFERRANGE; } // -------------------------------------------------------------------------- // Method: FGetFX_Strings() // This method creates and then returns a TStringList containing // the current set of 'FX' flags. // Note: You must manually delete the retrieved TStringList after use // to avoid memory corruption. // -------------------------------------------------------------------------- TStringList* __fastcall TDDBltFX::FGetFX_Strings() { // if the strings have not been allocated if (fFX_Strings==NULL) { // attempt to allocate the strings fFX_Strings = new TStringList(); // if the allocation failed if (fFX_Strings==NULL) { fErrorValue = TDX_ERROR; if (FOnError) FOnError(this, "TDDBltFX::FGetFX_Strings()", "TDX_ERROR", "Could not allocate memory used to retrieve various FX_Strings" ); return NULL; } } fFX_Strings->Clear(); if (fDDBLTFX.dwDDFX & DDBLTFX_ARITHSTRETCHY) fFX_Strings->Add("DDBLTFX_ARITHSTRETCHY"); if (fDDBLTFX.dwDDFX & DDBLTFX_MIRRORLEFTRIGHT) fFX_Strings->Add("DDBLTFX_MIRRORLEFTRIGHT"); if (fDDBLTFX.dwDDFX & DDBLTFX_MIRRORUPDOWN) fFX_Strings->Add("DDBLTFX_MIRRORUPDOWN"); if (fDDBLTFX.dwDDFX & DDBLTFX_NOTEARING) fFX_Strings->Add("DDBLTFX_NOTEARING"); if (fDDBLTFX.dwDDFX & DDBLTFX_ROTATE180) fFX_Strings->Add("DDBLTFX_ROTATE180"); if (fDDBLTFX.dwDDFX & DDBLTFX_ROTATE270) fFX_Strings->Add("DDBLTFX_ROTATE270"); if (fDDBLTFX.dwDDFX & DDBLTFX_ROTATE90) fFX_Strings->Add("DDBLTFX_ROTATE90"); if (fDDBLTFX.dwDDFX & DDBLTFX_ZBUFFERBASEDEST) fFX_Strings->Add("DDBLTFX_ZBUFFERBASEDEST"); if (fDDBLTFX.dwDDFX & DDBLTFX_ZBUFFERRANGE) fFX_Strings->Add("DDBLTFX_ZBUFFERRANGE"); return fFX_Strings; } // --------------------------------------------------------------------------