1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
1.2 +++ b/os/graphics/graphicsdeviceinterface/screendriver/inc/GraphicsAccelerator.h Fri Jun 15 03:10:57 2012 +0200
1.3 @@ -0,0 +1,1758 @@
1.4 +// Copyright (c) 2001-2009 Nokia Corporation and/or its subsidiary(-ies).
1.5 +// All rights reserved.
1.6 +// This component and the accompanying materials are made available
1.7 +// under the terms of "Eclipse Public License v1.0"
1.8 +// which accompanies this distribution, and is available
1.9 +// at the URL "http://www.eclipse.org/legal/epl-v10.html".
1.10 +//
1.11 +// Initial Contributors:
1.12 +// Nokia Corporation - initial contribution.
1.13 +//
1.14 +// Contributors:
1.15 +//
1.16 +// Description:
1.17 +//
1.18 +
1.19 +#ifndef __GRAPHICSACCELERATOR_H__
1.20 +#define __GRAPHICSACCELERATOR_H__
1.21 +
1.22 +#include <e32std.h>
1.23 +#include <gdi.h>
1.24 +
1.25 +//
1.26 +// Bitmaps
1.27 +//
1.28 +
1.29 +// Forward references
1.30 +class CFbsBitmap;
1.31 +class TAcceleratedBitmapSpec;
1.32 +
1.33 +/**
1.34 +A data structure that holds the information needed to directly access a bitmap.
1.35 +
1.36 +The bitmap can be a hardware bitmap (RHardwareBitmap), or an ordinary bitmap
1.37 +(CFbsBitmap). An object of this class is filled by calling TAcceleratedBitmapSpec::GetInfo().
1.38 +
1.39 +@see RHardwareBitmap
1.40 +@see CFbsBitmap
1.41 +@see TAcceleratedBitmapSpec::GetInfo()
1.42 +@publishedAll
1.43 +@released
1.44 +*/
1.45 +class TAcceleratedBitmapInfo
1.46 + {
1.47 +public:
1.48 + /** The display mode of the bitmap. */
1.49 + TDisplayMode iDisplayMode;
1.50 +
1.51 + /** The address of the start of the bitmap. */
1.52 + TUint8* iAddress;
1.53 +
1.54 + /** The width and height of the bitmap in pixels. */
1.55 + TSize iSize;
1.56 +
1.57 + /** The address offset (in bytes) between successive lines in a bitmap.
1.58 + If the bitmap is compressed the line pitch has no meaning so this data
1.59 + member is set to the negation of the compression type. In the case of
1.60 + an extended bitmap it is -EProprietaryCompression. */
1.61 + TInt iLinePitch;
1.62 +
1.63 + /** The shift required to obtain the number of bits needed to represent one pixel
1.64 + in the bitmap. The number of bits per pixel is calculated as 1 << iPixelShift.
1.65 + In the case of an extended bitmap this data member is set to the bitmap type UID. */
1.66 + TInt iPixelShift;
1.67 +
1.68 + union
1.69 + {
1.70 + /** The physical address of the start of the bitmap. This is the address which a
1.71 + hardware graphics accelerator will use and is zero if the bitmap is not accessible
1.72 + to hardware graphics accelerators. Invalid in the case of an extended bitmap. */
1.73 + TUint8* iPhysicalAddress;
1.74 + /** In the case of an extended bitmap, the size of the raw bitmap data. */
1.75 + TInt iDataSize;
1.76 + };
1.77 + };
1.78 +
1.79 +/**
1.80 +The interface to a hardware bitmap.
1.81 +
1.82 +This is a bitmap that can be drawn to by graphics acceleration hardware. It
1.83 +is stored in a contiguous area of physical memory.
1.84 +
1.85 +After creating the hardware bitmap, it can be passed to CHardwareGraphicsAccelerator::NewL().
1.86 +
1.87 +@see CHardwareGraphicsAccelerator::NewL()
1.88 +@publishedAll
1.89 +@released
1.90 +*/
1.91 +class RHardwareBitmap
1.92 + {
1.93 + friend class CBitwiseBitmap;
1.94 + friend class CFbsScreenDevice;
1.95 +public:
1.96 +
1.97 + /** Default constructor. */
1.98 + inline RHardwareBitmap();
1.99 +
1.100 + /** Constructor taking the handle of an existing RHardwareBitmap to duplicate it. */
1.101 + inline RHardwareBitmap(TInt aHandle);
1.102 +
1.103 + /**
1.104 + Gets the information needed for accessing a bitmap directly into TAcceleratedBitmapInfo structure.
1.105 +
1.106 + @param aInfo On return, holds the information needed to directly access the bitmap.
1.107 + @return KErrNone if sucessful, otherwise one of the system error codes, including
1.108 + KErrUnknown if the object's type is ENoBitmap.
1.109 + */
1.110 + IMPORT_C TInt GetInfo(TAcceleratedBitmapInfo& aInfo) const;
1.111 +private:
1.112 + IMPORT_C TInt SetAsScreenReference(TInt aScreen=-1);
1.113 + IMPORT_C TInt Create(TDisplayMode aDisplayMode, TSize aSize, TUid aCreatorUid);
1.114 + IMPORT_C void Destroy();
1.115 +public:
1.116 +
1.117 + /** The bitmap's handle; assigned during construction. This is used to identify
1.118 + the bitmap. */
1.119 + TInt iHandle; // Must be only member data
1.120 + };
1.121 +
1.122 + /** Default constructor. Initialises the handle to zero. */
1.123 +inline RHardwareBitmap::RHardwareBitmap()
1.124 + : iHandle(0)
1.125 + {}
1.126 +
1.127 + /** Constructor taking the handle of an existing RHardwareBitmap to duplicate.
1.128 + @param aHandle The RHardwareBitmap handle to duplicate. */
1.129 +inline RHardwareBitmap::RHardwareBitmap(TInt aHandle)
1.130 + : iHandle(aHandle)
1.131 + {}
1.132 +
1.133 +/**
1.134 +Maintains a count of the number of locks made on a bitmap through a TAcceleratedBitmapSpec
1.135 +object.
1.136 +
1.137 +Passed as a parameter to TAcceleratedBitmapSpec::Lock() and TAcceleratedBitmapSpec::Unlock().
1.138 +
1.139 +@see TAcceleratedBitmapSpec
1.140 +@publishedAll
1.141 +@released
1.142 +*/
1.143 +class TBitmapLockCount
1.144 + {
1.145 + friend class TAcceleratedBitmapSpec;
1.146 +public:
1.147 +
1.148 + /** Default constructor. Initialises the lock count to zero. */
1.149 + inline TBitmapLockCount() : iCount(0) {}
1.150 +private:
1.151 + inline TInt Inc() { return iCount++; }
1.152 + inline TInt Dec() { return --iCount; }
1.153 +private:
1.154 + TInt iCount;
1.155 + };
1.156 +
1.157 +
1.158 +/**
1.159 +A utility class that provides access to the contents of a bitmap.
1.160 +
1.161 +The bitmap can be a hardware bitmap (RHardwareBitmap), or an ordinary bitmap
1.162 +(CFbsBitmap). An object of this class is used as a parameter by several accelerated
1.163 +graphics operations, e.g. TGopBitBlt, to specify the source bitmap for the
1.164 +operation.
1.165 +@publishedAll
1.166 +@released
1.167 +*/
1.168 +class TAcceleratedBitmapSpec
1.169 + {
1.170 +public:
1.171 + // Constructors
1.172 + inline TAcceleratedBitmapSpec();
1.173 + IMPORT_C TAcceleratedBitmapSpec(CFbsBitmap* aBitmap);
1.174 + IMPORT_C TAcceleratedBitmapSpec(RHardwareBitmap aBitmap);
1.175 + // Bitmap access (use with caution, see documentation)
1.176 +
1.177 + IMPORT_C TInt GetInfo(TAcceleratedBitmapInfo& aInfo) const;
1.178 + inline void Lock(TBitmapLockCount& aCount);
1.179 + inline void Lock(TBitmapLockCount& aCount,TAcceleratedBitmapInfo& aInfo);
1.180 + inline void Unlock(TBitmapLockCount& aCount);
1.181 +
1.182 + // enums
1.183 + /** Identifies the type of the bitmap.
1.184 +
1.185 + Type() returns this value.
1.186 +
1.187 + @see CFbsBitmap */
1.188 + enum TAcceleratedBitmapType
1.189 + {
1.190 + /** The object was created using the default constructor, and has no type. */
1.191 + ENoBitmap,
1.192 +
1.193 + /** The bitmap is of type CFbsBitmap.
1.194 +
1.195 + @see CFbsBitmap */
1.196 + EFbsBitmap,
1.197 +
1.198 + /** The bitmap is of type RHardwareBitmap.
1.199 +
1.200 + @see RHardwareBitmap */
1.201 + EHardwareBitmap,
1.202 + };
1.203 + enum TAcceleratedBitmapLock
1.204 + {
1.205 + EBitmapIsStatic,
1.206 + EBitmapNeedsLocking,
1.207 + };
1.208 + // Getters
1.209 + inline TAcceleratedBitmapType Type() const;
1.210 + inline TInt Handle() const;
1.211 +private:
1.212 + IMPORT_C void DoLock(TBitmapLockCount& aCount);
1.213 + IMPORT_C void DoLock(TBitmapLockCount& aCount,TAcceleratedBitmapInfo& aInfo);
1.214 + IMPORT_C void DoUnlock(TBitmapLockCount& aCount);
1.215 +private:
1.216 + TUint8 iType; // TAcceleratedBitmapType
1.217 + TUint8 iLockStatus; // TAcceleratedBitmapLock
1.218 + TUint8 iSpare1;
1.219 + TUint8 iSpare2;
1.220 + TInt iHandle;
1.221 + };
1.222 +
1.223 + /** Default constructor.
1.224 + Use one of the other constructor overloads instead. */
1.225 +inline TAcceleratedBitmapSpec::TAcceleratedBitmapSpec()
1.226 + : iType(ENoBitmap), iLockStatus(EBitmapIsStatic)
1.227 + {}
1.228 +
1.229 + /** Prevents a bitmap from moving in memory. Lock() should be called before accessing
1.230 + the bitmap and Unlock() immediately afterwards. Although it is not necessary
1.231 + to lock and unlock some types of bitmap, it is a small overhead, and it is
1.232 + recommended that you always do it.
1.233 +
1.234 + If a bitmap is already locked, all uses of the Lock() and Unlock() methods
1.235 + within the same thread must use the same TBitmapLockCount object, even if
1.236 + Lock() and Unlock() are called by different instances of TAcceleratedBitmapSpec.
1.237 +
1.238 + @param aCount Maintains a count of the number of locks made on the bitmap. */
1.239 +inline void TAcceleratedBitmapSpec::Lock(TBitmapLockCount& aCount)
1.240 + { if(iLockStatus==EBitmapNeedsLocking) DoLock(aCount); }
1.241 +
1.242 + /** Prevents a bitmap from moving in memory. Lock() should be called before accessing
1.243 + the bitmap and Unlock() immediately afterwards. Although it is not necessary
1.244 + to lock and unlock some types of bitmap, it is a small overhead, and it is
1.245 + recommended that you always do it. Also updates a TAcceleratedBitmapInfo structure
1.246 + with any information that may have changed, (typically the bitmap's memory
1.247 + address).
1.248 +
1.249 + If a bitmap is already locked, all uses of the Lock() and Unlock() methods
1.250 + within the same thread must use the same TBitmapLockCount object, even if
1.251 + Lock() and Unlock() are called by different instances of TAcceleratedBitmapSpec.
1.252 +
1.253 + @param aCount Maintains a count of the number of locks made on the bitmap.
1.254 + @param aInfo On return, contains the new address of the start of the bitmap. */
1.255 +inline void TAcceleratedBitmapSpec::Lock(TBitmapLockCount& aCount,TAcceleratedBitmapInfo& aInfo)
1.256 + { if(iLockStatus==EBitmapNeedsLocking) DoLock(aCount,aInfo); }
1.257 +
1.258 + /** Frees a bitmap after a call to Lock(). A call to Unlock() must be made for each corresponding
1.259 + call to Lock(). This function should be called as soon as any bitmap access has finished. If, after
1.260 + the Unlock() operation, no more calls to Lock() are outstanding on the bitmap, the bitmap is free to
1.261 + be moved in memory again.
1.262 +
1.263 + If a bitmap is already locked, all uses of the Lock() and Unlock() methods
1.264 + within the same thread must use the same TBitmapLockCount object, even if
1.265 + Lock() and Unlock() are called by different instances of TAcceleratedBitmapSpec.
1.266 +
1.267 + @param aCount Maintains a count of the number of locks made on the bitmap. */
1.268 +inline void TAcceleratedBitmapSpec::Unlock(TBitmapLockCount& aCount)
1.269 + { if(iLockStatus==EBitmapNeedsLocking) DoUnlock(aCount); }
1.270 +
1.271 + /** Returns the type of the bitmap. The type is assigned during construction.
1.272 +
1.273 + @return The type of bitmap. */
1.274 +inline TAcceleratedBitmapSpec::TAcceleratedBitmapType TAcceleratedBitmapSpec::Type() const
1.275 + { return (TAcceleratedBitmapSpec::TAcceleratedBitmapType)iType; }
1.276 +
1.277 + /** Returns the handle to the bitmap.
1.278 +
1.279 + @return The handle to the bitmap. */
1.280 +inline TInt TAcceleratedBitmapSpec::Handle() const
1.281 + { return iHandle; }
1.282 +
1.283 +//
1.284 +// Accelerator capabilities
1.285 +//
1.286 +
1.287 +
1.288 +/**
1.289 +Enumerates the four transparency types.
1.290 +
1.291 +ETransparentPixel and ETransparentColor are used with a pixel value or a TRgb
1.292 +respectively.
1.293 +
1.294 +@see TGopTransparency
1.295 +@see TGraphicsAcceleratorCaps::iTransparency
1.296 +@publishedAll
1.297 +@released
1.298 +*/
1.299 +enum TTransparencyType
1.300 + {
1.301 +
1.302 + /** Any pixel that has all bits equal to zero is treated as transparent. */
1.303 + ETransparentPixelZero,
1.304 +
1.305 + /** Any pixel that is equal to the pixel value passed to the TGopTransparency constructor
1.306 + is treated as transparent. */
1.307 + ETransparentPixel,
1.308 +
1.309 + /** Any pixel that is equal to the TRgb value passed to the TGopTransparency constructor
1.310 + is treated as transparent. */
1.311 + ETransparentColor,
1.312 +
1.313 + /** In 16 bits per pixel display mode, which uses 5 bits each for red, green and
1.314 + blue, the most significant bit is an Alpha value. Alpha=0 means the pixel
1.315 + is transparent, Alpha=1 means the pixel is fully opaque. */
1.316 + ETransparent1555,
1.317 + };
1.318 +
1.319 +/**
1.320 +Stores the capabilities of a graphics accelerator.
1.321 +
1.322 +All of the member enums except TMaskBitmapCaps define flags that are stored
1.323 +as public data of type TUint. Only TMaskBitmapCaps takes sequential values,
1.324 +so its values are mutually exclusive.
1.325 +
1.326 +An object of this class is returned by CGraphicsAccelerator::Capabilities()
1.327 +or by GenericCapabilities(), which is implemented by CSoftwareGraphicsAccelerator
1.328 +and CHardwareGraphicsAccelerator.
1.329 +
1.330 +@see CGraphicsAccelerator::Capabilities()
1.331 +@publishedAll
1.332 +@released
1.333 +*/
1.334 +class TGraphicsAcceleratorCaps
1.335 + {
1.336 +public:
1.337 + /** Clipping capabilities. Used by the iClipping member.
1.338 +
1.339 + @see CGraphicsAccelerator::Operation() */
1.340 + enum TClipCaps // Bit flags
1.341 + {
1.342 + EClipToBitmap = 1, // Will always clip all operations to the bitmap
1.343 +
1.344 + /** The accelerator supports the Operation() methods which take clipping rectangles
1.345 + as parameters.
1.346 +
1.347 + @see CGraphicsAccelerator::Operation() */
1.348 + EClipping = 2 // Is able to clip operations to a region
1.349 + };
1.350 +
1.351 +/** Enumerates the capabilities relating to operations taking a bitmap mask parameter,
1.352 +for instance TGopBitBltMasked. These are mutually exclusive values used by
1.353 +the iMaskType member. */
1.354 + enum TMaskBitmapCaps // Enum
1.355 + {
1.356 + /** No masked operations are supported. */
1.357 + EMaskBitmapNone = 0,
1.358 +
1.359 + /** The mask bitmap can be in any display mode at all. */
1.360 + EMaskBitmapAnyDisplayMode,
1.361 +
1.362 + /** The mask bitmap must be in the same display mode as the destination bitmap. */
1.363 + EMaskBitmapMatchingDisplayMode,
1.364 +
1.365 + /** The mask bitmap must be in EGray2 display mode. */
1.366 + EMaskBitmapGray2,
1.367 + };
1.368 +
1.369 +/** Bit flags for the capabilities relating to operations that use an alpha channel
1.370 +(TGopBitBltAlphaChannel and TGopScaledBitBltAlphaChannel). These flags are
1.371 +used by the iAlphaChannel member. */
1.372 + enum TAlphaChannelCaps //Bit flags
1.373 + {
1.374 + /** The accelerator can draw bitmaps with 4 bits each for the alpha value and the
1.375 + red, green and blue components. */
1.376 + EAlpha4444 = 1, // Bitmaps with 4 bits for Alpha value and Red, Green, Blue components
1.377 +
1.378 + /** The accelerator can draw bitmaps with 8 bits each for the alpha value and the
1.379 + red, green and blue components. */
1.380 + EAlpha8888 = 2, // Bitmaps with 8 bits for Alpha value and Red, Green, Blue components
1.381 +
1.382 + /** The accelerator can draw bitmaps with 1 bit for the alpha value and and 5 bits
1.383 + for the red, green and blue components. */
1.384 + EAlpha1555 = 4, // Bitmaps with 1 bit for Alpha value and 5 bits for Red, Green, and Blue
1.385 + };
1.386 +
1.387 +/** Bit flags for the capabilities relating to operations which take an alpha bitmap
1.388 +parameter, for instance TGopBitBltAlphaBitmap. These flags are used by the
1.389 +iAlphaBitmap member. */
1.390 + enum TAlphaBitmapCaps //Bit flags
1.391 + {
1.392 + /** For 256 greyscale bitmaps, the value of each pixel in the alpha bitmap (from
1.393 + 0 to 255) is used as the alpha value. */
1.394 + EAlphaBitmapGray256 = 1,
1.395 +
1.396 + /** An EColor16M bitmap may be used as the alpha bitmap. The red, green and blue
1.397 + values for each pixel in this bitmap are used as the alpha values for the
1.398 + red, green and blue components of the corresponding pixel in the source bitmap. */
1.399 + EAlphaBitmapColor16M = 2,
1.400 +
1.401 + /** The alpha bitmap must have the same display mode as the source bitmap. */
1.402 + EAlphaBitmapMatchingMode = 4, // Alpha bitmap must be same mode as source
1.403 + };
1.404 +
1.405 +/** Indicates whether there is a restriction on the sizes of bitmaps that can be
1.406 +used in bitmap patterns.
1.407 +
1.408 +This is one of the possible values for the iPatternSizes member.
1.409 +
1.410 +@see TGopFillPattern */
1.411 + enum TPatternSizeCaps //Bit flags
1.412 + {
1.413 + /** There is no restriction on the dimensions of bitmap patterns. */
1.414 + EPatternSizeAny = 0xFFFFFFFF,
1.415 + };
1.416 +
1.417 +/** Bit flags for the capabilities relating to operations that draw a fill pattern
1.418 +using a bitmap, for instance TGopFilledRectWithPatern. They are used in the
1.419 +iPattern member. */
1.420 + enum TPatternCaps //Bit flags
1.421 + {
1.422 + /** The pattern bitmap can be in any display mode. */
1.423 + EPatternAnyDisplayMode = 1, // Patterns can be in any supported display mode
1.424 +
1.425 + /** The pattern bitmap must be in the same display mode as the destination. */
1.426 + EPatternMatchingDisplayMode = 2, // Pattern must be in same displ mode as target
1.427 +
1.428 + /** The pattern bitmap must be square (width==height). */
1.429 + EPatternMustBeSquare = 4, // The pattern must be square (width==height)
1.430 + };
1.431 +
1.432 +/** Bit flags for how self-crossing polygons are filled.
1.433 +
1.434 +@see CGraphicsContext::TFillRule */
1.435 + enum TPolygonCaps // Bit flags for fill rules (see CGraphicsContext::TFillRule)
1.436 + {
1.437 + /** Only areas with odd winding numbers are filled. */
1.438 + EPolygonFillAlternate = 1,
1.439 +
1.440 + /** All areas with a winding number greater than zero are filled.
1.441 +
1.442 + @see CGraphicsContext::TFillRule */
1.443 + EPolygonFillWinding = 2,
1.444 + };
1.445 +
1.446 +
1.447 +/** Bit flags for the specifying the supported rendering orientations.
1.448 +@see CFbsBitGc::TGraphicsOrientation */
1.449 + enum TOrientationCaps
1.450 + {
1.451 + /** Normal orientation is supported. */
1.452 + EOrientationCapNormal = 1,
1.453 + /** A 90 degree rotation is supported. */
1.454 + EOrientationCapRotated90 = 2,
1.455 + /** A 180 degree rotation is supported. */
1.456 + EOrientationCapRotated180 = 4,
1.457 + /** A 270 degree rotation is supported. */
1.458 + EOrientationCapRotated270 = 8,
1.459 + /** All orientations are supported. */
1.460 + EOrientationCapAll = EOrientationCapNormal|EOrientationCapRotated90|EOrientationCapRotated180|EOrientationCapRotated270
1.461 + };
1.462 +
1.463 + /** The size of this class in bytes. */
1.464 + TInt iStructureSize; // The size of this class
1.465 +
1.466 + /** The version number of the API. */
1.467 + TInt iVersion; // == 1 to specify current API
1.468 +
1.469 + /** Optional UID to identify the vendor of the graphics accelerator. This UID can
1.470 + be used to recognise a particular accelerator, enabling code to use any custom
1.471 + graphics operations and capabilities that it knows the accelerator provides. */
1.472 + TUid iVendorUid; // Optional ID
1.473 +
1.474 + /** A bit mask of the supported display modes for the bitmap passed to the graphics
1.475 + accelerator's NewL(). Uses the least significant 11 bits as flags for each
1.476 + TDisplayMode supported. For instance, to check whether the EColor256 display
1.477 + mode is available, use the expression iDisplayModes & (1 << EColor256).
1.478 +
1.479 + @see TDisplayMode */
1.480 + TUint iDisplayModes; // One bit for each TDisplayMode enumeration
1.481 +
1.482 + /** Indicates whether the Operation() methods which take clipping rectangles as
1.483 + parameters are supported.
1.484 +
1.485 + @see TClipCaps */
1.486 + TUint iClipping; // TClipCaps bit flags
1.487 +
1.488 + /** Specifies the display mode restrictions for bitmap masks. These are mutually
1.489 + exclusive values.
1.490 +
1.491 + @see TMaskBitmapCaps */
1.492 + TMaskBitmapCaps iMaskType; // Mask type used
1.493 +
1.494 + /** Specifies the transparency types supported. Uses a bit flag for each TTransparencyType
1.495 + supported.
1.496 +
1.497 + @see TTransparencyType */
1.498 + TUint iTransparency; // Bit flag for each TTransparencyType supported
1.499 +
1.500 + /** Specifies the capabilities relating to operations that use an alpha channel. Uses a bit flag for
1.501 + each TAlphaChannelCaps supported.
1.502 +
1.503 + @see TAlphaChannelCaps */
1.504 + TUint iAlphaChannel; // TAlphaChannelCaps bit flags
1.505 +
1.506 + /** Specifies the supported alpha bitmap types. Uses a bit flag for each TAlphaBitmapCaps
1.507 + supported.
1.508 +
1.509 + @see TAlphaBitmapCaps */
1.510 + TUint iAlphaBitmap; // TAlphaBitmapCaps bit flags
1.511 +
1.512 + /** Specifies the sizes of bitmaps that can be used in bitmap patterns.
1.513 +
1.514 + This is a bitmask for each power of 2, or EPatternSizeAny. For example, if
1.515 + bitmaps used in patterns can only have a width or height of 16 pixels then
1.516 + this value should be set to 16. If patterns can have dimensions of 16, 32,
1.517 + 64, 128 or 256, then this value would equal the sum of these, (i.e. bits 4,
1.518 + 5, 6, 7 and 8 would be set). If this value is equal to EPatternSizeAny, there
1.519 + are no restrictions on the size of patterns that can be used.
1.520 +
1.521 + @see TPatternSizeCaps */
1.522 + TUint iPatternSizes; // a mask bit for each power of 2, or EPatternSizeAny
1.523 +
1.524 + /** Specifies the supported bitmap types for fill patterns. Uses a bit flag for
1.525 + each TPatternCaps supported.
1.526 +
1.527 + @see TPatternCaps */
1.528 + TUint iPattern; // TPatternCaps bit flags
1.529 +
1.530 + /** Specifies the supported fill rules for self crossing polygons. Uses a bit flag
1.531 + for each TPolygonCaps supported.
1.532 +
1.533 + @see TPolygonCaps */
1.534 + TUint iPolygon; // TPolygonCaps bit flags
1.535 +
1.536 + /**
1.537 + iReserved[0] specifies the supported rendering orientations.Uses a bit flags
1.538 + for each TOrientationCaps supported.
1.539 + @see TOrientationCaps
1.540 + iReserved[1]-iReserved[3] are reserved for future use. All should be set to zero.
1.541 + */
1.542 + TUint iReserved[4];
1.543 + };
1.544 +
1.545 +
1.546 +//
1.547 +// TGraphicsOperation
1.548 +//
1.549 +
1.550 +/**
1.551 +Abstract base class for all graphics operations.
1.552 +
1.553 +Derived classes encapsulate all the arguments needed by a given graphics operation.
1.554 +An object of one of the derived classes is passed as a parameter to CGraphicsAccelerator::Operation().
1.555 +The member functions and enum defined in this class are not used directly
1.556 +in third party code.
1.557 +
1.558 +@see CGraphicsAccelerator::Operation()
1.559 +@publishedAll
1.560 +@released
1.561 +*/
1.562 +class TGraphicsOperation
1.563 + {
1.564 +public:
1.565 + enum TGopFunction
1.566 + { // Require arguments commented below here
1.567 +
1.568 + EFilledRect, // (TRect,TRgb)
1.569 + EFilledRectUsingDrawMode, // (TRect,TRgb,CGraphicsContext:TDrawMode)
1.570 + EFilledRectWithPattern, // (TRect,TGopFillPattern)
1.571 + EInvertRect, // (TRect)
1.572 + EFadeRect, // (TRect,TGopFadeParams)
1.573 +
1.574 + EBitBlt, // (TPoint,TAcceleratedBitmapSpec,TRect&)
1.575 + EBitBltMasked, // (TPoint,TAcceleratedBitmapSpec,TRect&,TAcceleratedBitmapSpec aMask)
1.576 + EBitBltTransparent, // (TPoint,TAcceleratedBitmapSpec,TRect&,TGopTransparency)
1.577 + EBitBltAlphaChannel, // (TPoint,TAcceleratedBitmapSpec,TRect&)
1.578 + EBitBltAlphaBitmap, // (TPoint,TAcceleratedBitmapSpec,TRect&,TAcceleratedBitmapSpec aAlpha)
1.579 +
1.580 + EScaledBitBlt, // (TRect,TAcceleratedBitmapSpec,TRect&)
1.581 + EScaledBitBltMasked, // (TRect,TAcceleratedBitmapSpec,TRect&,TAcceleratedBitmapSpec aMask)
1.582 + EScaledBitBltTransparent, // (TRect,TAcceleratedBitmapSpec,TRect&,TGopTransparency)
1.583 + EScaledBitBltAlphaChannel, // (TRect,TAcceleratedBitmapSpec,TRect&)
1.584 + EScaledBitBltAlphaBitmap, // (TRect,TAcceleratedBitmapSpec,TRect&,TAcceleratedBitmapSpec aAlpha)
1.585 +
1.586 + EFilledPolygon, // (TRGb aColor,CGraphicsContext::TFillRule aFillRule,TInt aNumPoints,TPoint[])
1.587 + EFilledPolygonWithPattern, // (TGopFillPattern,CGraphicsContext::TFillRule aFillRule,TInt aNumPoints,TPoint[])
1.588 + EAlphaBlendTwoBitmaps, // (TPoint,TAcceleratedBitmapSpec aSrce1,TAcceleratedBitmapSpec aSrce2,TRect&,TAcceleratedBitmapSpec aAlpha)
1.589 + EAlphaBlendOneBitmap, // (TPoint,TAcceleratedBitmapSpec aSrce,TRect&,TAcceleratedBitmapSpec aAlpha)
1.590 + EChunkTest,
1.591 + EVirtualAddressTest,
1.592 + };
1.593 +public:
1.594 + // Getters
1.595 + inline TGopFunction Function() const { return iFunction; }
1.596 + inline TInt Size() const { return iSize; }
1.597 + // Utility functions
1.598 + inline TGraphicsOperation* Next() const;
1.599 + inline void Append(TInt aNumBytes,TAny* aData);
1.600 +protected:
1.601 + inline TGraphicsOperation(TGopFunction aFunction, TInt aArgSize);
1.602 + inline TGraphicsOperation() {}
1.603 +protected:
1.604 + TGopFunction iFunction;
1.605 + TInt iSize; // Total size of derived class
1.606 + };
1.607 +
1.608 +inline TGraphicsOperation::TGraphicsOperation(TGopFunction aFunction, TInt aSize)
1.609 + : iFunction(aFunction) , iSize(aSize) {}
1.610 +
1.611 +inline TGraphicsOperation* TGraphicsOperation::Next() const
1.612 + { return (TGraphicsOperation*)((TUint8*)this+iSize); }
1.613 +
1.614 +inline void TGraphicsOperation::Append(TInt aNumBytes,TAny* aData)
1.615 + {
1.616 + Mem::Copy(Next(),aData,aNumBytes);
1.617 + iSize += aNumBytes;
1.618 + }
1.619 +
1.620 +
1.621 +//
1.622 +// Graphics accelerator
1.623 +//
1.624 +
1.625 +/**
1.626 +Abstract base class for 2D graphics accelerators.
1.627 +
1.628 +This class can be derived from to provide accelerated implementations of some
1.629 +common 2D graphics algorithms. Support for accelerated 2D graphics has been
1.630 +integrated into existing classes in the Graphics API for instance CFbsBitGc,
1.631 +so that existing code does not need to be altered, but a graphics accelerator
1.632 +can be used directly by applications. The accelerated 2D graphics operations
1.633 +may be implemented in software, hardware, or both.
1.634 +@publishedAll
1.635 +@released
1.636 +*/
1.637 +class CGraphicsAccelerator : public CBase
1.638 + {
1.639 +public:
1.640 + // Return the capabilities of this accelerator
1.641 +
1.642 + /** Returns the capabilities of the graphics accelerator.
1.643 +
1.644 + @return The capabilities of the accelerator. */
1.645 + virtual const TGraphicsAcceleratorCaps* Capabilities() = 0;
1.646 +
1.647 + // Perform a graphics operation
1.648 +
1.649 + /** Requests the graphics accelerator to perform a single graphics operation.
1.650 +
1.651 + @param aOperation An instance of a TGraphicsOperation-derived class that identifies
1.652 + the graphics operation to be performed.
1.653 + @return KErrNone if successful, otherwise one of the system error codes. The
1.654 + function should return KErrNotSupported if the accelerator does not support
1.655 + the requested operation. */
1.656 + virtual TInt Operation(const TGraphicsOperation& aOperation) = 0;
1.657 +
1.658 + /** Requests the graphics accelerator perform a single graphics operation within
1.659 + a clipping region. This version is of Operation() is only usable if the
1.660 + accelerator capabilities returned by Capabilities() indicate that clipping to a region
1.661 + is supported.
1.662 +
1.663 + @param aOperation An instance of a TGraphicsOperation-derived class that identifies
1.664 + the graphics operation to be performed.
1.665 + @param aNumClipRects The number of rectangles in the clipping region.
1.666 + @param aClipRects A pointer to the first rectangle in the clipping region.
1.667 + @return KErrNone if successful, otherwise one of the system error codes. The
1.668 + function should return KErrNotSupported if the accelerator does not support
1.669 + the requested operation.
1.670 + @see TGraphicsAcceleratorCaps::iClipping */
1.671 + virtual TInt Operation(const TGraphicsOperation& aOperation,TInt aNumClipRects,TRect* aClipRects) = 0;
1.672 +
1.673 + // Process a buffer of TGraphicsOperation. (Each operation immediately follows the
1.674 + // one preceding it in the buffer)
1.675 +
1.676 + /** Requests the graphics accelerator perform one or more graphics operations contained
1.677 + in a buffer.
1.678 +
1.679 + The underlying implementation may be able to process a group of graphics operations
1.680 + more efficiently than if Operation() was called for each individually.
1.681 +
1.682 + This function should be implemented as if Operation() was called in turn for
1.683 + each operation contained in the buffer. Each operation should be carried out
1.684 + immediately after the one preceding it. If a method returns an error, the
1.685 + length of aBuffer should be set to indicate the number of operations that
1.686 + have been successfully processed. In this case, the operation in which the
1.687 + error occurred will be indicated by the memory address &aBuffer[aBuffer.Length()].
1.688 +
1.689 + @param aBuffer A descriptor which holds a concatenation of graphics operations
1.690 + (TGraphicsOperation-derived objects).
1.691 + @return KErrNone if successful, otherwise one of the system error codes. The
1.692 + function should return KErrNotSupported if the accelerator does not support
1.693 + any of the requested operations. */
1.694 + virtual TInt Operation(TDes8& aBuffer) = 0;
1.695 +
1.696 + /** Requests the graphics accelerator perform one or more graphics operations within
1.697 + a clipping region. This version is of Operation() is only usable if the
1.698 + accelerator capabilities returned by Capabilities() indicate that clipping to a region
1.699 + is supported.
1.700 +
1.701 + The underlying implementation may be able to process a group of graphics operations
1.702 + more efficiently than if Operation() was called for each individually.
1.703 +
1.704 + This function should be implemented as if Operation() was called in turn for
1.705 + each operation contained in the buffer. Each operation should be carried out
1.706 + immediately after the one preceding it. If a method returns an error, the
1.707 + length of aBuffer should be set to indicate the number of operations that
1.708 + have been successfully processed. In this case, the operation in which the
1.709 + error occurred will be indicated by the memory address &aBuffer[aBuffer.Length()].
1.710 +
1.711 + @param aBuffer A descriptor which holds a concatenation of graphics operations
1.712 + (TGraphicsOperation objects).
1.713 + @param aNumClipRects The number of rectangles in the clipping region.
1.714 + @param aClipRects A pointer to the first rectangle in the clipping region.
1.715 + @return KErrNone if successful, otherwise one of the system error codes. The
1.716 + function should return KErrNotSupported if the accelerator does not support
1.717 + any of the requested operations.
1.718 + @see TGraphicsAcceleratorCaps::iClipping */
1.719 + virtual TInt Operation(TDes8& aBuffer,TInt aNumClipRects,TRect* aClipRects) = 0;
1.720 +public:
1.721 + // Reserved virtual functions for future use
1.722 + virtual void Reserved_1() = 0;
1.723 + virtual void Reserved_2() = 0;
1.724 + virtual void Reserved_3() = 0;
1.725 + virtual void Reserved_4() = 0;
1.726 + };
1.727 +
1.728 +
1.729 +
1.730 +/**
1.731 +A factory for creating 2D graphics accelerator objects whose graphics operations
1.732 +are implemented in software.
1.733 +
1.734 +Objects of derived classes can write to all types of bitmap, not just hardware
1.735 +bitmaps. Note that graphics accelerators may support only a subset of all
1.736 +graphics operations.
1.737 +@publishedAll
1.738 +@released
1.739 +*/
1.740 +class CSoftwareGraphicsAccelerator : public CGraphicsAccelerator
1.741 + {
1.742 +public:
1.743 + // Create a new CSoftwareGraphicsAccelerator for use with a given bitmap
1.744 + IMPORT_C static CSoftwareGraphicsAccelerator* NewL(CFbsBitmap* aBitmap);
1.745 +
1.746 + // Get the non-bitmap-specific capabilities of the hardware accelerator.
1.747 + IMPORT_C static const TGraphicsAcceleratorCaps* GenericCapabilities();
1.748 +public:
1.749 + // From CGraphicsAccelerator
1.750 + virtual const TGraphicsAcceleratorCaps* Capabilities() = 0;
1.751 + virtual TInt Operation(const TGraphicsOperation& aOperation) = 0;
1.752 + virtual TInt Operation(const TGraphicsOperation& aOperation,TInt aNumClipRects,TRect* aClipRects) = 0;
1.753 + virtual TInt Operation(TDes8& aBuffer) = 0;
1.754 + virtual TInt Operation(TDes8& aBuffer,TInt aNumClipRects,TRect* aClipRects) = 0;
1.755 + // From CGraphicsAccelerator
1.756 + virtual void Reserved_1() = 0;
1.757 + virtual void Reserved_2() = 0;
1.758 + virtual void Reserved_3() = 0;
1.759 + virtual void Reserved_4() = 0;
1.760 + };
1.761 +
1.762 +
1.763 +/**
1.764 +A factory for creating 2D graphics accelerator objects whose graphics operations
1.765 +are implemented in hardware, software or a mixture of both.
1.766 +
1.767 +Objects of derived classes can only write to hardware bitmaps (RHardwareBitmap).
1.768 +Note that graphics accelerators may support only a subset of all graphics
1.769 +operations.
1.770 +
1.771 +@see RHardwareBitmap
1.772 +@publishedAll
1.773 +@released
1.774 +*/
1.775 +class CHardwareGraphicsAccelerator : public CGraphicsAccelerator
1.776 + {
1.777 +public:
1.778 + /**
1.779 + Create a new CHardwareGraphicsAccelerator for use with a given hardware bitmap.
1.780 +
1.781 + Do not use, link against scdv.lib.
1.782 +
1.783 + @param aBitmap A bitmap that can be drawn by graphics acceleration hardware.
1.784 + It can be any bitmap.
1.785 + @return Reference to hardware graphics accelerator object.
1.786 + */
1.787 + IMPORT_C static CHardwareGraphicsAccelerator* NewL(RHardwareBitmap aBitmap);
1.788 +
1.789 + /**
1.790 + Gets the generic capabilities of the accelerator, including the supported display modes
1.791 + for the bitmap passed to NewL().
1.792 +
1.793 + Do not use, link against scdv.lib.
1.794 +
1.795 + @return Generic capabilities for software graphics accelerators.
1.796 + */
1.797 + IMPORT_C static const TGraphicsAcceleratorCaps* GenericCapabilities();
1.798 +public:
1.799 + // From CGraphicsAccelerator
1.800 + virtual const TGraphicsAcceleratorCaps* Capabilities() = 0;
1.801 + virtual TInt Operation(const TGraphicsOperation& aOperation) = 0;
1.802 + virtual TInt Operation(const TGraphicsOperation& aOperation,TInt aNumClipRects,TRect* aClipRects) = 0;
1.803 + virtual TInt Operation(TDes8& aBuffer) = 0;
1.804 + virtual TInt Operation(TDes8& aBuffer,TInt aNumClipRects,TRect* aClipRects) = 0;
1.805 + // From CGraphicsAccelerator
1.806 + virtual void Reserved_1() = 0;
1.807 + virtual void Reserved_2() = 0;
1.808 + virtual void Reserved_3() = 0;
1.809 + virtual void Reserved_4() = 0;
1.810 + };
1.811 +
1.812 +//
1.813 +// Classes used as arguments to graphics operations
1.814 +//
1.815 +
1.816 +/**
1.817 +A pattern represented by a bitmap that is used by a graphics accelerator to
1.818 +fill a rectangle or polygon.
1.819 +
1.820 +An object of this class is specified when constructing a TGopFilledRectWithPattern
1.821 +or TGopFilledPolygonWithPattern. The types and sizes of fill pattern bitmaps
1.822 +supported by the accelerator are given by TGraphicsAcceleratorCaps::iPattern
1.823 +and TGraphicsAcceleratorCaps::iPatternSizes respectively.
1.824 +
1.825 +@see TGopFilledRectWithPattern
1.826 +@see TGopFilledPolygonWithPattern
1.827 +@see TGraphicsAcceleratorCaps::iPatternSizes
1.828 +@see TGraphicsAcceleratorCaps::iPattern
1.829 +@publishedAll
1.830 +@released
1.831 +*/
1.832 +class TGopFillPattern
1.833 + {
1.834 +public:
1.835 +
1.836 + /** Provides a handle to the bitmap, and other information needed to draw it. */
1.837 + TAcceleratedBitmapSpec iBitmap;
1.838 +
1.839 + /** The origin of the pattern. This is the position at which to draw the pixel at
1.840 + the top left hand corner of the bitmap around which copies of the bitmap are
1.841 + "tiled" to form the pattern. It is relative to the top left hand corner of
1.842 + the rectangle being filled, so specify 0,0 if you want the bitmaps drawn flush
1.843 + with the top and left hand sides of the rectangle. */
1.844 + TPoint iOrigin;
1.845 + };
1.846 +
1.847 +/**
1.848 +Specifies the amount of fading for all the pixels in a rectangular area.
1.849 +
1.850 +Fading changes colours so that they are closer to white or closer to black.
1.851 +To make colours whiter, increase iOffset; to use a smaller range of colours,
1.852 +reduce iScale. Fading uses the following formula (where C is a red, green
1.853 +or blue value in a TRgb):
1.854 +
1.855 +colour component C = ( ( iScale * C ) / 256 )+iOffset;
1.856 +
1.857 +For example:
1.858 +- to fade to white, specify iScale=128, iOffset=128
1.859 +- to fade to black, specify iScale=128, iOffset=0
1.860 +- for no change, specify iScale=256, iOffset=0
1.861 +
1.862 +An object of this class is specified when constructing a TGopFadeRect.
1.863 +
1.864 +@see TGopFadeRect
1.865 +@publishedAll
1.866 +@released
1.867 +*/
1.868 +class TGopFadeParams // color component C = ( ( iScale * C ) >> 8 )+iOffset;
1.869 + {
1.870 +public:
1.871 +
1.872 + /** Specifies the degree of fading, maximum=256. */
1.873 + TInt iScale;
1.874 +
1.875 + /** The fading offset. Specifies whether to fade to black or to white. */
1.876 + TInt iOffset;
1.877 + };
1.878 +
1.879 +/**
1.880 +Specifies which pixels should be treated as transparent in a bitblt operation
1.881 +that supports transparency.
1.882 +
1.883 +This is used by the TGopBitBltTransparent and TGopScaledBitBltTransparent
1.884 +graphics operations.
1.885 +
1.886 +For the possible transparency types, see the TTransparencyType enumeration.
1.887 +
1.888 +An object of this class is specified when constructing a TGopBitBltTransparent or
1.889 +TGopScaledBitBltTransparent.
1.890 +
1.891 +@see TTransparencyType
1.892 +@see TGopBitBltTransparent
1.893 +@see TGopScaledBitBltTransparent
1.894 +@publishedAll
1.895 +@released
1.896 +*/
1.897 +class TGopTransparency
1.898 + {
1.899 +public:
1.900 +
1.901 + /** Constructor with a transparency type. iParam is initialised to zero.
1.902 +
1.903 + @param aType The transparency type. */
1.904 + inline TGopTransparency(TTransparencyType aType) : iType(aType), iParam(0) {}
1.905 +
1.906 + /** Constructor with a pixel value. The type is initialised to ETransparentPixel.
1.907 + Any pixel that has a value equal to aPixelValue is treated as transparent.
1.908 + aPixelValue is the bit pattern of the pixel as stored in the bitmap.
1.909 +
1.910 + @param aPixelValue The pixel value. */
1.911 + inline TGopTransparency(TInt aPixelValue) : iType(ETransparentPixel), iParam(aPixelValue) {}
1.912 +
1.913 + /** Constructor with a TRgb value. The type is initialised to ETransparentColor.
1.914 + Any pixel that has a color of aRgb is treated as transparent.
1.915 +
1.916 + @param aRgb The TRgb value. */
1.917 + inline TGopTransparency(TRgb aRgb) : iType(ETransparentColor), iParam(aRgb.Value()) {}
1.918 +
1.919 + /** Gets the colour that is treated as transparent. This is the value of iParam
1.920 + as a TRgb.
1.921 +
1.922 + @return The colour that is treated as transparent. */
1.923 + inline TRgb Color() const { return TRgb(iParam); }
1.924 +
1.925 + /** Gets the value of the colour as a TInt that is treated as transparent. This
1.926 + is the value of iParam.
1.927 +
1.928 + @return The colour that is treated as transparent. This is the bit pattern
1.929 + of the colour as stored in the bitmap. */
1.930 + inline TInt Pixel() const { return iParam; }
1.931 +public:
1.932 +
1.933 + /** The transparency type. */
1.934 + TTransparencyType iType;
1.935 +
1.936 + /** Holds the value of the colour/pixel that is treated as transparent. */
1.937 + TUint32 iParam;
1.938 + };
1.939 +
1.940 +
1.941 +//
1.942 +// Wrapper classes for graphics operation arguments
1.943 +//
1.944 +
1.945 +#ifdef __WINS__
1.946 +#pragma warning(disable : 4355) // Disable warning - 'this' : used in base member initializer list
1.947 +#endif
1.948 +
1.949 +/**
1.950 +An accelerated graphics operation that fills a rectangular area with a colour.
1.951 +
1.952 +The data members are all initialised on construction. Objects of this class
1.953 +can be passed to a graphics accelerator's Operation() function either individually,
1.954 +or in a buffer.
1.955 +@publishedAll
1.956 +@released
1.957 +*/
1.958 +class TGopFilledRect : public TGraphicsOperation
1.959 + {
1.960 +public:
1.961 + /** Constructor with a rectangle and a colour.
1.962 + @param aRect The rectangle to fill.
1.963 + @param aColor The fill colour. */
1.964 + inline TGopFilledRect(const TRect& aRect,TRgb aColor)
1.965 + : TGraphicsOperation(EFilledRect,sizeof(*this)), iRect(aRect) , iColor(aColor) {}
1.966 +public:
1.967 +
1.968 + /** The rectangle to fill. */
1.969 + TRect iRect;
1.970 +
1.971 + /** The fill colour. */
1.972 + TRgb iColor;
1.973 + };
1.974 +
1.975 +/**
1.976 +An accelerated graphics operation that fills a rectangular area with a colour,
1.977 +whilst performing a bitwise logical operation with the pixels in the region,
1.978 +for instance AND, OR, Exclusive OR.
1.979 +
1.980 +The bitwise logical operation is specified in the draw mode. The data members
1.981 +are all initialised on construction. Objects of this class can be passed to
1.982 +a graphics accelerator's Operation() function either individually, or in a
1.983 +buffer.
1.984 +@publishedAll
1.985 +@released
1.986 +*/
1.987 +class TGopFilledRectUsingDrawMode : public TGraphicsOperation
1.988 + {
1.989 +public:
1.990 + /** Constructor with a rectangle, a colour and a draw mode.
1.991 + @param aRect The rectangle to fill.
1.992 + @param aColor The fill colour.
1.993 + @param aDrawMode The draw mode. */
1.994 + inline TGopFilledRectUsingDrawMode(const TRect& aRect,TRgb aColor,CGraphicsContext::TDrawMode aDrawMode)
1.995 + : TGraphicsOperation(EFilledRectUsingDrawMode,sizeof(*this)), iRect(aRect) , iColor(aColor) , iDrawMode(aDrawMode) {}
1.996 +public:
1.997 +
1.998 + /** The rectangle to fill. */
1.999 + TRect iRect;
1.1000 +
1.1001 + /** The fill colour. */
1.1002 + TRgb iColor;
1.1003 +
1.1004 + /** The draw mode. */
1.1005 + CGraphicsContext::TDrawMode iDrawMode;
1.1006 + };
1.1007 +
1.1008 +/**
1.1009 +An accelerated graphics operation that fills a rectangular area with a pattern.
1.1010 +
1.1011 +The pattern consists of multiple copies of a bitmap, drawn tiled around an
1.1012 +origin. Objects of this class can be passed to a graphics accelerator's Operation()
1.1013 +function either individually, or in a buffer.
1.1014 +
1.1015 +@see TGopFillPattern
1.1016 +@publishedAll
1.1017 +@released
1.1018 +*/
1.1019 +class TGopFilledRectWithPattern : public TGraphicsOperation
1.1020 + {
1.1021 +public:
1.1022 + /** Constructor with a rectangle and a pattern.
1.1023 + @param aRect The rectangle to fill.
1.1024 + @param aPattern Specifies the handle to the bitmap to use for the pattern,
1.1025 + and the origin for the pattern. */
1.1026 + inline TGopFilledRectWithPattern(const TRect& aRect,TGopFillPattern aPattern)
1.1027 + : TGraphicsOperation(EFilledRectWithPattern,sizeof(*this)), iRect(aRect) , iPattern(aPattern) {}
1.1028 +public:
1.1029 +
1.1030 + /** The rectangle to fill. */
1.1031 + TRect iRect;
1.1032 +
1.1033 + /** Specifies the handle to the bitmap to use for the pattern and the origin for
1.1034 + the pattern. */
1.1035 + TGopFillPattern iPattern;
1.1036 + };
1.1037 +
1.1038 +/**
1.1039 +An accelerated graphics operation that inverts the colour of all pixels in
1.1040 +a rectangular area.
1.1041 +
1.1042 +Objects of this class can be passed to a graphics accelerator's Operation()
1.1043 +function either individually, or in a buffer.
1.1044 +@publishedAll
1.1045 +@released
1.1046 +*/
1.1047 +class TGopInvertRect : public TGraphicsOperation
1.1048 + {
1.1049 +public:
1.1050 + /** Constructor with a rectangle.
1.1051 + @param aRect The rectangle in which to invert the colours. */
1.1052 + inline TGopInvertRect(const TRect& aRect)
1.1053 + : TGraphicsOperation(EInvertRect,sizeof(*this)), iRect(aRect) {}
1.1054 +public:
1.1055 +
1.1056 + /** The rectangle in which to invert the colours. */
1.1057 + TRect iRect;
1.1058 + };
1.1059 +
1.1060 +/**
1.1061 +An accelerated graphics operation that fades the pixels in a rectangular area.
1.1062 +
1.1063 +Objects of this class can be passed to a graphics accelerator's Operation()
1.1064 +function either individually, or in a buffer.
1.1065 +@publishedAll
1.1066 +@released
1.1067 +*/
1.1068 +class TGopFadeRect : public TGraphicsOperation
1.1069 + {
1.1070 +public:
1.1071 + /** Constructor with a rectangle and fade parameters.
1.1072 + @param aRect The rectangle to fade.
1.1073 + @param aFade The fade parameters. */
1.1074 + inline TGopFadeRect(const TRect& aRect, const TGopFadeParams aFade)
1.1075 + : TGraphicsOperation(EFadeRect,sizeof(*this)), iRect(aRect), iFade(aFade) {}
1.1076 +public:
1.1077 +
1.1078 + /** The rectangle to fade. */
1.1079 + TRect iRect;
1.1080 +
1.1081 + /** The fade parameters. */
1.1082 + TGopFadeParams iFade;
1.1083 + };
1.1084 +
1.1085 +/**
1.1086 +An accelerated graphics operation that copies a rectangular region of one bitmap
1.1087 +into another.
1.1088 +
1.1089 +The data members are all initialised on construction. Objects of this class
1.1090 +can be passed to a graphics accelerator's Operation() function either individually,
1.1091 +or in a buffer.
1.1092 +@publishedAll
1.1093 +@released
1.1094 +*/
1.1095 +class TGopBitBlt : public TGraphicsOperation
1.1096 + {
1.1097 +public:
1.1098 + /** Constructor with a position, a source bitmap handle and a rectangle.
1.1099 + @param aDestination The destination for the top left hand corner of the portion
1.1100 + of the source bitmap.
1.1101 + @param aSourceBitmap A handle to the source bitmap, and other information needed
1.1102 + to draw it.
1.1103 + @param aSourceRect A rectangle within the source bitmap. Its coordinates are relative
1.1104 + to the top left of the source bitmap. Defines the part of the source bitmap to be copied. */
1.1105 + inline TGopBitBlt(const TPoint& aDestination, TAcceleratedBitmapSpec aSourceBitmap, TRect& aSourceRect)
1.1106 + : TGraphicsOperation(EBitBlt,sizeof(*this)), iDestination(aDestination), iSourceBitmap(aSourceBitmap), iSourceRect(aSourceRect) {}
1.1107 +public:
1.1108 +
1.1109 + /** The destination for the top left hand corner of the portion of the source bitmap. */
1.1110 + TPoint iDestination;
1.1111 +
1.1112 + /** A handle to the source bitmap, and other information needed to draw it. */
1.1113 + TAcceleratedBitmapSpec iSourceBitmap;
1.1114 +
1.1115 + /** A rectangle defining all or a part of the bitmap to be copied. */
1.1116 + TRect iSourceRect;
1.1117 + };
1.1118 +
1.1119 +/**
1.1120 +An accelerated graphics operation that copies a rectangular region of one bitmap
1.1121 +into another, using a third bitmap as a mask.
1.1122 +
1.1123 +The mask must be the same size as the source bitmap. The parts of the source
1.1124 +bitmap that are drawn are the areas that are black in the mask.
1.1125 +
1.1126 +The data members are all initialised on construction. Objects of this class
1.1127 +can be passed to a graphics accelerator's Operation() function either individually,
1.1128 +or in a buffer.
1.1129 +
1.1130 +@see TGraphicsAcceleratorCaps::iMaskType
1.1131 +@publishedAll
1.1132 +@released
1.1133 +*/
1.1134 +class TGopBitBltMasked : public TGraphicsOperation
1.1135 + {
1.1136 +public:
1.1137 + /** Constructor with a position, a source bitmap handle, a rectangle and a mask bitmap handle.
1.1138 + @param aDestination The destination for the top left hand corner of the portion
1.1139 + of the source bitmap.
1.1140 + @param aSourceBitmap A handle to the source bitmap, and other information needed
1.1141 + to draw it.
1.1142 + @param aSourceRect A rectangle within the source bitmap. Its coordinates are relative
1.1143 + to the top left of the bitmap. Defines the part of the source bitmap to be copied.
1.1144 + @param aMask A handle to the mask bitmap. The parts of the source bitmap
1.1145 + that are drawn are the areas that are black in the mask bitmap. */
1.1146 + inline TGopBitBltMasked(const TPoint& aDestination, TAcceleratedBitmapSpec aSourceBitmap, TRect& aSourceRect, TAcceleratedBitmapSpec aMask)
1.1147 + : TGraphicsOperation(EBitBltMasked,sizeof(*this)), iDestination(aDestination), iSourceBitmap(aSourceBitmap), iSourceRect(aSourceRect), iMask(aMask) {}
1.1148 +public:
1.1149 +
1.1150 + /** The destination for the top left hand corner of the portion of the bitmap. */
1.1151 + TPoint iDestination;
1.1152 +
1.1153 + /** A handle to the source bitmap, and other information needed to draw it. */
1.1154 + TAcceleratedBitmapSpec iSourceBitmap;
1.1155 +
1.1156 + /** A rectangle defining all or a part of the bitmap to be copied. */
1.1157 + TRect iSourceRect;
1.1158 +
1.1159 + /** A handle to the source bitmap mask. */
1.1160 + TAcceleratedBitmapSpec iMask;
1.1161 + };
1.1162 +
1.1163 +/**
1.1164 +An accelerated graphics operation that copies a rectangular region of one bitmap
1.1165 +into another, with some transparent pixels in the bitmap.
1.1166 +
1.1167 +The data members are all initialised on construction. Objects of this class
1.1168 +can be passed to a graphics accelerator's Operation() function either individually,
1.1169 +or in a buffer.
1.1170 +
1.1171 +@see TGraphicsAcceleratorCaps::iTransparency
1.1172 +@see TGopTransparency
1.1173 +@publishedAll
1.1174 +@released
1.1175 +*/
1.1176 +class TGopBitBltTransparent : public TGraphicsOperation
1.1177 + {
1.1178 +public:
1.1179 + /** Constructor with a destination, a handle to the source bitmap, a rectangle
1.1180 + and a specification for which pixels should be treated as transparent.
1.1181 +
1.1182 + @param aDestination The destination for the top left hand corner of the portion
1.1183 + of the source bitmap.
1.1184 + @param aSourceBitmap A handle to the source bitmap, and other information needed
1.1185 + to draw it.
1.1186 + @param aSourceRect A rectangle within the source bitmap. Its coordinates are
1.1187 + relative to the top left of the bitmap. Defines the part of the source bitmap to
1.1188 + be copied.
1.1189 + @param aTransparency A specification for which pixels in the source bitmap should
1.1190 + be treated as transparent. */
1.1191 + inline TGopBitBltTransparent(const TPoint& aDestination, TAcceleratedBitmapSpec aSourceBitmap, TRect& aSourceRect, TGopTransparency aTransparency)
1.1192 + : TGraphicsOperation(EBitBltTransparent,sizeof(*this)), iDestination(aDestination), iSourceBitmap(aSourceBitmap), iSourceRect(aSourceRect), iTransparency(aTransparency) {}
1.1193 +public:
1.1194 +
1.1195 + /** The destination for the top left hand corner of the portion of the bitmap. */
1.1196 + TPoint iDestination;
1.1197 +
1.1198 + /** A handle to the source bitmap, and other information needed to draw it. */
1.1199 + TAcceleratedBitmapSpec iSourceBitmap;
1.1200 +
1.1201 + /** A rectangle defining all or a part of the bitmap to be copied. */
1.1202 + TRect iSourceRect;
1.1203 +
1.1204 + /** A specification for which pixels should be treated as transparent. */
1.1205 + TGopTransparency iTransparency;
1.1206 + };
1.1207 +
1.1208 +/**
1.1209 +An accelerated graphics operation that copies a rectangular region of one bitmap
1.1210 +into another, using alpha blending.
1.1211 +
1.1212 +The alpha value is part of each pixel in the source bitmap. For instance,
1.1213 +a 32 bits per pixel bitmap may have 8 bits for each of the alpha, red, green
1.1214 +and blue values.
1.1215 +
1.1216 +Supported bitmap formats with an alpha-channel are given in by
1.1217 +TGraphicsAcceleratorCaps::iAlphaChannel.
1.1218 +
1.1219 +The data members are all initialised on construction. Objects of this class
1.1220 +can be passed to a graphics accelerator's Operation() function either individually,
1.1221 +or in a buffer.
1.1222 +
1.1223 +@see TGraphicsAcceleratorCaps::iAlphaChannel
1.1224 +@publishedAll
1.1225 +@released
1.1226 +*/
1.1227 +class TGopBitBltAlphaChannel : public TGraphicsOperation
1.1228 + {
1.1229 +public:
1.1230 + /** Constructor with a position, a bitmap handle and a rectangle.
1.1231 + @param aDestination The destination for the top left hand corner of the portion
1.1232 + of the source bitmap.
1.1233 + @param aSourceBitmap A handle to the source bitmap, and other information needed
1.1234 + to draw it.
1.1235 + @param aSourceRect A rectangle within the source bitmap. Its coordinates are relative
1.1236 + to the top left of the source bitmap. Defines the part of the source bitmap to be copied. */
1.1237 + inline TGopBitBltAlphaChannel(const TPoint& aDestination, TAcceleratedBitmapSpec aSourceBitmap, TRect& aSourceRect)
1.1238 + : TGraphicsOperation(EBitBltAlphaChannel,sizeof(*this)), iDestination(aDestination), iSourceBitmap(aSourceBitmap), iSourceRect(aSourceRect) {}
1.1239 +public:
1.1240 +
1.1241 + /** The destination for the top left hand corner of the portion of the bitmap. */
1.1242 + TPoint iDestination;
1.1243 +
1.1244 + /** A handle to the source bitmap, and other information needed to access it. */
1.1245 + TAcceleratedBitmapSpec iSourceBitmap;
1.1246 +
1.1247 + /** A rectangle defining all or a part of the bitmap to be copied. */
1.1248 + TRect iSourceRect;
1.1249 + };
1.1250 +
1.1251 +/**
1.1252 +An accelerated graphics operation that copies a rectangular region of one bitmap
1.1253 +into another using alpha blending values provided in a third bitmap.
1.1254 +
1.1255 +The way alpha blending works is as follows: if the alpha value is the maximum,
1.1256 +the source pixel is opaque, in other words, the full colour of the pixel is
1.1257 +written to the destination. If the alpha value is zero, the source pixel is
1.1258 +fully transparent, and the destination is left unaltered. Values in-between
1.1259 +cause blending with the following formula:
1.1260 +
1.1261 +Destination = Source*Alpha/max_Alpha + Destination*(max_Alpha-Alpha)/max_Alpha
1.1262 +
1.1263 +Colour alpha-bitmaps specify red, green and blue alpha values for each pixel,
1.1264 +greyscale bitmaps specify a single alpha value for each pixel. The maximum
1.1265 +alpha value depends on the bitmap's display mode. For example, 255 is the
1.1266 +maximum for an EGray256 or EColor16M bitmap. The maximum is less for bitmaps
1.1267 +which use fewer bits per colour component.
1.1268 +
1.1269 +Supported bitmap formats than can be used as alpha bitmaps are given in
1.1270 +TGraphicsAcceleratorCaps::iAlphaBitmap.
1.1271 +
1.1272 +Objects of this class can be passed to a graphics accelerator's Operation()
1.1273 +function either individually, or in a buffer.
1.1274 +
1.1275 +@see TGraphicsAcceleratorCaps::iAlphaBitmap
1.1276 +@publishedAll
1.1277 +@released
1.1278 +*/
1.1279 +class TGopBitBltAlphaBitmap : public TGraphicsOperation
1.1280 + {
1.1281 +public:
1.1282 + /** Constructor with a position, two bitmap specs and a rectangle.
1.1283 + @param aDestination The destination for the top left hand corner of the portion
1.1284 + of the source bitmap.
1.1285 + @param aSourceBitmap A handle to the source bitmap, and other information needed
1.1286 + to draw it.
1.1287 + @param aSourceRect A rectangle within the source bitmap. Its coordinates are relative
1.1288 + to the top left of the source bitmap. Defines the part of the source bitmap to be copied.
1.1289 + @param aAlphaBitmap A handle to the alpha bitmap, the bitmap that contains
1.1290 + alpha blending values. */
1.1291 + inline TGopBitBltAlphaBitmap(const TPoint& aDestination, TAcceleratedBitmapSpec aSourceBitmap, TRect& aSourceRect, TAcceleratedBitmapSpec aAlphaBitmap)
1.1292 + : TGraphicsOperation(EBitBltAlphaBitmap,sizeof(*this)), iDestination(aDestination), iSourceBitmap(aSourceBitmap), iSourceRect(aSourceRect), iAlphaBitmap(aAlphaBitmap) {}
1.1293 +public:
1.1294 +
1.1295 + /** The destination for the top left hand corner of the portion of the source bitmap. */
1.1296 + TPoint iDestination;
1.1297 +
1.1298 + /** A handle to the source bitmap, and other information needed to access it. */
1.1299 + TAcceleratedBitmapSpec iSourceBitmap;
1.1300 +
1.1301 + /** A rectangle defining the part of the source bitmap to be copied. */
1.1302 + TRect iSourceRect;
1.1303 +
1.1304 + /** A handle to the alpha bitmap, the bitmap that contains alpha blending values. */
1.1305 + TAcceleratedBitmapSpec iAlphaBitmap;
1.1306 + };
1.1307 +
1.1308 +/**
1.1309 +An accelerated graphics operation that copies a rectangular region of two bitmaps
1.1310 +to a destination, using alpha blending values provided in a third bitmap to blend the
1.1311 +corresponding entries in the first and second bitmaps.
1.1312 +
1.1313 +The way alpha blending works is as follows: if the alpha value is the maximum,
1.1314 +the pixel from the first source is opaque, in other words, the full colour of
1.1315 +the pixel is written to the destination. If the alpha value is zero, the pixel
1.1316 +from the first source is fully transparent, in other words, the full colour of
1.1317 +the pixel in the second source is used. Values in-between cause blending with
1.1318 +the following formula:
1.1319 +
1.1320 +Destination = Source1*Alpha/max_Alpha + Source2*(max_Alpha-Alpha)/max_Alpha
1.1321 +
1.1322 +Colour alpha bitmaps specify red, green and blue alpha values for each pixel,
1.1323 +greyscale bitmaps specify a single alpha value for each pixel. The maximum
1.1324 +alpha value depends on the bitmap's display mode. For example, 255 is the
1.1325 +maximum for an EGray256 or EColor16M bitmap. The maximum is less for bitmaps
1.1326 +which use fewer bits per colour component.
1.1327 +
1.1328 +Supported bitmap formats than can be used as alpha bitmaps are given in
1.1329 +TGraphicsAcceleratorCaps::iAlphaBitmap.
1.1330 +
1.1331 +Objects of this class can be passed to a graphics accelerator's Operation()
1.1332 +function either individually, or in a buffer.
1.1333 +
1.1334 +@see TGraphicsAcceleratorCaps::iAlphaBitmap
1.1335 +@publishedAll
1.1336 +@released
1.1337 +*/
1.1338 +class TGopAlphaBlendTwoBitmaps : public TGraphicsOperation
1.1339 + {
1.1340 +public:
1.1341 + /**
1.1342 + Constructor with a position, three bitmap specs and a rectangle.
1.1343 + @param aDestination The destination for the top left hand corner of the portion
1.1344 + of the source bitmaps.
1.1345 + @param aSourceBmp1 A handle to the first of the source bitmaps, and other information
1.1346 + needed to draw it.
1.1347 + @param aSourceBmp2 A handle to the second of the source bitmaps, and other information
1.1348 + needed to draw it.
1.1349 + @param aSourceRect A rectangle within the source bitmaps. Its coordinates are relative
1.1350 + to the top left of the bitmap. Defines the part of the bitmap to be copied.
1.1351 + @param aSourcePt2 The point in the second source bitmap from which we take pixels to blend
1.1352 + @param aAlphaBitmap A handle to the alpha bitmap, the bitmap that contains
1.1353 + alpha blending values.
1.1354 + @param aAlphaPt The point in the alpha bitmap from which we take pixels to blend
1.1355 + */
1.1356 + inline TGopAlphaBlendTwoBitmaps(const TPoint& aDestination,TAcceleratedBitmapSpec aSourceBmp1,TAcceleratedBitmapSpec aSourceBmp2,TRect& aSourceRect,const TPoint& aSrcPt2,TAcceleratedBitmapSpec aAlphaBmp, const TPoint& aAlphaPt)
1.1357 + : TGraphicsOperation(EAlphaBlendTwoBitmaps,sizeof(*this)), iDestination(aDestination), iSourceBmp1(aSourceBmp1), iSourceBmp2(aSourceBmp2), iSourceRect(aSourceRect), iSrcPt2(aSrcPt2), iAlphaBmp(aAlphaBmp), iAlphaPt(aAlphaPt) {}
1.1358 +public:
1.1359 +
1.1360 + /** The destination for the top left hand corner of the portion of the source bitmaps. */
1.1361 + TPoint iDestination;
1.1362 +
1.1363 + /** A handle to the first source bitmap, and other information needed to access it. */
1.1364 + TAcceleratedBitmapSpec iSourceBmp1;
1.1365 +
1.1366 + /** A handle to the second source bitmap, and other information needed to access it. */
1.1367 + TAcceleratedBitmapSpec iSourceBmp2;
1.1368 +
1.1369 + /** A rectangle defining the part of the source bitmaps to be copied. */
1.1370 + TRect iSourceRect;
1.1371 +
1.1372 + /** The point in the second source bitmap from which we take pixels to blend. */
1.1373 + TPoint iSrcPt2;
1.1374 +
1.1375 + /** A handle to the alpha bitmap, the bitmap that contains alpha blending values. */
1.1376 + TAcceleratedBitmapSpec iAlphaBmp;
1.1377 +
1.1378 + /** The point in the alpha bitmap from which we take pixels to blend. */
1.1379 + TPoint iAlphaPt;
1.1380 + };
1.1381 +
1.1382 +/**
1.1383 +An accelerated graphics operation that copies a rectangular region of a bitmap blended
1.1384 +with the screen image to the screen, using alpha blending values provided in an alpha bitmap
1.1385 +to blend the corresponding entries in the bitmap and on the screen.
1.1386 +
1.1387 +The way alpha blending works is as follows: if the alpha value is the maximum,
1.1388 +the pixel from the source bitmap is opaque, in other words, the full colour of
1.1389 +the pixel is written to the destination. If the alpha value is zero, the pixel
1.1390 +from the source bitmap is fully transparent, in other words, the full colour of
1.1391 +the pixel on the screen is used. Values in-between cause blending with the
1.1392 +following formula:
1.1393 +
1.1394 +Destination = Source*Alpha/max_Alpha + Screen*(max_Alpha-Alpha)/max_Alpha
1.1395 +
1.1396 +Colour alpha bitmaps specify red, green and blue alpha values for each pixel,
1.1397 +greyscale bitmaps specify a single alpha value for each pixel. The maximum
1.1398 +alpha value depends on the bitmap's display mode. For example, 255 is the
1.1399 +maximum for an EGray256 or EColor16M bitmap. The maximum is less for bitmaps
1.1400 +which use fewer bits per colour component.
1.1401 +
1.1402 +Supported bitmap formats than can be used as alpha bitmaps are given in
1.1403 +TGraphicsAcceleratorCaps::iAlphaBitmap.
1.1404 +
1.1405 +Objects of this class can be passed to a graphics accelerator's Operation()
1.1406 +function either individually, or in a buffer.
1.1407 +
1.1408 +@see TGraphicsAcceleratorCaps::iAlphaBitmap
1.1409 +@publishedAll
1.1410 +@released
1.1411 +*/
1.1412 +class TGopAlphaBlendOneBitmap : public TGraphicsOperation
1.1413 + {
1.1414 +public:
1.1415 + /**
1.1416 + Constructor with a position, two bitmap specs and a rectangle.
1.1417 + @param aDestination The destination for the top left hand corner of the portion
1.1418 + of the source bitmap.
1.1419 + @param aSourceBmp A handle to the source bitmap, and other information needed
1.1420 + to draw it.
1.1421 + @param aSourceRect A rectangle within the source bitmap. Its coordinates are relative
1.1422 + to the top left of the source bitmap. Defines the part of the source bitmap to be copied.
1.1423 + @param aAlphaBitmap A handle to the alpha bitmap, the bitmap that contains
1.1424 + alpha blending values.
1.1425 + @param aAlphaPt The point in the alpha bitmap from which we take pixels to blend
1.1426 + */
1.1427 +
1.1428 +
1.1429 + inline TGopAlphaBlendOneBitmap(const TPoint& aDestination,TAcceleratedBitmapSpec aSourceBmp,TRect& aSourceRect,TAcceleratedBitmapSpec aAlphaBmp, const TPoint& aAlphaPt)
1.1430 + : TGraphicsOperation(EAlphaBlendOneBitmap,sizeof(*this)), iDestination(aDestination), iSourceBmp(aSourceBmp), iSourceRect(aSourceRect), iAlphaBmp(aAlphaBmp), iAlphaPt(aAlphaPt) {}
1.1431 +public:
1.1432 +
1.1433 + /** The destination for the top left hand corner of the portion of the source bitmap. */
1.1434 + TPoint iDestination;
1.1435 +
1.1436 + /** A handle to the source bitmap, and other information needed to access it. */
1.1437 + TAcceleratedBitmapSpec iSourceBmp;
1.1438 +
1.1439 + /** A rectangle defining the part of the bitmap to be copied. */
1.1440 + TRect iSourceRect;
1.1441 +
1.1442 + /** A handle to the alpha bitmap, the bitmap that contains alpha blending values. */
1.1443 + TAcceleratedBitmapSpec iAlphaBmp;
1.1444 +
1.1445 + /** Position of the first pixel in the alpha bitmap to be used for alpha blending. */
1.1446 + TPoint iAlphaPt;
1.1447 + };
1.1448 +
1.1449 +/**
1.1450 +An accelerated graphics operation that copies a rectangular region of one bitmap
1.1451 +into a different sized region of another.
1.1452 +
1.1453 +The data members are all initialised on construction. Objects of this class
1.1454 +can be passed to a graphics accelerator's Operation() function either individually,
1.1455 +or in a buffer.
1.1456 +@publishedAll
1.1457 +@released
1.1458 +*/
1.1459 +class TGopScaledBitBlt : public TGraphicsOperation
1.1460 + {
1.1461 +public:
1.1462 + /** Constructor with a destination rectangle, a handle to the source bitmap and
1.1463 + a source rectangle.
1.1464 + @param aDestination The destination for the portion of the source bitmap. If necessary,
1.1465 + the source bitmap portion is resized to fit into this rectangle.
1.1466 + @param aSourceBitmap A handle to the source bitmap, and other information needed
1.1467 + to draw it.
1.1468 + @param aSourceRect A rectangle within the source bitmap. Its coordinates are relative
1.1469 + to the top left of the source bitmap. Defines the part of the source bitmap to be copied. */
1.1470 + inline TGopScaledBitBlt(const TRect& aDestination, TAcceleratedBitmapSpec aSourceBitmap, TRect& aSourceRect)
1.1471 + : TGraphicsOperation(EScaledBitBlt,sizeof(*this)), iDestination(aDestination), iSourceBitmap(aSourceBitmap), iSourceRect(aSourceRect) {}
1.1472 +public:
1.1473 +
1.1474 + /** The destination rectangle for the portion of the source bitmap. */
1.1475 + TRect iDestination;
1.1476 +
1.1477 + /** A handle to the source bitmap. */
1.1478 + TAcceleratedBitmapSpec iSourceBitmap;
1.1479 +
1.1480 + /** A rectangle defining all or a part of the source bitmap to be copied. */
1.1481 + TRect iSourceRect;
1.1482 + };
1.1483 +
1.1484 +/**
1.1485 +An accelerated graphics operation that copies a rectangular region of one bitmap
1.1486 +into a different sized region of another, using a third bitmap as a mask.
1.1487 +
1.1488 +The mask must be the same size as the source bitmap. The parts of the source
1.1489 +bitmap that are drawn are the areas that are black in the mask.
1.1490 +
1.1491 +The data members are all initialised on construction. Objects of this class
1.1492 +can be passed to a graphics accelerator's Operation() function either individually,
1.1493 +or in a buffer.
1.1494 +
1.1495 +@see TGraphicsAcceleratorCaps::iMaskType
1.1496 +@publishedAll
1.1497 +@released
1.1498 +*/
1.1499 +class TGopScaledBitBltMasked : public TGraphicsOperation
1.1500 + {
1.1501 +public:
1.1502 + /** Constructor with a source and destination rectangle, and handles to the source
1.1503 + and mask bitmaps.
1.1504 +
1.1505 + @param aDestination The destination for the portion of the source bitmap. If necessary,
1.1506 + the source bitmap portion is resized to fit into this rectangle.
1.1507 + @param aSourceBitmap A handle to the source bitmap, and other information needed
1.1508 + to draw it.
1.1509 + @param aSourceRect A rectangle within the source bitmap. Its coordinates are relative
1.1510 + to the top left of the source bitmap. Defines the part of the source bitmap to be copied.
1.1511 + @param aMask A handle to the mask bitmap. */
1.1512 + inline TGopScaledBitBltMasked(const TRect& aDestination, TAcceleratedBitmapSpec aSourceBitmap, TRect& aSourceRect, TAcceleratedBitmapSpec aMask)
1.1513 + : TGraphicsOperation(EScaledBitBltMasked,sizeof(*this)), iDestination(aDestination), iSourceBitmap(aSourceBitmap), iSourceRect(aSourceRect), iMask(aMask) {}
1.1514 +public:
1.1515 +
1.1516 + /** The destination rectangle for the portion of the bitmap. */
1.1517 + TRect iDestination;
1.1518 +
1.1519 + /** A handle to the source bitmap. */
1.1520 + TAcceleratedBitmapSpec iSourceBitmap;
1.1521 +
1.1522 + /** A rectangle defining all or a part of the source bitmap to be copied. */
1.1523 + TRect iSourceRect;
1.1524 +
1.1525 + /** A handle to the source bitmap mask. */
1.1526 + TAcceleratedBitmapSpec iMask;
1.1527 + };
1.1528 +
1.1529 +/**
1.1530 +An accelerated graphics operation that copies a rectangular region of one bitmap
1.1531 +into a different sized region of another, with some transparent pixels in
1.1532 +the source bitmap.
1.1533 +
1.1534 +The data members are all initialised on construction. Objects of this class
1.1535 +can be passed to a graphics accelerator's Operation() function either individually,
1.1536 +or in a buffer.
1.1537 +
1.1538 +@see TGraphicsAcceleratorCaps::iTransparency
1.1539 +@see TGopTransparency
1.1540 +@publishedAll
1.1541 +@released
1.1542 +*/
1.1543 +class TGopScaledBitBltTransparent : public TGraphicsOperation
1.1544 + {
1.1545 +public:
1.1546 + /** Constructor with destination and source rectangles, a handle to the source
1.1547 + bitmap and a specification for which pixels should be treated as transparent.
1.1548 +
1.1549 + @param aDestination The destination for the portion of the source bitmap. If necessary,
1.1550 + the source bitmap portion is resized to fit into this rectangle.
1.1551 + @param aSourceBitmap A handle to the source bitmap, and other information needed
1.1552 + to draw it.
1.1553 + @param aSourceRect A rectangle within the source bitmap. Its coordinates are
1.1554 + relative to the top left of the source bitmap. Defines the part of the source bitmap to
1.1555 + be copied.
1.1556 + @param aTransparency A specification for which pixels in the source bitmap should be treated as
1.1557 + transparent. */
1.1558 + inline TGopScaledBitBltTransparent(const TRect& aDestination, TAcceleratedBitmapSpec aSourceBitmap, TRect& aSourceRect, TGopTransparency aTransparency)
1.1559 + : TGraphicsOperation(EScaledBitBltTransparent,sizeof(*this)), iDestination(aDestination), iSourceBitmap(aSourceBitmap), iSourceRect(aSourceRect), iTransparency(aTransparency) {}
1.1560 +public:
1.1561 +
1.1562 + /** The destination rectangle for the portion of the source bitmap. */
1.1563 + TRect iDestination;
1.1564 +
1.1565 + /** A handle to the source bitmap. */
1.1566 + TAcceleratedBitmapSpec iSourceBitmap;
1.1567 +
1.1568 + /** A rectangle defining all or a part of the source bitmap to be copied. */
1.1569 + TRect iSourceRect;
1.1570 +
1.1571 + /** A specification for which pixels in the source bitmap should be treated as transparent. */
1.1572 + TGopTransparency iTransparency;
1.1573 + };
1.1574 +
1.1575 +/**
1.1576 +An accelerated graphics operation that copies a rectangular region of one bitmap
1.1577 +into a different sized region of another using alpha blending. The alpha value
1.1578 +is part of each pixel in the source bitmap.
1.1579 +
1.1580 +Supported bitmap formats with an alpha-channel are given in by
1.1581 +TGraphicsAcceleratorCaps::iAlphaChannel.
1.1582 +
1.1583 +The data members are all initialised on construction. Objects of this class
1.1584 +can be passed to a graphics accelerator's Operation() function either individually,
1.1585 +or in a buffer.
1.1586 +
1.1587 +@see TGraphicsAcceleratorCaps::iAlphaChannel
1.1588 +@publishedAll
1.1589 +@released
1.1590 +*/
1.1591 +class TGopScaledBitBltAlphaChannel : public TGraphicsOperation
1.1592 + {
1.1593 +public:
1.1594 + /** Constructor with a destination rectangle, a handle to the source bitmap and
1.1595 + a source rectangle.
1.1596 +
1.1597 + @param aDestination The destination for the portion of the source bitmap. If necessary,
1.1598 + the source bitmap portion is resized to fit into this rectangle.
1.1599 + @param aSourceBitmap A handle to the source bitmap, and other information needed
1.1600 + to draw it.
1.1601 + @param aSourceRect A rectangle within the source bitmap. Its coordinates are relative
1.1602 + to the top left of the source bitmap. Defines the part of the source bitmap to be copied. */
1.1603 + inline TGopScaledBitBltAlphaChannel(const TRect& aDestination, TAcceleratedBitmapSpec aSourceBitmap, TRect& aSourceRect)
1.1604 + : TGraphicsOperation(EScaledBitBltAlphaChannel,sizeof(*this)), iDestination(aDestination), iSourceBitmap(aSourceBitmap), iSourceRect(aSourceRect) {}
1.1605 +public:
1.1606 +
1.1607 + /** The destination for the portion of the source bitmap. */
1.1608 + TRect iDestination;
1.1609 +
1.1610 + /** A handle to the source bitmap, and other information needed to draw it. */
1.1611 + TAcceleratedBitmapSpec iSourceBitmap;
1.1612 +
1.1613 + /** A rectangle defining the part of the source bitmap to be copied. */
1.1614 + TRect iSourceRect;
1.1615 + };
1.1616 +
1.1617 +/**
1.1618 +An accelerated graphics operation that copies a rectangular region of one bitmap
1.1619 +into a different sized region of another using alpha blending values provided
1.1620 +in a third bitmap.
1.1621 +
1.1622 +The data members are all initialised on construction. Objects of this class
1.1623 +can be passed to a graphics accelerator's Operation() function either individually,
1.1624 +or in a buffer.
1.1625 +
1.1626 +@see TGraphicsAcceleratorCaps::iAlphaBitmap
1.1627 +@publishedAll
1.1628 +@released
1.1629 +*/
1.1630 +class TGopScaledBitBltAlphaBitmap : public TGraphicsOperation
1.1631 + {
1.1632 +public:
1.1633 + /** Constructor with a source and destination rectangle and two bitmap handles.
1.1634 +
1.1635 + @param aDestination The destination for the portion of the source bitmap. If necessary,
1.1636 + the source bitmap portion is resized to fit into this rectangle.
1.1637 + @param aSourceBitmap A handle to the source bitmap, and other information needed
1.1638 + to draw it.
1.1639 + @param aSourceRect A rectangle within the source bitmap. Its coordinates are relative
1.1640 + to the top left of the source bitmap. Defines the part of the source bitmap to be copied.
1.1641 + @param aAlphaBitmap A handle to the bitmap that contains alpha blending values. */
1.1642 + inline TGopScaledBitBltAlphaBitmap(const TRect& aDestination, TAcceleratedBitmapSpec aSourceBitmap, TRect& aSourceRect, TAcceleratedBitmapSpec aAlphaBitmap)
1.1643 + : TGraphicsOperation(EScaledBitBltAlphaBitmap,sizeof(*this)), iDestination(aDestination), iSourceBitmap(aSourceBitmap), iSourceRect(aSourceRect), iAlphaBitmap(aAlphaBitmap) {}
1.1644 +public:
1.1645 +
1.1646 + /** The destination for the portion of the bitmap. */
1.1647 + TRect iDestination;
1.1648 +
1.1649 + /** A handle to the source bitmap, and other information needed to draw it. */
1.1650 + TAcceleratedBitmapSpec iSourceBitmap;
1.1651 +
1.1652 + /** A rectangle defining the part of the source bitmap to be copied. */
1.1653 + TRect iSourceRect;
1.1654 +
1.1655 + /** A handle to the bitmap that contains alpha blending values. */
1.1656 + TAcceleratedBitmapSpec iAlphaBitmap;
1.1657 + };
1.1658 +
1.1659 +/**
1.1660 +An accelerated graphics operation that fills a polygon with a colour.
1.1661 +
1.1662 +AddPoints() must be called to specify the polygon to be filled. Objects of
1.1663 +this class can be passed to a graphics accelerator's Operation() function
1.1664 +either individually, or in a buffer.
1.1665 +
1.1666 +How a graphics accelerator can fill polygons is given by TGraphicsAcceleratorCaps::iPolygon.
1.1667 +
1.1668 +@see TGraphicsAcceleratorCaps::iPolygon
1.1669 +@publishedAll
1.1670 +@released
1.1671 +*/
1.1672 +class TGopFilledPolygon : public TGraphicsOperation
1.1673 + {
1.1674 +public:
1.1675 + /** Constructor with a fill rule and a fill colour. The number of points is initialised
1.1676 + to zero.
1.1677 +
1.1678 + @param aColor The fill colour.
1.1679 + @param aFillRule Bit flags for how self-crossing polygons are filled. */
1.1680 + inline TGopFilledPolygon(TRgb aColor, CGraphicsContext::TFillRule aFillRule)
1.1681 + : TGraphicsOperation(EFilledPolygon,sizeof(*this)), iColor(aColor), iFillRule(aFillRule), iNumPoints(0) {}
1.1682 + inline void AddPoints(TInt aNumPoints, TPoint* aPoints);
1.1683 +public:
1.1684 +
1.1685 + /** The fill colour. */
1.1686 + TRgb iColor;
1.1687 +
1.1688 + /** Bit flags for how self-crossing polygons are filled.
1.1689 +
1.1690 + @see CGraphicsContext::TFillRule */
1.1691 + CGraphicsContext::TFillRule iFillRule;
1.1692 +
1.1693 + /** The number of points in the polygon. */
1.1694 + TInt iNumPoints;
1.1695 + };
1.1696 +
1.1697 +/** Specifies the polygon to be filled as a number of 2D point coordinates.
1.1698 +
1.1699 +AddPoints() should only be called once the TGopFilledPolygon object has been stored
1.1700 +into a buffer. There must be enough room in the buffer after the TGopFilledPolygon
1.1701 +object to hold aNumPoints TPoint sized structures. This is because the points are
1.1702 +copied into the memory space directly following the TGopFilledPolygon object.
1.1703 +
1.1704 +@param aNumPoints The number of points in the polygon.
1.1705 +@param aPoints Pointer to the first point in the polygon. */
1.1706 +inline void TGopFilledPolygon::AddPoints(TInt aNumPoints, TPoint* aPoints)
1.1707 + { Append(aNumPoints*sizeof(TPoint),aPoints); iNumPoints += aNumPoints; }
1.1708 +
1.1709 +/**
1.1710 +An accelerated graphics operation that fills a polygon with a pattern held
1.1711 +in another bitmap.
1.1712 +
1.1713 +AddPoints() must be called to specify the polygon to be filled. Objects of
1.1714 +this class can be passed to a graphics accelerator's Operation() function
1.1715 +either individually, or in a buffer.
1.1716 +
1.1717 +@see TGraphicsAcceleratorCaps::iPolygon
1.1718 +@see TGopFillPattern
1.1719 +@publishedAll
1.1720 +@released
1.1721 +*/
1.1722 +class TGopFilledPolygonWithPattern : public TGraphicsOperation
1.1723 + {
1.1724 +public:
1.1725 + /** Constructor with a fill pattern and a fill rule. The number of points is initialised
1.1726 + to zero.
1.1727 +
1.1728 + @param aPattern The fill pattern.
1.1729 + @param aFillRule Bit flags for how self-crossing polygons are filled. */
1.1730 + inline TGopFilledPolygonWithPattern(TGopFillPattern aPattern, CGraphicsContext::TFillRule aFillRule)
1.1731 + : TGraphicsOperation(EFilledPolygonWithPattern,sizeof(*this)), iPattern(aPattern), iFillRule(aFillRule), iNumPoints(0) {}
1.1732 + inline void AddPoints(TInt aNumPoints, TPoint* aPoints);
1.1733 +public:
1.1734 +
1.1735 + /** The pattern of bitmaps that is used to fill the polygon. */
1.1736 + TGopFillPattern iPattern;
1.1737 +
1.1738 + /** Bit flags for how self-crossing polygons are filled.
1.1739 +
1.1740 + @see CGraphicsContext::TFillRule */
1.1741 + CGraphicsContext::TFillRule iFillRule;
1.1742 +
1.1743 + /** The number of points in the polygon. */
1.1744 + TInt iNumPoints;
1.1745 + };
1.1746 +
1.1747 +/** Specifies the polygon to be filled as a number of 2D point coordinates.
1.1748 +
1.1749 +AddPoints() should only be called once the TGopFilledPolygonWithPattern object has been stored
1.1750 +into a buffer. There must be enough room in the buffer after the TGopFilledPolygonWithPattern
1.1751 +object to hold aNumPoints TPoint sized structures. This is because the points are
1.1752 +copied into the memory space directly following the TGopFilledPolygonWithPattern object.
1.1753 +
1.1754 +@param aNumPoints The number of points in the polygon.
1.1755 +@param aPoints Pointer to the first point in the polygon. */
1.1756 +inline void TGopFilledPolygonWithPattern::AddPoints(TInt aNumPoints, TPoint* aPoints)
1.1757 + { Append(aNumPoints*sizeof(TPoint),aPoints); iNumPoints += aNumPoints; }
1.1758 +
1.1759 +
1.1760 +
1.1761 +#endif