williamr@2: // Copyright (c) 2001-2009 Nokia Corporation and/or its subsidiary(-ies). williamr@2: // All rights reserved. williamr@2: // This component and the accompanying materials are made available williamr@2: // under the terms of the License "Symbian Foundation License v1.0" to Symbian Foundation members and "Symbian Foundation End User License Agreement v1.0" to non-members williamr@2: // which accompanies this distribution, and is available williamr@2: // at the URL "http://www.symbianfoundation.org/legal/licencesv10.html". williamr@2: // williamr@2: // Initial Contributors: williamr@2: // Nokia Corporation - initial contribution. williamr@2: // williamr@2: // Contributors: williamr@2: // williamr@2: // Description: williamr@2: // williamr@2: williamr@2: #ifndef __GRAPHICSACCELERATOR_H__ williamr@2: #define __GRAPHICSACCELERATOR_H__ williamr@2: williamr@2: #include williamr@2: #include williamr@2: williamr@2: // williamr@2: // Bitmaps williamr@2: // williamr@2: williamr@2: // Forward references williamr@2: class CFbsBitmap; williamr@2: class TAcceleratedBitmapSpec; williamr@2: williamr@2: /** williamr@2: A data structure that holds the information needed to directly access a bitmap. williamr@2: williamr@2: The bitmap can be a hardware bitmap (RHardwareBitmap), or an ordinary bitmap williamr@2: (CFbsBitmap). An object of this class is filled by calling TAcceleratedBitmapSpec::GetInfo(). williamr@2: williamr@2: @see RHardwareBitmap williamr@2: @see CFbsBitmap williamr@2: @see TAcceleratedBitmapSpec::GetInfo() williamr@2: @publishedAll williamr@2: @released williamr@2: */ williamr@2: class TAcceleratedBitmapInfo williamr@2: { williamr@2: public: williamr@2: williamr@2: /** The bitmap's display mode. */ williamr@2: TDisplayMode iDisplayMode; williamr@2: williamr@2: /** The address of the start of the bitmap. */ williamr@2: TUint8* iAddress; williamr@2: williamr@2: /** The width and height of the bitmap in pixels. */ williamr@2: TSize iSize; williamr@2: williamr@2: /** The address offset (in bytes) between successive lines in a bitmap. */ williamr@2: TInt iLinePitch; williamr@2: williamr@2: /** The shift required to obtain the number of bits needed to represent one pixel in the bitmap. williamr@2: The number of bits per pixel is calculated as 1 << iPixelShift */ williamr@2: TInt iPixelShift; williamr@2: williamr@2: /** The physical address of the start of the bitmap. This is the address which a williamr@2: hardware graphics accelerator will use and is zero if the bitmap is not accessible williamr@2: to hardware graphics accelerators. */ williamr@2: TUint8* iPhysicalAddress; williamr@2: }; williamr@2: williamr@2: /** williamr@2: The interface to a hardware bitmap. williamr@2: williamr@2: This is a bitmap that can be drawn to by graphics acceleration hardware. It williamr@2: is stored in a contiguous area of physical memory. williamr@2: williamr@2: After creating the hardware bitmap, it can be passed to CHardwareGraphicsAccelerator::NewL(). williamr@2: williamr@2: @see CHardwareGraphicsAccelerator::NewL() williamr@2: @publishedAll williamr@2: @released williamr@2: */ williamr@2: class RHardwareBitmap williamr@2: { williamr@2: friend class CBitwiseBitmap; williamr@2: friend class CFbsScreenDevice; williamr@2: public: williamr@2: williamr@2: /** Default constructor. */ williamr@2: inline RHardwareBitmap(); williamr@2: williamr@2: /** Constructor taking the handle of an existing RHardwareBitmap to duplicate it. */ williamr@2: inline RHardwareBitmap(TInt aHandle); williamr@2: williamr@2: /** williamr@2: Gets the information needed for accessing a bitmap directly into TAcceleratedBitmapInfo structure. williamr@2: williamr@2: @param aInfo On return, holds the information needed to directly access the bitmap. williamr@2: @return KErrNone if sucessful, otherwise one of the system error codes, including williamr@2: KErrUnknown if the object's type is ENoBitmap. williamr@2: */ williamr@2: IMPORT_C TInt GetInfo(TAcceleratedBitmapInfo& aInfo) const; williamr@2: private: williamr@2: IMPORT_C TInt SetAsScreenReference(TInt aScreen=-1); williamr@2: IMPORT_C TInt Create(TDisplayMode aDisplayMode, TSize aSize, TUid aCreatorUid); williamr@2: IMPORT_C void Destroy(); williamr@2: public: williamr@2: williamr@2: /** The bitmap's handle; assigned during construction. This is used to identify williamr@2: the bitmap. */ williamr@2: TInt iHandle; // Must be only member data williamr@2: }; williamr@2: williamr@2: /** Default constructor. Initialises the handle to zero. */ williamr@2: inline RHardwareBitmap::RHardwareBitmap() williamr@2: : iHandle(0) williamr@2: {} williamr@2: williamr@2: /** Constructor taking the handle of an existing RHardwareBitmap to duplicate. williamr@2: @param aHandle The RHardwareBitmap handle to duplicate. */ williamr@2: inline RHardwareBitmap::RHardwareBitmap(TInt aHandle) williamr@2: : iHandle(aHandle) williamr@2: {} williamr@2: williamr@2: /** williamr@2: Maintains a count of the number of locks made on a bitmap through a TAcceleratedBitmapSpec williamr@2: object. williamr@2: williamr@2: Passed as a parameter to TAcceleratedBitmapSpec::Lock() and TAcceleratedBitmapSpec::Unlock(). williamr@2: williamr@2: @see TAcceleratedBitmapSpec williamr@2: @publishedAll williamr@2: @released williamr@2: */ williamr@2: class TBitmapLockCount williamr@2: { williamr@2: friend class TAcceleratedBitmapSpec; williamr@2: public: williamr@2: williamr@2: /** Default constructor. Initialises the lock count to zero. */ williamr@2: inline TBitmapLockCount() : iCount(0) {} williamr@2: private: williamr@2: inline TInt Inc() { return iCount++; } williamr@2: inline TInt Dec() { return --iCount; } williamr@2: private: williamr@2: TInt iCount; williamr@2: }; williamr@2: williamr@2: williamr@2: /** williamr@2: A utility class that provides access to the contents of a bitmap. williamr@2: williamr@2: The bitmap can be a hardware bitmap (RHardwareBitmap), or an ordinary bitmap williamr@2: (CFbsBitmap). An object of this class is used as a parameter by several accelerated williamr@2: graphics operations, e.g. TGopBitBlt, to specify the source bitmap for the williamr@2: operation. williamr@2: @publishedAll williamr@2: @released williamr@2: */ williamr@2: class TAcceleratedBitmapSpec williamr@2: { williamr@2: public: williamr@2: // Constructors williamr@2: inline TAcceleratedBitmapSpec(); williamr@2: IMPORT_C TAcceleratedBitmapSpec(CFbsBitmap* aBitmap); williamr@2: IMPORT_C TAcceleratedBitmapSpec(RHardwareBitmap aBitmap); williamr@2: // Bitmap access (use with caution, see documentation) williamr@2: williamr@2: IMPORT_C TInt GetInfo(TAcceleratedBitmapInfo& aInfo) const; williamr@2: inline void Lock(TBitmapLockCount& aCount); williamr@2: inline void Lock(TBitmapLockCount& aCount,TAcceleratedBitmapInfo& aInfo); williamr@2: inline void Unlock(TBitmapLockCount& aCount); williamr@2: williamr@2: // enums williamr@2: /** Identifies the type of the bitmap. williamr@2: williamr@2: Type() returns this value. williamr@2: williamr@2: @see CFbsBitmap */ williamr@2: enum TAcceleratedBitmapType williamr@2: { williamr@2: /** The object was created using the default constructor, and has no type. */ williamr@2: ENoBitmap, williamr@2: williamr@2: /** The bitmap is of type CFbsBitmap. williamr@2: williamr@2: @see CFbsBitmap */ williamr@2: EFbsBitmap, williamr@2: williamr@2: /** The bitmap is of type RHardwareBitmap. williamr@2: williamr@2: @see RHardwareBitmap */ williamr@2: EHardwareBitmap, williamr@2: }; williamr@2: enum TAcceleratedBitmapLock williamr@2: { williamr@2: EBitmapIsStatic, williamr@2: EBitmapNeedsLocking, williamr@2: }; williamr@2: // Getters williamr@2: inline TAcceleratedBitmapType Type() const; williamr@2: inline TInt Handle() const; williamr@2: private: williamr@2: IMPORT_C void DoLock(TBitmapLockCount& aCount); williamr@2: IMPORT_C void DoLock(TBitmapLockCount& aCount,TAcceleratedBitmapInfo& aInfo); williamr@2: IMPORT_C void DoUnlock(TBitmapLockCount& aCount); williamr@2: private: williamr@2: TUint8 iType; // TAcceleratedBitmapType williamr@2: TUint8 iLockStatus; // TAcceleratedBitmapLock williamr@2: TUint8 iSpare1; williamr@2: TUint8 iSpare2; williamr@2: TInt iHandle; williamr@2: }; williamr@2: williamr@2: /** Default constructor. williamr@2: Use one of the other constructor overloads instead. */ williamr@2: inline TAcceleratedBitmapSpec::TAcceleratedBitmapSpec() williamr@2: : iType(ENoBitmap), iLockStatus(EBitmapIsStatic) williamr@2: {} williamr@2: williamr@2: /** Prevents a bitmap from moving in memory. Lock() should be called before accessing williamr@2: the bitmap and Unlock() immediately afterwards. Although it is not necessary williamr@2: to lock and unlock some types of bitmap, it is a small overhead, and it is williamr@2: recommended that you always do it. williamr@2: williamr@2: If a bitmap is already locked, all uses of the Lock() and Unlock() methods williamr@2: within the same thread must use the same TBitmapLockCount object, even if williamr@2: Lock() and Unlock() are called by different instances of TAcceleratedBitmapSpec. williamr@2: williamr@2: @param aCount Maintains a count of the number of locks made on the bitmap. */ williamr@2: inline void TAcceleratedBitmapSpec::Lock(TBitmapLockCount& aCount) williamr@2: { if(iLockStatus==EBitmapNeedsLocking) DoLock(aCount); } williamr@2: williamr@2: /** Prevents a bitmap from moving in memory. Lock() should be called before accessing williamr@2: the bitmap and Unlock() immediately afterwards. Although it is not necessary williamr@2: to lock and unlock some types of bitmap, it is a small overhead, and it is williamr@2: recommended that you always do it. Also updates a TAcceleratedBitmapInfo structure williamr@2: with any information that may have changed, (typically the bitmap's memory williamr@2: address). williamr@2: williamr@2: If a bitmap is already locked, all uses of the Lock() and Unlock() methods williamr@2: within the same thread must use the same TBitmapLockCount object, even if williamr@2: Lock() and Unlock() are called by different instances of TAcceleratedBitmapSpec. williamr@2: williamr@2: @param aCount Maintains a count of the number of locks made on the bitmap. williamr@2: @param aInfo On return, contains the new address of the start of the bitmap. */ williamr@2: inline void TAcceleratedBitmapSpec::Lock(TBitmapLockCount& aCount,TAcceleratedBitmapInfo& aInfo) williamr@2: { if(iLockStatus==EBitmapNeedsLocking) DoLock(aCount,aInfo); } williamr@2: williamr@2: /** Frees a bitmap after a call to Lock(). A call to Unlock() must be made for each corresponding williamr@2: call to Lock(). This function should be called as soon as any bitmap access has finished. If, after williamr@2: the Unlock() operation, no more calls to Lock() are outstanding on the bitmap, the bitmap is free to williamr@2: be moved in memory again. williamr@2: williamr@2: If a bitmap is already locked, all uses of the Lock() and Unlock() methods williamr@2: within the same thread must use the same TBitmapLockCount object, even if williamr@2: Lock() and Unlock() are called by different instances of TAcceleratedBitmapSpec. williamr@2: williamr@2: @param aCount Maintains a count of the number of locks made on the bitmap. */ williamr@2: inline void TAcceleratedBitmapSpec::Unlock(TBitmapLockCount& aCount) williamr@2: { if(iLockStatus==EBitmapNeedsLocking) DoUnlock(aCount); } williamr@2: williamr@2: /** Returns the type of the bitmap. The type is assigned during construction. williamr@2: williamr@2: @return The type of bitmap. */ williamr@2: inline TAcceleratedBitmapSpec::TAcceleratedBitmapType TAcceleratedBitmapSpec::Type() const williamr@2: { return (TAcceleratedBitmapSpec::TAcceleratedBitmapType)iType; } williamr@2: williamr@2: /** Returns the handle to the bitmap. williamr@2: williamr@2: @return The handle to the bitmap. */ williamr@2: inline TInt TAcceleratedBitmapSpec::Handle() const williamr@2: { return iHandle; } williamr@2: williamr@2: // williamr@2: // Accelerator capabilities williamr@2: // williamr@2: williamr@2: williamr@2: /** williamr@2: Enumerates the four transparency types. williamr@2: williamr@2: ETransparentPixel and ETransparentColor are used with a pixel value or a TRgb williamr@2: respectively. williamr@2: williamr@2: @see TGopTransparency williamr@2: @see TGraphicsAcceleratorCaps::iTransparency williamr@2: @publishedAll williamr@2: @released williamr@2: */ williamr@2: enum TTransparencyType williamr@2: { williamr@2: williamr@2: /** Any pixel that has all bits equal to zero is treated as transparent. */ williamr@2: ETransparentPixelZero, williamr@2: williamr@2: /** Any pixel that is equal to the pixel value passed to the TGopTransparency constructor williamr@2: is treated as transparent. */ williamr@2: ETransparentPixel, williamr@2: williamr@2: /** Any pixel that is equal to the TRgb value passed to the TGopTransparency constructor williamr@2: is treated as transparent. */ williamr@2: ETransparentColor, williamr@2: williamr@2: /** In 16 bits per pixel display mode, which uses 5 bits each for red, green and williamr@2: blue, the most significant bit is an Alpha value. Alpha=0 means the pixel williamr@2: is transparent, Alpha=1 means the pixel is fully opaque. */ williamr@2: ETransparent1555, williamr@2: }; williamr@2: williamr@2: /** williamr@2: Stores the capabilities of a graphics accelerator. williamr@2: williamr@2: All of the member enums except TMaskBitmapCaps define flags that are stored williamr@2: as public data of type TUint. Only TMaskBitmapCaps takes sequential values, williamr@2: so its values are mutually exclusive. williamr@2: williamr@2: An object of this class is returned by CGraphicsAccelerator::Capabilities() williamr@2: or by GenericCapabilities(), which is implemented by CSoftwareGraphicsAccelerator williamr@2: and CHardwareGraphicsAccelerator. williamr@2: williamr@2: @see CGraphicsAccelerator::Capabilities() williamr@2: @publishedAll williamr@2: @released williamr@2: */ williamr@2: class TGraphicsAcceleratorCaps williamr@2: { williamr@2: public: williamr@2: /** Clipping capabilities. Used by the iClipping member. williamr@2: williamr@2: @see CGraphicsAccelerator::Operation() */ williamr@2: enum TClipCaps // Bit flags williamr@2: { williamr@2: EClipToBitmap = 1, // Will always clip all operations to the bitmap williamr@2: williamr@2: /** The accelerator supports the Operation() methods which take clipping rectangles williamr@2: as parameters. williamr@2: williamr@2: @see CGraphicsAccelerator::Operation() */ williamr@2: EClipping = 2 // Is able to clip operations to a region williamr@2: }; williamr@2: williamr@2: /** Enumerates the capabilities relating to operations taking a bitmap mask parameter, williamr@2: for instance TGopBitBltMasked. These are mutually exclusive values used by williamr@2: the iMaskType member. */ williamr@2: enum TMaskBitmapCaps // Enum williamr@2: { williamr@2: /** No masked operations are supported. */ williamr@2: EMaskBitmapNone = 0, williamr@2: williamr@2: /** The mask bitmap can be in any display mode at all. */ williamr@2: EMaskBitmapAnyDisplayMode, williamr@2: williamr@2: /** The mask bitmap must be in the same display mode as the destination bitmap. */ williamr@2: EMaskBitmapMatchingDisplayMode, williamr@2: williamr@2: /** The mask bitmap must be in EGray2 display mode. */ williamr@2: EMaskBitmapGray2, williamr@2: }; williamr@2: williamr@2: /** Bit flags for the capabilities relating to operations that use an alpha channel williamr@2: (TGopBitBltAlphaChannel and TGopScaledBitBltAlphaChannel). These flags are williamr@2: used by the iAlphaChannel member. */ williamr@2: enum TAlphaChannelCaps //Bit flags williamr@2: { williamr@2: /** The accelerator can draw bitmaps with 4 bits each for the alpha value and the williamr@2: red, green and blue components. */ williamr@2: EAlpha4444 = 1, // Bitmaps with 4 bits for Alpha value and Red, Green, Blue components williamr@2: williamr@2: /** The accelerator can draw bitmaps with 8 bits each for the alpha value and the williamr@2: red, green and blue components. */ williamr@2: EAlpha8888 = 2, // Bitmaps with 8 bits for Alpha value and Red, Green, Blue components williamr@2: williamr@2: /** The accelerator can draw bitmaps with 1 bit for the alpha value and and 5 bits williamr@2: for the red, green and blue components. */ williamr@2: EAlpha1555 = 4, // Bitmaps with 1 bit for Alpha value and 5 bits for Red, Green, and Blue williamr@2: }; williamr@2: williamr@2: /** Bit flags for the capabilities relating to operations which take an alpha bitmap williamr@2: parameter, for instance TGopBitBltAlphaBitmap. These flags are used by the williamr@2: iAlphaBitmap member. */ williamr@2: enum TAlphaBitmapCaps //Bit flags williamr@2: { williamr@2: /** For 256 greyscale bitmaps, the value of each pixel in the alpha bitmap (from williamr@2: 0 to 255) is used as the alpha value. */ williamr@2: EAlphaBitmapGray256 = 1, williamr@2: williamr@2: /** An EColor16M bitmap may be used as the alpha bitmap. The red, green and blue williamr@2: values for each pixel in this bitmap are used as the alpha values for the williamr@2: red, green and blue components of the corresponding pixel in the source bitmap. */ williamr@2: EAlphaBitmapColor16M = 2, williamr@2: williamr@2: /** The alpha bitmap must have the same display mode as the source bitmap. */ williamr@2: EAlphaBitmapMatchingMode = 4, // Alpha bitmap must be same mode as source williamr@2: }; williamr@2: williamr@2: /** Indicates whether there is a restriction on the sizes of bitmaps that can be williamr@2: used in bitmap patterns. williamr@2: williamr@2: This is one of the possible values for the iPatternSizes member. williamr@2: williamr@2: @see TGopFillPattern */ williamr@2: enum TPatternSizeCaps //Bit flags williamr@2: { williamr@2: /** There is no restriction on the dimensions of bitmap patterns. */ williamr@2: EPatternSizeAny = 0xFFFFFFFF, williamr@2: }; williamr@2: williamr@2: /** Bit flags for the capabilities relating to operations that draw a fill pattern williamr@2: using a bitmap, for instance TGopFilledRectWithPatern. They are used in the williamr@2: iPattern member. */ williamr@2: enum TPatternCaps //Bit flags williamr@2: { williamr@2: /** The pattern bitmap can be in any display mode. */ williamr@2: EPatternAnyDisplayMode = 1, // Patterns can be in any supported display mode williamr@2: williamr@2: /** The pattern bitmap must be in the same display mode as the destination. */ williamr@2: EPatternMatchingDisplayMode = 2, // Pattern must be in same displ mode as target williamr@2: williamr@2: /** The pattern bitmap must be square (width==height). */ williamr@2: EPatternMustBeSquare = 4, // The pattern must be square (width==height) williamr@2: }; williamr@2: williamr@2: /** Bit flags for how self-crossing polygons are filled. williamr@2: williamr@2: @see CGraphicsContext::TFillRule */ williamr@2: enum TPolygonCaps // Bit flags for fill rules (see CGraphicsContext::TFillRule) williamr@2: { williamr@2: /** Only areas with odd winding numbers are filled. */ williamr@2: EPolygonFillAlternate = 1, williamr@2: williamr@2: /** All areas with a winding number greater than zero are filled. williamr@2: williamr@2: @see CGraphicsContext::TFillRule */ williamr@2: EPolygonFillWinding = 2, williamr@2: }; williamr@2: williamr@2: /** Bit flags for the specifying the supported rendering orientations. williamr@2: @see CFbsBitGc::TGraphicsOrientation */ williamr@2: enum TOrientationCaps williamr@2: { williamr@2: /** Normal orientation is supported. */ williamr@2: EOrientationCapNormal = 1, williamr@2: /** A 90 degree rotation is supported. */ williamr@2: EOrientationCapRotated90 = 2, williamr@2: /** A 180 degree rotation is supported. */ williamr@2: EOrientationCapRotated180 = 4, williamr@2: /** A 270 degree rotation is supported. */ williamr@2: EOrientationCapRotated270 = 8, williamr@2: /** All orientations are supported. */ williamr@2: EOrientationCapAll = EOrientationCapNormal|EOrientationCapRotated90|EOrientationCapRotated180|EOrientationCapRotated270, williamr@2: }; williamr@2: williamr@2: /** The size of this class in bytes. */ williamr@2: TInt iStructureSize; // The size of this class williamr@2: williamr@2: /** The version number of the API. */ williamr@2: TInt iVersion; // == 1 to specify current API williamr@2: williamr@2: /** Optional UID to identify the vendor of the graphics accelerator. This UID can williamr@2: be used to recognise a particular accelerator, enabling code to use any custom williamr@2: graphics operations and capabilities that it knows the accelerator provides. */ williamr@2: TUid iVendorUid; // Optional ID williamr@2: williamr@2: /** A bit mask of the supported display modes for the bitmap passed to the graphics williamr@2: accelerator's NewL(). Uses the least significant 11 bits as flags for each williamr@2: TDisplayMode supported. For instance, to check whether the EColor256 display williamr@2: mode is available, use the expression iDisplayModes & (1 << EColor256). williamr@2: williamr@2: @see TDisplayMode */ williamr@2: TUint iDisplayModes; // One bit for each TDisplayMode enumeration williamr@2: williamr@2: /** Indicates whether the Operation() methods which take clipping rectangles as williamr@2: parameters are supported. williamr@2: williamr@2: @see TClipCaps */ williamr@2: TUint iClipping; // TClipCaps bit flags williamr@2: williamr@2: /** Specifies the display mode restrictions for bitmap masks. These are mutually williamr@2: exclusive values. williamr@2: williamr@2: @see TMaskBitmapCaps */ williamr@2: TMaskBitmapCaps iMaskType; // Mask type used williamr@2: williamr@2: /** Specifies the transparency types supported. Uses a bit flag for each TTransparencyType williamr@2: supported. williamr@2: williamr@2: @see TTransparencyType */ williamr@2: TUint iTransparency; // Bit flag for each TTransparencyType supported williamr@2: williamr@2: /** Specifies the capabilities relating to operations that use an alpha channel. Uses a bit flag for williamr@2: each TAlphaChannelCaps supported. williamr@2: williamr@2: @see TAlphaChannelCaps */ williamr@2: TUint iAlphaChannel; // TAlphaChannelCaps bit flags williamr@2: williamr@2: /** Specifies the supported alpha bitmap types. Uses a bit flag for each TAlphaBitmapCaps williamr@2: supported. williamr@2: williamr@2: @see TAlphaBitmapCaps */ williamr@2: TUint iAlphaBitmap; // TAlphaBitmapCaps bit flags williamr@2: williamr@2: /** Specifies the sizes of bitmaps that can be used in bitmap patterns. williamr@2: williamr@2: This is a bitmask for each power of 2, or EPatternSizeAny. For example, if williamr@2: bitmaps used in patterns can only have a width or height of 16 pixels then williamr@2: this value should be set to 16. If patterns can have dimensions of 16, 32, williamr@2: 64, 128 or 256, then this value would equal the sum of these, (i.e. bits 4, williamr@2: 5, 6, 7 and 8 would be set). If this value is equal to EPatternSizeAny, there williamr@2: are no restrictions on the size of patterns that can be used. williamr@2: williamr@2: @see TPatternSizeCaps */ williamr@2: TUint iPatternSizes; // a mask bit for each power of 2, or EPatternSizeAny williamr@2: williamr@2: /** Specifies the supported bitmap types for fill patterns. Uses a bit flag for williamr@2: each TPatternCaps supported. williamr@2: williamr@2: @see TPatternCaps */ williamr@2: TUint iPattern; // TPatternCaps bit flags williamr@2: williamr@2: /** Specifies the supported fill rules for self crossing polygons. Uses a bit flag williamr@2: for each TPolygonCaps supported. williamr@2: williamr@2: @see TPolygonCaps */ williamr@2: TUint iPolygon; // TPolygonCaps bit flags williamr@2: williamr@2: /** williamr@2: iReserved[0] specifies the supported rendering orientations.Uses a bit flags williamr@2: for each TOrientationCaps supported. williamr@2: @see TOrientationCaps williamr@2: iReserved[1]-iReserved[3] are reserved for future use. All should be set to zero. williamr@2: */ williamr@2: TUint iReserved[4]; williamr@2: }; williamr@2: williamr@2: williamr@2: // williamr@2: // TGraphicsOperation williamr@2: // williamr@2: williamr@2: /** williamr@2: Abstract base class for all graphics operations. williamr@2: williamr@2: Derived classes encapsulate all the arguments needed by a given graphics operation. williamr@2: An object of one of the derived classes is passed as a parameter to CGraphicsAccelerator::Operation(). williamr@2: The member functions and enum defined in this class are not used directly williamr@2: in third party code. williamr@2: williamr@2: @see CGraphicsAccelerator::Operation() williamr@2: @publishedAll williamr@2: @released williamr@2: */ williamr@2: class TGraphicsOperation williamr@2: { williamr@2: public: williamr@2: enum TGopFunction williamr@2: { // Require arguments commented below here williamr@2: williamr@2: EFilledRect, // (TRect,TRgb) williamr@2: EFilledRectUsingDrawMode, // (TRect,TRgb,CGraphicsContext:TDrawMode) williamr@2: EFilledRectWithPattern, // (TRect,TGopFillPattern) williamr@2: EInvertRect, // (TRect) williamr@2: EFadeRect, // (TRect,TGopFadeParams) williamr@2: williamr@2: EBitBlt, // (TPoint,TAcceleratedBitmapSpec,TRect&) williamr@2: EBitBltMasked, // (TPoint,TAcceleratedBitmapSpec,TRect&,TAcceleratedBitmapSpec aMask) williamr@2: EBitBltTransparent, // (TPoint,TAcceleratedBitmapSpec,TRect&,TGopTransparency) williamr@2: EBitBltAlphaChannel, // (TPoint,TAcceleratedBitmapSpec,TRect&) williamr@2: EBitBltAlphaBitmap, // (TPoint,TAcceleratedBitmapSpec,TRect&,TAcceleratedBitmapSpec aAlpha) williamr@2: williamr@2: EScaledBitBlt, // (TRect,TAcceleratedBitmapSpec,TRect&) williamr@2: EScaledBitBltMasked, // (TRect,TAcceleratedBitmapSpec,TRect&,TAcceleratedBitmapSpec aMask) williamr@2: EScaledBitBltTransparent, // (TRect,TAcceleratedBitmapSpec,TRect&,TGopTransparency) williamr@2: EScaledBitBltAlphaChannel, // (TRect,TAcceleratedBitmapSpec,TRect&) williamr@2: EScaledBitBltAlphaBitmap, // (TRect,TAcceleratedBitmapSpec,TRect&,TAcceleratedBitmapSpec aAlpha) williamr@2: williamr@2: EFilledPolygon, // (TRGb aColor,CGraphicsContext::TFillRule aFillRule,TInt aNumPoints,TPoint[]) williamr@2: EFilledPolygonWithPattern, // (TGopFillPattern,CGraphicsContext::TFillRule aFillRule,TInt aNumPoints,TPoint[]) williamr@2: EAlphaBlendTwoBitmaps, // (TPoint,TAcceleratedBitmapSpec aSrce1,TAcceleratedBitmapSpec aSrce2,TRect&,TAcceleratedBitmapSpec aAlpha) williamr@2: EAlphaBlendOneBitmap, // (TPoint,TAcceleratedBitmapSpec aSrce,TRect&,TAcceleratedBitmapSpec aAlpha) williamr@2: EChunkTest, williamr@2: EVirtualAddressTest, williamr@2: }; williamr@2: public: williamr@2: // Getters williamr@2: inline TGopFunction Function() const { return iFunction; } williamr@2: inline TInt Size() const { return iSize; } williamr@2: // Utility functions williamr@2: inline TGraphicsOperation* Next() const; williamr@2: inline void Append(TInt aNumBytes,TAny* aData); williamr@2: protected: williamr@2: inline TGraphicsOperation(TGopFunction aFunction, TInt aArgSize); williamr@2: inline TGraphicsOperation() {} williamr@2: protected: williamr@2: TGopFunction iFunction; williamr@2: TInt iSize; // Total size of derived class williamr@2: }; williamr@2: williamr@2: inline TGraphicsOperation::TGraphicsOperation(TGopFunction aFunction, TInt aSize) williamr@2: : iFunction(aFunction) , iSize(aSize) {} williamr@2: williamr@2: inline TGraphicsOperation* TGraphicsOperation::Next() const williamr@2: { return (TGraphicsOperation*)((TUint8*)this+iSize); } williamr@2: williamr@2: inline void TGraphicsOperation::Append(TInt aNumBytes,TAny* aData) williamr@2: { williamr@2: Mem::Copy(Next(),aData,aNumBytes); williamr@2: iSize += aNumBytes; williamr@2: } williamr@2: williamr@2: williamr@2: // williamr@2: // Graphics accelerator williamr@2: // williamr@2: williamr@2: /** williamr@2: Abstract base class for 2D graphics accelerators. williamr@2: williamr@2: This class can be derived from to provide accelerated implementations of some williamr@2: common 2D graphics algorithms. Support for accelerated 2D graphics has been williamr@2: integrated into existing classes in the Graphics API for instance CFbsBitGc, williamr@2: so that existing code does not need to be altered, but a graphics accelerator williamr@2: can be used directly by applications. The accelerated 2D graphics operations williamr@2: may be implemented in software, hardware, or both. williamr@2: @publishedAll williamr@2: @released williamr@2: */ williamr@2: class CGraphicsAccelerator : public CBase williamr@2: { williamr@2: public: williamr@2: // Return the capabilities of this accelerator williamr@2: williamr@2: /** Returns the capabilities of the graphics accelerator. williamr@2: williamr@2: @return The capabilities of the accelerator. */ williamr@2: virtual const TGraphicsAcceleratorCaps* Capabilities() = 0; williamr@2: williamr@2: // Perform a graphics operation williamr@2: williamr@2: /** Requests the graphics accelerator to perform a single graphics operation. williamr@2: williamr@2: @param aOperation An instance of a TGraphicsOperation-derived class that identifies williamr@2: the graphics operation to be performed. williamr@2: @return KErrNone if successful, otherwise one of the system error codes. The williamr@2: function should return KErrNotSupported if the accelerator does not support williamr@2: the requested operation. */ williamr@2: virtual TInt Operation(const TGraphicsOperation& aOperation) = 0; williamr@2: williamr@2: /** Requests the graphics accelerator perform a single graphics operation within williamr@2: a clipping region. This version is of Operation() is only usable if the williamr@2: accelerator capabilities returned by Capabilities() indicate that clipping to a region williamr@2: is supported. williamr@2: williamr@2: @param aOperation An instance of a TGraphicsOperation-derived class that identifies williamr@2: the graphics operation to be performed. williamr@2: @param aNumClipRects The number of rectangles in the clipping region. williamr@2: @param aClipRects A pointer to the first rectangle in the clipping region. williamr@2: @return KErrNone if successful, otherwise one of the system error codes. The williamr@2: function should return KErrNotSupported if the accelerator does not support williamr@2: the requested operation. williamr@2: @see TGraphicsAcceleratorCaps::iClipping */ williamr@2: virtual TInt Operation(const TGraphicsOperation& aOperation,TInt aNumClipRects,TRect* aClipRects) = 0; williamr@2: williamr@2: // Process a buffer of TGraphicsOperation. (Each operation immediately follows the williamr@2: // one preceding it in the buffer) williamr@2: williamr@2: /** Requests the graphics accelerator perform one or more graphics operations contained williamr@2: in a buffer. williamr@2: williamr@2: The underlying implementation may be able to process a group of graphics operations williamr@2: more efficiently than if Operation() was called for each individually. williamr@2: williamr@2: This function should be implemented as if Operation() was called in turn for williamr@2: each operation contained in the buffer. Each operation should be carried out williamr@2: immediately after the one preceding it. If a method returns an error, the williamr@2: length of aBuffer should be set to indicate the number of operations that williamr@2: have been successfully processed. In this case, the operation in which the williamr@2: error occurred will be indicated by the memory address &aBuffer[aBuffer.Length()]. williamr@2: williamr@2: @param aBuffer A descriptor which holds a concatenation of graphics operations williamr@2: (TGraphicsOperation-derived objects). williamr@2: @return KErrNone if successful, otherwise one of the system error codes. The williamr@2: function should return KErrNotSupported if the accelerator does not support williamr@2: any of the requested operations. */ williamr@2: virtual TInt Operation(TDes8& aBuffer) = 0; williamr@2: williamr@2: /** Requests the graphics accelerator perform one or more graphics operations within williamr@2: a clipping region. This version is of Operation() is only usable if the williamr@2: accelerator capabilities returned by Capabilities() indicate that clipping to a region williamr@2: is supported. williamr@2: williamr@2: The underlying implementation may be able to process a group of graphics operations williamr@2: more efficiently than if Operation() was called for each individually. williamr@2: williamr@2: This function should be implemented as if Operation() was called in turn for williamr@2: each operation contained in the buffer. Each operation should be carried out williamr@2: immediately after the one preceding it. If a method returns an error, the williamr@2: length of aBuffer should be set to indicate the number of operations that williamr@2: have been successfully processed. In this case, the operation in which the williamr@2: error occurred will be indicated by the memory address &aBuffer[aBuffer.Length()]. williamr@2: williamr@2: @param aBuffer A descriptor which holds a concatenation of graphics operations williamr@2: (TGraphicsOperation objects). williamr@2: @param aNumClipRects The number of rectangles in the clipping region. williamr@2: @param aClipRects A pointer to the first rectangle in the clipping region. williamr@2: @return KErrNone if successful, otherwise one of the system error codes. The williamr@2: function should return KErrNotSupported if the accelerator does not support williamr@2: any of the requested operations. williamr@2: @see TGraphicsAcceleratorCaps::iClipping */ williamr@2: virtual TInt Operation(TDes8& aBuffer,TInt aNumClipRects,TRect* aClipRects) = 0; williamr@2: public: williamr@2: // Reserved virtual functions for future use williamr@2: virtual void Reserved_1() = 0; williamr@2: virtual void Reserved_2() = 0; williamr@2: virtual void Reserved_3() = 0; williamr@2: virtual void Reserved_4() = 0; williamr@2: }; williamr@2: williamr@2: williamr@2: williamr@2: /** williamr@2: A factory for creating 2D graphics accelerator objects whose graphics operations williamr@2: are implemented in software. williamr@2: williamr@2: Objects of derived classes can write to all types of bitmap, not just hardware williamr@2: bitmaps. Note that graphics accelerators may support only a subset of all williamr@2: graphics operations. williamr@2: @publishedAll williamr@2: @released williamr@2: */ williamr@2: class CSoftwareGraphicsAccelerator : public CGraphicsAccelerator williamr@2: { williamr@2: public: williamr@2: // Create a new CSoftwareGraphicsAccelerator for use with a given bitmap williamr@2: IMPORT_C static CSoftwareGraphicsAccelerator* NewL(CFbsBitmap* aBitmap); williamr@2: williamr@2: // Get the non-bitmap-specific capabilities of the hardware accelerator. williamr@2: IMPORT_C static const TGraphicsAcceleratorCaps* GenericCapabilities(); williamr@2: public: williamr@2: // From CGraphicsAccelerator williamr@2: virtual const TGraphicsAcceleratorCaps* Capabilities() = 0; williamr@2: virtual TInt Operation(const TGraphicsOperation& aOperation) = 0; williamr@2: virtual TInt Operation(const TGraphicsOperation& aOperation,TInt aNumClipRects,TRect* aClipRects) = 0; williamr@2: virtual TInt Operation(TDes8& aBuffer) = 0; williamr@2: virtual TInt Operation(TDes8& aBuffer,TInt aNumClipRects,TRect* aClipRects) = 0; williamr@2: // From CGraphicsAccelerator williamr@2: virtual void Reserved_1() = 0; williamr@2: virtual void Reserved_2() = 0; williamr@2: virtual void Reserved_3() = 0; williamr@2: virtual void Reserved_4() = 0; williamr@2: }; williamr@2: williamr@2: williamr@2: /** williamr@2: A factory for creating 2D graphics accelerator objects whose graphics operations williamr@2: are implemented in hardware, software or a mixture of both. williamr@2: williamr@2: Objects of derived classes can only write to hardware bitmaps (RHardwareBitmap). williamr@2: Note that graphics accelerators may support only a subset of all graphics williamr@2: operations. williamr@2: williamr@2: @see RHardwareBitmap williamr@2: @publishedAll williamr@2: @released williamr@2: */ williamr@2: class CHardwareGraphicsAccelerator : public CGraphicsAccelerator williamr@2: { williamr@2: public: williamr@2: /** williamr@2: Create a new CHardwareGraphicsAccelerator for use with a given hardware bitmap. williamr@2: williamr@2: Do not use, link against scdv.lib. williamr@2: williamr@2: @param aBitmap A bitmap that can be drawn by graphics acceleration hardware. williamr@2: It can be any bitmap. williamr@2: @return Reference to hardware graphics accelerator object. williamr@2: */ williamr@2: IMPORT_C static CHardwareGraphicsAccelerator* NewL(RHardwareBitmap aBitmap); williamr@2: williamr@2: /** williamr@2: Gets the generic capabilities of the accelerator, including the supported display modes williamr@2: for the bitmap passed to NewL(). williamr@2: williamr@2: Do not use, link against scdv.lib. williamr@2: williamr@2: @return Generic capabilities for software graphics accelerators. williamr@2: */ williamr@2: IMPORT_C static const TGraphicsAcceleratorCaps* GenericCapabilities(); williamr@2: public: williamr@2: // From CGraphicsAccelerator williamr@2: virtual const TGraphicsAcceleratorCaps* Capabilities() = 0; williamr@2: virtual TInt Operation(const TGraphicsOperation& aOperation) = 0; williamr@2: virtual TInt Operation(const TGraphicsOperation& aOperation,TInt aNumClipRects,TRect* aClipRects) = 0; williamr@2: virtual TInt Operation(TDes8& aBuffer) = 0; williamr@2: virtual TInt Operation(TDes8& aBuffer,TInt aNumClipRects,TRect* aClipRects) = 0; williamr@2: // From CGraphicsAccelerator williamr@2: virtual void Reserved_1() = 0; williamr@2: virtual void Reserved_2() = 0; williamr@2: virtual void Reserved_3() = 0; williamr@2: virtual void Reserved_4() = 0; williamr@2: }; williamr@2: williamr@2: // williamr@2: // Classes used as arguments to graphics operations williamr@2: // williamr@2: williamr@2: /** williamr@2: A pattern represented by a bitmap that is used by a graphics accelerator to williamr@2: fill a rectangle or polygon. williamr@2: williamr@2: An object of this class is specified when constructing a TGopFilledRectWithPattern williamr@2: or TGopFilledPolygonWithPattern. The types and sizes of fill pattern bitmaps williamr@2: supported by the accelerator are given by TGraphicsAcceleratorCaps::iPattern williamr@2: and TGraphicsAcceleratorCaps::iPatternSizes respectively. williamr@2: williamr@2: @see TGopFilledRectWithPattern williamr@2: @see TGopFilledPolygonWithPattern williamr@2: @see TGraphicsAcceleratorCaps::iPatternSizes williamr@2: @see TGraphicsAcceleratorCaps::iPattern williamr@2: @publishedAll williamr@2: @released williamr@2: */ williamr@2: class TGopFillPattern williamr@2: { williamr@2: public: williamr@2: williamr@2: /** Provides a handle to the bitmap, and other information needed to draw it. */ williamr@2: TAcceleratedBitmapSpec iBitmap; williamr@2: williamr@2: /** The origin of the pattern. This is the position at which to draw the pixel at williamr@2: the top left hand corner of the bitmap around which copies of the bitmap are williamr@2: "tiled" to form the pattern. It is relative to the top left hand corner of williamr@2: the rectangle being filled, so specify 0,0 if you want the bitmaps drawn flush williamr@2: with the top and left hand sides of the rectangle. */ williamr@2: TPoint iOrigin; williamr@2: }; williamr@2: williamr@2: /** williamr@2: Specifies the amount of fading for all the pixels in a rectangular area. williamr@2: williamr@2: Fading changes colours so that they are closer to white or closer to black. williamr@2: To make colours whiter, increase iOffset; to use a smaller range of colours, williamr@2: reduce iScale. Fading uses the following formula (where C is a red, green williamr@2: or blue value in a TRgb): williamr@2: williamr@2: colour component C = ( ( iScale * C ) / 256 )+iOffset; williamr@2: williamr@2: For example: williamr@2: - to fade to white, specify iScale=128, iOffset=128 williamr@2: - to fade to black, specify iScale=128, iOffset=0 williamr@2: - for no change, specify iScale=256, iOffset=0 williamr@2: williamr@2: An object of this class is specified when constructing a TGopFadeRect. williamr@2: williamr@2: @see TGopFadeRect williamr@2: @publishedAll williamr@2: @released williamr@2: */ williamr@2: class TGopFadeParams // color component C = ( ( iScale * C ) >> 8 )+iOffset; williamr@2: { williamr@2: public: williamr@2: williamr@2: /** Specifies the degree of fading, maximum=256. */ williamr@2: TInt iScale; williamr@2: williamr@2: /** The fading offset. Specifies whether to fade to black or to white. */ williamr@2: TInt iOffset; williamr@2: }; williamr@2: williamr@2: /** williamr@2: Specifies which pixels should be treated as transparent in a bitblt operation williamr@2: that supports transparency. williamr@2: williamr@2: This is used by the TGopBitBltTransparent and TGopScaledBitBltTransparent williamr@2: graphics operations. williamr@2: williamr@2: For the possible transparency types, see the TTransparencyType enumeration. williamr@2: williamr@2: An object of this class is specified when constructing a TGopBitBltTransparent or williamr@2: TGopScaledBitBltTransparent. williamr@2: williamr@2: @see TTransparencyType williamr@2: @see TGopBitBltTransparent williamr@2: @see TGopScaledBitBltTransparent williamr@2: @publishedAll williamr@2: @released williamr@2: */ williamr@2: class TGopTransparency williamr@2: { williamr@2: public: williamr@2: williamr@2: /** Constructor with a transparency type. iParam is initialised to zero. williamr@2: williamr@2: @param aType The transparency type. */ williamr@2: inline TGopTransparency(TTransparencyType aType) : iType(aType), iParam(0) {} williamr@2: williamr@2: /** Constructor with a pixel value. The type is initialised to ETransparentPixel. williamr@2: Any pixel that has a value equal to aPixelValue is treated as transparent. williamr@2: aPixelValue is the bit pattern of the pixel as stored in the bitmap. williamr@2: williamr@2: @param aPixelValue The pixel value. */ williamr@2: inline TGopTransparency(TInt aPixelValue) : iType(ETransparentPixel), iParam(aPixelValue) {} williamr@2: williamr@2: /** Constructor with a TRgb value. The type is initialised to ETransparentColor. williamr@2: Any pixel that has a color of aRgb is treated as transparent. williamr@2: williamr@2: @param aRgb The TRgb value. */ williamr@2: inline TGopTransparency(TRgb aRgb) : iType(ETransparentColor), iParam(aRgb.Value()) {} williamr@2: williamr@2: /** Gets the colour that is treated as transparent. This is the value of iParam williamr@2: as a TRgb. williamr@2: williamr@2: @return The colour that is treated as transparent. */ williamr@2: inline TRgb Color() const { return TRgb(iParam); } williamr@2: williamr@2: /** Gets the value of the colour as a TInt that is treated as transparent. This williamr@2: is the value of iParam. williamr@2: williamr@2: @return The colour that is treated as transparent. This is the bit pattern williamr@2: of the colour as stored in the bitmap. */ williamr@2: inline TInt Pixel() const { return iParam; } williamr@2: public: williamr@2: williamr@2: /** The transparency type. */ williamr@2: TTransparencyType iType; williamr@2: williamr@2: /** Holds the value of the colour/pixel that is treated as transparent. */ williamr@2: TUint32 iParam; williamr@2: }; williamr@2: williamr@2: williamr@2: // williamr@2: // Wrapper classes for graphics operation arguments williamr@2: // williamr@2: williamr@2: #ifdef __WINS__ williamr@2: #pragma warning(disable : 4355) // Disable warning - 'this' : used in base member initializer list williamr@2: #endif williamr@2: williamr@2: /** williamr@2: An accelerated graphics operation that fills a rectangular area with a colour. williamr@2: williamr@2: The data members are all initialised on construction. Objects of this class williamr@2: can be passed to a graphics accelerator's Operation() function either individually, williamr@2: or in a buffer. williamr@2: @publishedAll williamr@2: @released williamr@2: */ williamr@2: class TGopFilledRect : public TGraphicsOperation williamr@2: { williamr@2: public: williamr@2: /** Constructor with a rectangle and a colour. williamr@2: @param aRect The rectangle to fill. williamr@2: @param aColor The fill colour. */ williamr@2: inline TGopFilledRect(const TRect& aRect,TRgb aColor) williamr@2: : TGraphicsOperation(EFilledRect,sizeof(*this)), iRect(aRect) , iColor(aColor) {} williamr@2: public: williamr@2: williamr@2: /** The rectangle to fill. */ williamr@2: TRect iRect; williamr@2: williamr@2: /** The fill colour. */ williamr@2: TRgb iColor; williamr@2: }; williamr@2: williamr@2: /** williamr@2: An accelerated graphics operation that fills a rectangular area with a colour, williamr@2: whilst performing a bitwise logical operation with the pixels in the region, williamr@2: for instance AND, OR, Exclusive OR. williamr@2: williamr@2: The bitwise logical operation is specified in the draw mode. The data members williamr@2: are all initialised on construction. Objects of this class can be passed to williamr@2: a graphics accelerator's Operation() function either individually, or in a williamr@2: buffer. williamr@2: @publishedAll williamr@2: @released williamr@2: */ williamr@2: class TGopFilledRectUsingDrawMode : public TGraphicsOperation williamr@2: { williamr@2: public: williamr@2: /** Constructor with a rectangle, a colour and a draw mode. williamr@2: @param aRect The rectangle to fill. williamr@2: @param aColor The fill colour. williamr@2: @param aDrawMode The draw mode. */ williamr@2: inline TGopFilledRectUsingDrawMode(const TRect& aRect,TRgb aColor,CGraphicsContext::TDrawMode aDrawMode) williamr@2: : TGraphicsOperation(EFilledRectUsingDrawMode,sizeof(*this)), iRect(aRect) , iColor(aColor) , iDrawMode(aDrawMode) {} williamr@2: public: williamr@2: williamr@2: /** The rectangle to fill. */ williamr@2: TRect iRect; williamr@2: williamr@2: /** The fill colour. */ williamr@2: TRgb iColor; williamr@2: williamr@2: /** The draw mode. */ williamr@2: CGraphicsContext::TDrawMode iDrawMode; williamr@2: }; williamr@2: williamr@2: /** williamr@2: An accelerated graphics operation that fills a rectangular area with a pattern. williamr@2: williamr@2: The pattern consists of multiple copies of a bitmap, drawn tiled around an williamr@2: origin. Objects of this class can be passed to a graphics accelerator's Operation() williamr@2: function either individually, or in a buffer. williamr@2: williamr@2: @see TGopFillPattern williamr@2: @publishedAll williamr@2: @released williamr@2: */ williamr@2: class TGopFilledRectWithPattern : public TGraphicsOperation williamr@2: { williamr@2: public: williamr@2: /** Constructor with a rectangle and a pattern. williamr@2: @param aRect The rectangle to fill. williamr@2: @param aPattern Specifies the handle to the bitmap to use for the pattern, williamr@2: and the origin for the pattern. */ williamr@2: inline TGopFilledRectWithPattern(const TRect& aRect,TGopFillPattern aPattern) williamr@2: : TGraphicsOperation(EFilledRectWithPattern,sizeof(*this)), iRect(aRect) , iPattern(aPattern) {} williamr@2: public: williamr@2: williamr@2: /** The rectangle to fill. */ williamr@2: TRect iRect; williamr@2: williamr@2: /** Specifies the handle to the bitmap to use for the pattern and the origin for williamr@2: the pattern. */ williamr@2: TGopFillPattern iPattern; williamr@2: }; williamr@2: williamr@2: /** williamr@2: An accelerated graphics operation that inverts the colour of all pixels in williamr@2: a rectangular area. williamr@2: williamr@2: Objects of this class can be passed to a graphics accelerator's Operation() williamr@2: function either individually, or in a buffer. williamr@2: @publishedAll williamr@2: @released williamr@2: */ williamr@2: class TGopInvertRect : public TGraphicsOperation williamr@2: { williamr@2: public: williamr@2: /** Constructor with a rectangle. williamr@2: @param aRect The rectangle in which to invert the colours. */ williamr@2: inline TGopInvertRect(const TRect& aRect) williamr@2: : TGraphicsOperation(EInvertRect,sizeof(*this)), iRect(aRect) {} williamr@2: public: williamr@2: williamr@2: /** The rectangle in which to invert the colours. */ williamr@2: TRect iRect; williamr@2: }; williamr@2: williamr@2: /** williamr@2: An accelerated graphics operation that fades the pixels in a rectangular area. williamr@2: williamr@2: Objects of this class can be passed to a graphics accelerator's Operation() williamr@2: function either individually, or in a buffer. williamr@2: @publishedAll williamr@2: @released williamr@2: */ williamr@2: class TGopFadeRect : public TGraphicsOperation williamr@2: { williamr@2: public: williamr@2: /** Constructor with a rectangle and fade parameters. williamr@2: @param aRect The rectangle to fade. williamr@2: @param aFade The fade parameters. */ williamr@2: inline TGopFadeRect(const TRect& aRect, const TGopFadeParams aFade) williamr@2: : TGraphicsOperation(EFadeRect,sizeof(*this)), iRect(aRect), iFade(aFade) {} williamr@2: public: williamr@2: williamr@2: /** The rectangle to fade. */ williamr@2: TRect iRect; williamr@2: williamr@2: /** The fade parameters. */ williamr@2: TGopFadeParams iFade; williamr@2: }; williamr@2: williamr@2: /** williamr@2: An accelerated graphics operation that copies a rectangular region of one bitmap williamr@2: into another. williamr@2: williamr@2: The data members are all initialised on construction. Objects of this class williamr@2: can be passed to a graphics accelerator's Operation() function either individually, williamr@2: or in a buffer. williamr@2: @publishedAll williamr@2: @released williamr@2: */ williamr@2: class TGopBitBlt : public TGraphicsOperation williamr@2: { williamr@2: public: williamr@2: /** Constructor with a position, a source bitmap handle and a rectangle. williamr@2: @param aDestination The destination for the top left hand corner of the portion williamr@2: of the source bitmap. williamr@2: @param aSourceBitmap A handle to the source bitmap, and other information needed williamr@2: to draw it. williamr@2: @param aSourceRect A rectangle within the source bitmap. Its coordinates are relative williamr@2: to the top left of the source bitmap. Defines the part of the source bitmap to be copied. */ williamr@2: inline TGopBitBlt(const TPoint& aDestination, TAcceleratedBitmapSpec aSourceBitmap, TRect& aSourceRect) williamr@2: : TGraphicsOperation(EBitBlt,sizeof(*this)), iDestination(aDestination), iSourceBitmap(aSourceBitmap), iSourceRect(aSourceRect) {} williamr@2: public: williamr@2: williamr@2: /** The destination for the top left hand corner of the portion of the source bitmap. */ williamr@2: TPoint iDestination; williamr@2: williamr@2: /** A handle to the source bitmap, and other information needed to draw it. */ williamr@2: TAcceleratedBitmapSpec iSourceBitmap; williamr@2: williamr@2: /** A rectangle defining all or a part of the bitmap to be copied. */ williamr@2: TRect iSourceRect; williamr@2: }; williamr@2: williamr@2: /** williamr@2: An accelerated graphics operation that copies a rectangular region of one bitmap williamr@2: into another, using a third bitmap as a mask. williamr@2: williamr@2: The mask must be the same size as the source bitmap. The parts of the source williamr@2: bitmap that are drawn are the areas that are black in the mask. williamr@2: williamr@2: The data members are all initialised on construction. Objects of this class williamr@2: can be passed to a graphics accelerator's Operation() function either individually, williamr@2: or in a buffer. williamr@2: williamr@2: @see TGraphicsAcceleratorCaps::iMaskType williamr@2: @publishedAll williamr@2: @released williamr@2: */ williamr@2: class TGopBitBltMasked : public TGraphicsOperation williamr@2: { williamr@2: public: williamr@2: /** Constructor with a position, a source bitmap handle, a rectangle and a mask bitmap handle. williamr@2: @param aDestination The destination for the top left hand corner of the portion williamr@2: of the source bitmap. williamr@2: @param aSourceBitmap A handle to the source bitmap, and other information needed williamr@2: to draw it. williamr@2: @param aSourceRect A rectangle within the source bitmap. Its coordinates are relative williamr@2: to the top left of the bitmap. Defines the part of the source bitmap to be copied. williamr@2: @param aMask A handle to the mask bitmap. The parts of the source bitmap williamr@2: that are drawn are the areas that are black in the mask bitmap. */ williamr@2: inline TGopBitBltMasked(const TPoint& aDestination, TAcceleratedBitmapSpec aSourceBitmap, TRect& aSourceRect, TAcceleratedBitmapSpec aMask) williamr@2: : TGraphicsOperation(EBitBltMasked,sizeof(*this)), iDestination(aDestination), iSourceBitmap(aSourceBitmap), iSourceRect(aSourceRect), iMask(aMask) {} williamr@2: public: williamr@2: williamr@2: /** The destination for the top left hand corner of the portion of the bitmap. */ williamr@2: TPoint iDestination; williamr@2: williamr@2: /** A handle to the source bitmap, and other information needed to draw it. */ williamr@2: TAcceleratedBitmapSpec iSourceBitmap; williamr@2: williamr@2: /** A rectangle defining all or a part of the bitmap to be copied. */ williamr@2: TRect iSourceRect; williamr@2: williamr@2: /** A handle to the source bitmap mask. */ williamr@2: TAcceleratedBitmapSpec iMask; williamr@2: }; williamr@2: williamr@2: /** williamr@2: An accelerated graphics operation that copies a rectangular region of one bitmap williamr@2: into another, with some transparent pixels in the bitmap. williamr@2: williamr@2: The data members are all initialised on construction. Objects of this class williamr@2: can be passed to a graphics accelerator's Operation() function either individually, williamr@2: or in a buffer. williamr@2: williamr@2: @see TGraphicsAcceleratorCaps::iTransparency williamr@2: @see TGopTransparency williamr@2: @publishedAll williamr@2: @released williamr@2: */ williamr@2: class TGopBitBltTransparent : public TGraphicsOperation williamr@2: { williamr@2: public: williamr@2: /** Constructor with a destination, a handle to the source bitmap, a rectangle williamr@2: and a specification for which pixels should be treated as transparent. williamr@2: williamr@2: @param aDestination The destination for the top left hand corner of the portion williamr@2: of the source bitmap. williamr@2: @param aSourceBitmap A handle to the source bitmap, and other information needed williamr@2: to draw it. williamr@2: @param aSourceRect A rectangle within the source bitmap. Its coordinates are williamr@2: relative to the top left of the bitmap. Defines the part of the source bitmap to williamr@2: be copied. williamr@2: @param aTransparency A specification for which pixels in the source bitmap should williamr@2: be treated as transparent. */ williamr@2: inline TGopBitBltTransparent(const TPoint& aDestination, TAcceleratedBitmapSpec aSourceBitmap, TRect& aSourceRect, TGopTransparency aTransparency) williamr@2: : TGraphicsOperation(EBitBltTransparent,sizeof(*this)), iDestination(aDestination), iSourceBitmap(aSourceBitmap), iSourceRect(aSourceRect), iTransparency(aTransparency) {} williamr@2: public: williamr@2: williamr@2: /** The destination for the top left hand corner of the portion of the bitmap. */ williamr@2: TPoint iDestination; williamr@2: williamr@2: /** A handle to the source bitmap, and other information needed to draw it. */ williamr@2: TAcceleratedBitmapSpec iSourceBitmap; williamr@2: williamr@2: /** A rectangle defining all or a part of the bitmap to be copied. */ williamr@2: TRect iSourceRect; williamr@2: williamr@2: /** A specification for which pixels should be treated as transparent. */ williamr@2: TGopTransparency iTransparency; williamr@2: }; williamr@2: williamr@2: /** williamr@2: An accelerated graphics operation that copies a rectangular region of one bitmap williamr@2: into another, using alpha blending. williamr@2: williamr@2: The alpha value is part of each pixel in the source bitmap. For instance, williamr@2: a 32 bits per pixel bitmap may have 8 bits for each of the alpha, red, green williamr@2: and blue values. williamr@2: williamr@2: Supported bitmap formats with an alpha-channel are given in by williamr@2: TGraphicsAcceleratorCaps::iAlphaChannel. williamr@2: williamr@2: The data members are all initialised on construction. Objects of this class williamr@2: can be passed to a graphics accelerator's Operation() function either individually, williamr@2: or in a buffer. williamr@2: williamr@2: @see TGraphicsAcceleratorCaps::iAlphaChannel williamr@2: @publishedAll williamr@2: @released williamr@2: */ williamr@2: class TGopBitBltAlphaChannel : public TGraphicsOperation williamr@2: { williamr@2: public: williamr@2: /** Constructor with a position, a bitmap handle and a rectangle. williamr@2: @param aDestination The destination for the top left hand corner of the portion williamr@2: of the source bitmap. williamr@2: @param aSourceBitmap A handle to the source bitmap, and other information needed williamr@2: to draw it. williamr@2: @param aSourceRect A rectangle within the source bitmap. Its coordinates are relative williamr@2: to the top left of the source bitmap. Defines the part of the source bitmap to be copied. */ williamr@2: inline TGopBitBltAlphaChannel(const TPoint& aDestination, TAcceleratedBitmapSpec aSourceBitmap, TRect& aSourceRect) williamr@2: : TGraphicsOperation(EBitBltAlphaChannel,sizeof(*this)), iDestination(aDestination), iSourceBitmap(aSourceBitmap), iSourceRect(aSourceRect) {} williamr@2: public: williamr@2: williamr@2: /** The destination for the top left hand corner of the portion of the bitmap. */ williamr@2: TPoint iDestination; williamr@2: williamr@2: /** A handle to the source bitmap, and other information needed to access it. */ williamr@2: TAcceleratedBitmapSpec iSourceBitmap; williamr@2: williamr@2: /** A rectangle defining all or a part of the bitmap to be copied. */ williamr@2: TRect iSourceRect; williamr@2: }; williamr@2: williamr@2: /** williamr@2: An accelerated graphics operation that copies a rectangular region of one bitmap williamr@2: into another using alpha blending values provided in a third bitmap. williamr@2: williamr@2: The way alpha blending works is as follows: if the alpha value is the maximum, williamr@2: the source pixel is opaque, in other words, the full colour of the pixel is williamr@2: written to the destination. If the alpha value is zero, the source pixel is williamr@2: fully transparent, and the destination is left unaltered. Values in-between williamr@2: cause blending with the following formula: williamr@2: williamr@2: Destination = Source*Alpha/max_Alpha + Destination*(max_Alpha-Alpha)/max_Alpha williamr@2: williamr@2: Colour alpha-bitmaps specify red, green and blue alpha values for each pixel, williamr@2: greyscale bitmaps specify a single alpha value for each pixel. The maximum williamr@2: alpha value depends on the bitmap's display mode. For example, 255 is the williamr@2: maximum for an EGray256 or EColor16M bitmap. The maximum is less for bitmaps williamr@2: which use fewer bits per colour component. williamr@2: williamr@2: Supported bitmap formats than can be used as alpha bitmaps are given in williamr@2: TGraphicsAcceleratorCaps::iAlphaBitmap. williamr@2: williamr@2: Objects of this class can be passed to a graphics accelerator's Operation() williamr@2: function either individually, or in a buffer. williamr@2: williamr@2: @see TGraphicsAcceleratorCaps::iAlphaBitmap williamr@2: @publishedAll williamr@2: @released williamr@2: */ williamr@2: class TGopBitBltAlphaBitmap : public TGraphicsOperation williamr@2: { williamr@2: public: williamr@2: /** Constructor with a position, two bitmap specs and a rectangle. williamr@2: @param aDestination The destination for the top left hand corner of the portion williamr@2: of the source bitmap. williamr@2: @param aSourceBitmap A handle to the source bitmap, and other information needed williamr@2: to draw it. williamr@2: @param aSourceRect A rectangle within the source bitmap. Its coordinates are relative williamr@2: to the top left of the source bitmap. Defines the part of the source bitmap to be copied. williamr@2: @param aAlphaBitmap A handle to the alpha bitmap, the bitmap that contains williamr@2: alpha blending values. */ williamr@2: inline TGopBitBltAlphaBitmap(const TPoint& aDestination, TAcceleratedBitmapSpec aSourceBitmap, TRect& aSourceRect, TAcceleratedBitmapSpec aAlphaBitmap) williamr@2: : TGraphicsOperation(EBitBltAlphaBitmap,sizeof(*this)), iDestination(aDestination), iSourceBitmap(aSourceBitmap), iSourceRect(aSourceRect), iAlphaBitmap(aAlphaBitmap) {} williamr@2: public: williamr@2: williamr@2: /** The destination for the top left hand corner of the portion of the source bitmap. */ williamr@2: TPoint iDestination; williamr@2: williamr@2: /** A handle to the source bitmap, and other information needed to access it. */ williamr@2: TAcceleratedBitmapSpec iSourceBitmap; williamr@2: williamr@2: /** A rectangle defining the part of the source bitmap to be copied. */ williamr@2: TRect iSourceRect; williamr@2: williamr@2: /** A handle to the alpha bitmap, the bitmap that contains alpha blending values. */ williamr@2: TAcceleratedBitmapSpec iAlphaBitmap; williamr@2: }; williamr@2: williamr@2: /** williamr@2: An accelerated graphics operation that copies a rectangular region of two bitmaps williamr@2: to a destination, using alpha blending values provided in a third bitmap to blend the williamr@2: corresponding entries in the first and second bitmaps. williamr@2: williamr@2: The way alpha blending works is as follows: if the alpha value is the maximum, williamr@2: the pixel from the first source is opaque, in other words, the full colour of williamr@2: the pixel is written to the destination. If the alpha value is zero, the pixel williamr@2: from the first source is fully transparent, in other words, the full colour of williamr@2: the pixel in the second source is used. Values in-between cause blending with williamr@2: the following formula: williamr@2: williamr@2: Destination = Source1*Alpha/max_Alpha + Source2*(max_Alpha-Alpha)/max_Alpha williamr@2: williamr@2: Colour alpha bitmaps specify red, green and blue alpha values for each pixel, williamr@2: greyscale bitmaps specify a single alpha value for each pixel. The maximum williamr@2: alpha value depends on the bitmap's display mode. For example, 255 is the williamr@2: maximum for an EGray256 or EColor16M bitmap. The maximum is less for bitmaps williamr@2: which use fewer bits per colour component. williamr@2: williamr@2: Supported bitmap formats than can be used as alpha bitmaps are given in williamr@2: TGraphicsAcceleratorCaps::iAlphaBitmap. williamr@2: williamr@2: Objects of this class can be passed to a graphics accelerator's Operation() williamr@2: function either individually, or in a buffer. williamr@2: williamr@2: @see TGraphicsAcceleratorCaps::iAlphaBitmap williamr@2: @publishedAll williamr@2: @released williamr@2: */ williamr@2: class TGopAlphaBlendTwoBitmaps : public TGraphicsOperation williamr@2: { williamr@2: public: williamr@2: /** williamr@2: Constructor with a position, three bitmap specs and a rectangle. williamr@2: @param aDestination The destination for the top left hand corner of the portion williamr@2: of the source bitmaps. williamr@2: @param aSourceBmp1 A handle to the first of the source bitmaps, and other information williamr@2: needed to draw it. williamr@2: @param aSourceBmp2 A handle to the second of the source bitmaps, and other information williamr@2: needed to draw it. williamr@2: @param aSourceRect A rectangle within the source bitmaps. Its coordinates are relative williamr@2: to the top left of the bitmap. Defines the part of the bitmap to be copied. williamr@2: @param aSourcePt2 The point in the second source bitmap from which we take pixels to blend williamr@2: @param aAlphaBitmap A handle to the alpha bitmap, the bitmap that contains williamr@2: alpha blending values. williamr@2: @param aAlphaPt The point in the alpha bitmap from which we take pixels to blend williamr@2: */ williamr@2: inline TGopAlphaBlendTwoBitmaps(const TPoint& aDestination,TAcceleratedBitmapSpec aSourceBmp1,TAcceleratedBitmapSpec aSourceBmp2,TRect& aSourceRect,const TPoint& aSrcPt2,TAcceleratedBitmapSpec aAlphaBmp, const TPoint& aAlphaPt) williamr@2: : TGraphicsOperation(EAlphaBlendTwoBitmaps,sizeof(*this)), iDestination(aDestination), iSourceBmp1(aSourceBmp1), iSourceBmp2(aSourceBmp2), iSourceRect(aSourceRect), iSrcPt2(aSrcPt2), iAlphaBmp(aAlphaBmp), iAlphaPt(aAlphaPt) {} williamr@2: public: williamr@2: williamr@2: /** The destination for the top left hand corner of the portion of the source bitmaps. */ williamr@2: TPoint iDestination; williamr@2: williamr@2: /** A handle to the first source bitmap, and other information needed to access it. */ williamr@2: TAcceleratedBitmapSpec iSourceBmp1; williamr@2: williamr@2: /** A handle to the second source bitmap, and other information needed to access it. */ williamr@2: TAcceleratedBitmapSpec iSourceBmp2; williamr@2: williamr@2: /** A rectangle defining the part of the source bitmaps to be copied. */ williamr@2: TRect iSourceRect; williamr@2: williamr@2: /** The point in the second source bitmap from which we take pixels to blend. */ williamr@2: TPoint iSrcPt2; williamr@2: williamr@2: /** A handle to the alpha bitmap, the bitmap that contains alpha blending values. */ williamr@2: TAcceleratedBitmapSpec iAlphaBmp; williamr@2: williamr@2: /** The point in the alpha bitmap from which we take pixels to blend. */ williamr@2: TPoint iAlphaPt; williamr@2: }; williamr@2: williamr@2: /** williamr@2: An accelerated graphics operation that copies a rectangular region of a bitmap blended williamr@2: with the screen image to the screen, using alpha blending values provided in an alpha bitmap williamr@2: to blend the corresponding entries in the bitmap and on the screen. williamr@2: williamr@2: The way alpha blending works is as follows: if the alpha value is the maximum, williamr@2: the pixel from the source bitmap is opaque, in other words, the full colour of williamr@2: the pixel is written to the destination. If the alpha value is zero, the pixel williamr@2: from the source bitmap is fully transparent, in other words, the full colour of williamr@2: the pixel on the screen is used. Values in-between cause blending with the williamr@2: following formula: williamr@2: williamr@2: Destination = Source*Alpha/max_Alpha + Screen*(max_Alpha-Alpha)/max_Alpha williamr@2: williamr@2: Colour alpha bitmaps specify red, green and blue alpha values for each pixel, williamr@2: greyscale bitmaps specify a single alpha value for each pixel. The maximum williamr@2: alpha value depends on the bitmap's display mode. For example, 255 is the williamr@2: maximum for an EGray256 or EColor16M bitmap. The maximum is less for bitmaps williamr@2: which use fewer bits per colour component. williamr@2: williamr@2: Supported bitmap formats than can be used as alpha bitmaps are given in williamr@2: TGraphicsAcceleratorCaps::iAlphaBitmap. williamr@2: williamr@2: Objects of this class can be passed to a graphics accelerator's Operation() williamr@2: function either individually, or in a buffer. williamr@2: williamr@2: @see TGraphicsAcceleratorCaps::iAlphaBitmap williamr@2: @publishedAll williamr@2: @released williamr@2: */ williamr@2: class TGopAlphaBlendOneBitmap : public TGraphicsOperation williamr@2: { williamr@2: public: williamr@2: /** williamr@2: Constructor with a position, two bitmap specs and a rectangle. williamr@2: @param aDestination The destination for the top left hand corner of the portion williamr@2: of the source bitmap. williamr@2: @param aSourceBmp A handle to the source bitmap, and other information needed williamr@2: to draw it. williamr@2: @param aSourceRect A rectangle within the source bitmap. Its coordinates are relative williamr@2: to the top left of the source bitmap. Defines the part of the source bitmap to be copied. williamr@2: @param aAlphaBitmap A handle to the alpha bitmap, the bitmap that contains williamr@2: alpha blending values. williamr@2: @param aAlphaPt The point in the alpha bitmap from which we take pixels to blend williamr@2: */ williamr@2: williamr@2: williamr@2: inline TGopAlphaBlendOneBitmap(const TPoint& aDestination,TAcceleratedBitmapSpec aSourceBmp,TRect& aSourceRect,TAcceleratedBitmapSpec aAlphaBmp, const TPoint& aAlphaPt) williamr@2: : TGraphicsOperation(EAlphaBlendOneBitmap,sizeof(*this)), iDestination(aDestination), iSourceBmp(aSourceBmp), iSourceRect(aSourceRect), iAlphaBmp(aAlphaBmp), iAlphaPt(aAlphaPt) {} williamr@2: public: williamr@2: williamr@2: /** The destination for the top left hand corner of the portion of the source bitmap. */ williamr@2: TPoint iDestination; williamr@2: williamr@2: /** A handle to the source bitmap, and other information needed to access it. */ williamr@2: TAcceleratedBitmapSpec iSourceBmp; williamr@2: williamr@2: /** A rectangle defining the part of the bitmap to be copied. */ williamr@2: TRect iSourceRect; williamr@2: williamr@2: /** A handle to the alpha bitmap, the bitmap that contains alpha blending values. */ williamr@2: TAcceleratedBitmapSpec iAlphaBmp; williamr@2: williamr@2: /** Position of the first pixel in the alpha bitmap to be used for alpha blending. */ williamr@2: TPoint iAlphaPt; williamr@2: }; williamr@2: williamr@2: /** williamr@2: An accelerated graphics operation that copies a rectangular region of one bitmap williamr@2: into a different sized region of another. williamr@2: williamr@2: The data members are all initialised on construction. Objects of this class williamr@2: can be passed to a graphics accelerator's Operation() function either individually, williamr@2: or in a buffer. williamr@2: @publishedAll williamr@2: @released williamr@2: */ williamr@2: class TGopScaledBitBlt : public TGraphicsOperation williamr@2: { williamr@2: public: williamr@2: /** Constructor with a destination rectangle, a handle to the source bitmap and williamr@2: a source rectangle. williamr@2: @param aDestination The destination for the portion of the source bitmap. If necessary, williamr@2: the source bitmap portion is resized to fit into this rectangle. williamr@2: @param aSourceBitmap A handle to the source bitmap, and other information needed williamr@2: to draw it. williamr@2: @param aSourceRect A rectangle within the source bitmap. Its coordinates are relative williamr@2: to the top left of the source bitmap. Defines the part of the source bitmap to be copied. */ williamr@2: inline TGopScaledBitBlt(const TRect& aDestination, TAcceleratedBitmapSpec aSourceBitmap, TRect& aSourceRect) williamr@2: : TGraphicsOperation(EScaledBitBlt,sizeof(*this)), iDestination(aDestination), iSourceBitmap(aSourceBitmap), iSourceRect(aSourceRect) {} williamr@2: public: williamr@2: williamr@2: /** The destination rectangle for the portion of the source bitmap. */ williamr@2: TRect iDestination; williamr@2: williamr@2: /** A handle to the source bitmap. */ williamr@2: TAcceleratedBitmapSpec iSourceBitmap; williamr@2: williamr@2: /** A rectangle defining all or a part of the source bitmap to be copied. */ williamr@2: TRect iSourceRect; williamr@2: }; williamr@2: williamr@2: /** williamr@2: An accelerated graphics operation that copies a rectangular region of one bitmap williamr@2: into a different sized region of another, using a third bitmap as a mask. williamr@2: williamr@2: The mask must be the same size as the source bitmap. The parts of the source williamr@2: bitmap that are drawn are the areas that are black in the mask. williamr@2: williamr@2: The data members are all initialised on construction. Objects of this class williamr@2: can be passed to a graphics accelerator's Operation() function either individually, williamr@2: or in a buffer. williamr@2: williamr@2: @see TGraphicsAcceleratorCaps::iMaskType williamr@2: @publishedAll williamr@2: @released williamr@2: */ williamr@2: class TGopScaledBitBltMasked : public TGraphicsOperation williamr@2: { williamr@2: public: williamr@2: /** Constructor with a source and destination rectangle, and handles to the source williamr@2: and mask bitmaps. williamr@2: williamr@2: @param aDestination The destination for the portion of the source bitmap. If necessary, williamr@2: the source bitmap portion is resized to fit into this rectangle. williamr@2: @param aSourceBitmap A handle to the source bitmap, and other information needed williamr@2: to draw it. williamr@2: @param aSourceRect A rectangle within the source bitmap. Its coordinates are relative williamr@2: to the top left of the source bitmap. Defines the part of the source bitmap to be copied. williamr@2: @param aMask A handle to the mask bitmap. */ williamr@2: inline TGopScaledBitBltMasked(const TRect& aDestination, TAcceleratedBitmapSpec aSourceBitmap, TRect& aSourceRect, TAcceleratedBitmapSpec aMask) williamr@2: : TGraphicsOperation(EScaledBitBltMasked,sizeof(*this)), iDestination(aDestination), iSourceBitmap(aSourceBitmap), iSourceRect(aSourceRect), iMask(aMask) {} williamr@2: public: williamr@2: williamr@2: /** The destination rectangle for the portion of the bitmap. */ williamr@2: TRect iDestination; williamr@2: williamr@2: /** A handle to the source bitmap. */ williamr@2: TAcceleratedBitmapSpec iSourceBitmap; williamr@2: williamr@2: /** A rectangle defining all or a part of the source bitmap to be copied. */ williamr@2: TRect iSourceRect; williamr@2: williamr@2: /** A handle to the source bitmap mask. */ williamr@2: TAcceleratedBitmapSpec iMask; williamr@2: }; williamr@2: williamr@2: /** williamr@2: An accelerated graphics operation that copies a rectangular region of one bitmap williamr@2: into a different sized region of another, with some transparent pixels in williamr@2: the source bitmap. williamr@2: williamr@2: The data members are all initialised on construction. Objects of this class williamr@2: can be passed to a graphics accelerator's Operation() function either individually, williamr@2: or in a buffer. williamr@2: williamr@2: @see TGraphicsAcceleratorCaps::iTransparency williamr@2: @see TGopTransparency williamr@2: @publishedAll williamr@2: @released williamr@2: */ williamr@2: class TGopScaledBitBltTransparent : public TGraphicsOperation williamr@2: { williamr@2: public: williamr@2: /** Constructor with destination and source rectangles, a handle to the source williamr@2: bitmap and a specification for which pixels should be treated as transparent. williamr@2: williamr@2: @param aDestination The destination for the portion of the source bitmap. If necessary, williamr@2: the source bitmap portion is resized to fit into this rectangle. williamr@2: @param aSourceBitmap A handle to the source bitmap, and other information needed williamr@2: to draw it. williamr@2: @param aSourceRect A rectangle within the source bitmap. Its coordinates are williamr@2: relative to the top left of the source bitmap. Defines the part of the source bitmap to williamr@2: be copied. williamr@2: @param aTransparency A specification for which pixels in the source bitmap should be treated as williamr@2: transparent. */ williamr@2: inline TGopScaledBitBltTransparent(const TRect& aDestination, TAcceleratedBitmapSpec aSourceBitmap, TRect& aSourceRect, TGopTransparency aTransparency) williamr@2: : TGraphicsOperation(EScaledBitBltTransparent,sizeof(*this)), iDestination(aDestination), iSourceBitmap(aSourceBitmap), iSourceRect(aSourceRect), iTransparency(aTransparency) {} williamr@2: public: williamr@2: williamr@2: /** The destination rectangle for the portion of the source bitmap. */ williamr@2: TRect iDestination; williamr@2: williamr@2: /** A handle to the source bitmap. */ williamr@2: TAcceleratedBitmapSpec iSourceBitmap; williamr@2: williamr@2: /** A rectangle defining all or a part of the source bitmap to be copied. */ williamr@2: TRect iSourceRect; williamr@2: williamr@2: /** A specification for which pixels in the source bitmap should be treated as transparent. */ williamr@2: TGopTransparency iTransparency; williamr@2: }; williamr@2: williamr@2: /** williamr@2: An accelerated graphics operation that copies a rectangular region of one bitmap williamr@2: into a different sized region of another using alpha blending. The alpha value williamr@2: is part of each pixel in the source bitmap. williamr@2: williamr@2: Supported bitmap formats with an alpha-channel are given in by williamr@2: TGraphicsAcceleratorCaps::iAlphaChannel. williamr@2: williamr@2: The data members are all initialised on construction. Objects of this class williamr@2: can be passed to a graphics accelerator's Operation() function either individually, williamr@2: or in a buffer. williamr@2: williamr@2: @see TGraphicsAcceleratorCaps::iAlphaChannel williamr@2: @publishedAll williamr@2: @released williamr@2: */ williamr@2: class TGopScaledBitBltAlphaChannel : public TGraphicsOperation williamr@2: { williamr@2: public: williamr@2: /** Constructor with a destination rectangle, a handle to the source bitmap and williamr@2: a source rectangle. williamr@2: williamr@2: @param aDestination The destination for the portion of the source bitmap. If necessary, williamr@2: the source bitmap portion is resized to fit into this rectangle. williamr@2: @param aSourceBitmap A handle to the source bitmap, and other information needed williamr@2: to draw it. williamr@2: @param aSourceRect A rectangle within the source bitmap. Its coordinates are relative williamr@2: to the top left of the source bitmap. Defines the part of the source bitmap to be copied. */ williamr@2: inline TGopScaledBitBltAlphaChannel(const TRect& aDestination, TAcceleratedBitmapSpec aSourceBitmap, TRect& aSourceRect) williamr@2: : TGraphicsOperation(EScaledBitBltAlphaChannel,sizeof(*this)), iDestination(aDestination), iSourceBitmap(aSourceBitmap), iSourceRect(aSourceRect) {} williamr@2: public: williamr@2: williamr@2: /** The destination for the portion of the source bitmap. */ williamr@2: TRect iDestination; williamr@2: williamr@2: /** A handle to the source bitmap, and other information needed to draw it. */ williamr@2: TAcceleratedBitmapSpec iSourceBitmap; williamr@2: williamr@2: /** A rectangle defining the part of the source bitmap to be copied. */ williamr@2: TRect iSourceRect; williamr@2: }; williamr@2: williamr@2: /** williamr@2: An accelerated graphics operation that copies a rectangular region of one bitmap williamr@2: into a different sized region of another using alpha blending values provided williamr@2: in a third bitmap. williamr@2: williamr@2: The data members are all initialised on construction. Objects of this class williamr@2: can be passed to a graphics accelerator's Operation() function either individually, williamr@2: or in a buffer. williamr@2: williamr@2: @see TGraphicsAcceleratorCaps::iAlphaBitmap williamr@2: @publishedAll williamr@2: @released williamr@2: */ williamr@2: class TGopScaledBitBltAlphaBitmap : public TGraphicsOperation williamr@2: { williamr@2: public: williamr@2: /** Constructor with a source and destination rectangle and two bitmap handles. williamr@2: williamr@2: @param aDestination The destination for the portion of the source bitmap. If necessary, williamr@2: the source bitmap portion is resized to fit into this rectangle. williamr@2: @param aSourceBitmap A handle to the source bitmap, and other information needed williamr@2: to draw it. williamr@2: @param aSourceRect A rectangle within the source bitmap. Its coordinates are relative williamr@2: to the top left of the source bitmap. Defines the part of the source bitmap to be copied. williamr@2: @param aAlphaBitmap A handle to the bitmap that contains alpha blending values. */ williamr@2: inline TGopScaledBitBltAlphaBitmap(const TRect& aDestination, TAcceleratedBitmapSpec aSourceBitmap, TRect& aSourceRect, TAcceleratedBitmapSpec aAlphaBitmap) williamr@2: : TGraphicsOperation(EScaledBitBltAlphaBitmap,sizeof(*this)), iDestination(aDestination), iSourceBitmap(aSourceBitmap), iSourceRect(aSourceRect), iAlphaBitmap(aAlphaBitmap) {} williamr@2: public: williamr@2: williamr@2: /** The destination for the portion of the bitmap. */ williamr@2: TRect iDestination; williamr@2: williamr@2: /** A handle to the source bitmap, and other information needed to draw it. */ williamr@2: TAcceleratedBitmapSpec iSourceBitmap; williamr@2: williamr@2: /** A rectangle defining the part of the source bitmap to be copied. */ williamr@2: TRect iSourceRect; williamr@2: williamr@2: /** A handle to the bitmap that contains alpha blending values. */ williamr@2: TAcceleratedBitmapSpec iAlphaBitmap; williamr@2: }; williamr@2: williamr@2: /** williamr@2: An accelerated graphics operation that fills a polygon with a colour. williamr@2: williamr@2: AddPoints() must be called to specify the polygon to be filled. Objects of williamr@2: this class can be passed to a graphics accelerator's Operation() function williamr@2: either individually, or in a buffer. williamr@2: williamr@2: How a graphics accelerator can fill polygons is given by TGraphicsAcceleratorCaps::iPolygon. williamr@2: williamr@2: @see TGraphicsAcceleratorCaps::iPolygon williamr@2: @publishedAll williamr@2: @released williamr@2: */ williamr@2: class TGopFilledPolygon : public TGraphicsOperation williamr@2: { williamr@2: public: williamr@2: /** Constructor with a fill rule and a fill colour. The number of points is initialised williamr@2: to zero. williamr@2: williamr@2: @param aColor The fill colour. williamr@2: @param aFillRule Bit flags for how self-crossing polygons are filled. */ williamr@2: inline TGopFilledPolygon(TRgb aColor, CGraphicsContext::TFillRule aFillRule) williamr@2: : TGraphicsOperation(EFilledPolygon,sizeof(*this)), iColor(aColor), iFillRule(aFillRule), iNumPoints(0) {} williamr@2: inline void AddPoints(TInt aNumPoints, TPoint* aPoints); williamr@2: public: williamr@2: williamr@2: /** The fill colour. */ williamr@2: TRgb iColor; williamr@2: williamr@2: /** Bit flags for how self-crossing polygons are filled. williamr@2: williamr@2: @see CGraphicsContext::TFillRule */ williamr@2: CGraphicsContext::TFillRule iFillRule; williamr@2: williamr@2: /** The number of points in the polygon. */ williamr@2: TInt iNumPoints; williamr@2: }; williamr@2: williamr@2: /** Specifies the polygon to be filled as a number of 2D point coordinates. williamr@2: williamr@2: AddPoints() should only be called once the TGopFilledPolygon object has been stored williamr@2: into a buffer. There must be enough room in the buffer after the TGopFilledPolygon williamr@2: object to hold aNumPoints TPoint sized structures. This is because the points are williamr@2: copied into the memory space directly following the TGopFilledPolygon object. williamr@2: williamr@2: @param aNumPoints The number of points in the polygon. williamr@2: @param aPoints Pointer to the first point in the polygon. */ williamr@2: inline void TGopFilledPolygon::AddPoints(TInt aNumPoints, TPoint* aPoints) williamr@2: { Append(aNumPoints*sizeof(TPoint),aPoints); iNumPoints += aNumPoints; } williamr@2: williamr@2: /** williamr@2: An accelerated graphics operation that fills a polygon with a pattern held williamr@2: in another bitmap. williamr@2: williamr@2: AddPoints() must be called to specify the polygon to be filled. Objects of williamr@2: this class can be passed to a graphics accelerator's Operation() function williamr@2: either individually, or in a buffer. williamr@2: williamr@2: @see TGraphicsAcceleratorCaps::iPolygon williamr@2: @see TGopFillPattern williamr@2: @publishedAll williamr@2: @released williamr@2: */ williamr@2: class TGopFilledPolygonWithPattern : public TGraphicsOperation williamr@2: { williamr@2: public: williamr@2: /** Constructor with a fill pattern and a fill rule. The number of points is initialised williamr@2: to zero. williamr@2: williamr@2: @param aPattern The fill pattern. williamr@2: @param aFillRule Bit flags for how self-crossing polygons are filled. */ williamr@2: inline TGopFilledPolygonWithPattern(TGopFillPattern aPattern, CGraphicsContext::TFillRule aFillRule) williamr@2: : TGraphicsOperation(EFilledPolygonWithPattern,sizeof(*this)), iPattern(aPattern), iFillRule(aFillRule), iNumPoints(0) {} williamr@2: inline void AddPoints(TInt aNumPoints, TPoint* aPoints); williamr@2: public: williamr@2: williamr@2: /** The pattern of bitmaps that is used to fill the polygon. */ williamr@2: TGopFillPattern iPattern; williamr@2: williamr@2: /** Bit flags for how self-crossing polygons are filled. williamr@2: williamr@2: @see CGraphicsContext::TFillRule */ williamr@2: CGraphicsContext::TFillRule iFillRule; williamr@2: williamr@2: /** The number of points in the polygon. */ williamr@2: TInt iNumPoints; williamr@2: }; williamr@2: williamr@2: /** Specifies the polygon to be filled as a number of 2D point coordinates. williamr@2: williamr@2: AddPoints() should only be called once the TGopFilledPolygonWithPattern object has been stored williamr@2: into a buffer. There must be enough room in the buffer after the TGopFilledPolygonWithPattern williamr@2: object to hold aNumPoints TPoint sized structures. This is because the points are williamr@2: copied into the memory space directly following the TGopFilledPolygonWithPattern object. williamr@2: williamr@2: @param aNumPoints The number of points in the polygon. williamr@2: @param aPoints Pointer to the first point in the polygon. */ williamr@2: inline void TGopFilledPolygonWithPattern::AddPoints(TInt aNumPoints, TPoint* aPoints) williamr@2: { Append(aNumPoints*sizeof(TPoint),aPoints); iNumPoints += aNumPoints; } williamr@2: williamr@2: williamr@2: williamr@2: #endif