graphicsdeviceinterface/screendriver/inc/BITDRAW.H
changeset 0 5d03bc08d59c
equal deleted inserted replaced
-1:000000000000 0:5d03bc08d59c
       
     1 // Copyright (c) 1997-2009 Nokia Corporation and/or its subsidiary(-ies).
       
     2 // All rights reserved.
       
     3 // This component and the accompanying materials are made available
       
     4 // under the terms of "Eclipse Public License v1.0"
       
     5 // which accompanies this distribution, and is available
       
     6 // at the URL "http://www.eclipse.org/legal/epl-v10.html".
       
     7 //
       
     8 // Initial Contributors:
       
     9 // Nokia Corporation - initial contribution.
       
    10 //
       
    11 // Contributors:
       
    12 //
       
    13 // Description:
       
    14 //
       
    15 
       
    16 #ifndef __BITDRAW_H__
       
    17 #define __BITDRAW_H__
       
    18 
       
    19 #include <gdi.h>
       
    20 #include <e32event_private.h>
       
    21 
       
    22 /**
       
    23 @publishedPartner
       
    24 @released
       
    25 */
       
    26 enum TScreenDriverPanic
       
    27 	{
       
    28 	EScreenDriverPanicNoDevicePresent=1,
       
    29 	EScreenDriverPanicInvalidParameter,
       
    30 	EScreenDriverPanicInvalidDisplayMode,
       
    31 	EScreenDriverPanicInvalidWindowHandle,
       
    32 	EScreenDriverPanicOutOfBounds,
       
    33 	EScreenDriverPanicZeroLength,
       
    34 	EScreenDriverPanicNullPointer,
       
    35 	EScreenDriverPanicInvalidPointer,
       
    36 	EScreenDriverPanicAlphaBlendInvariant,
       
    37 	EScreenDriverPanicIvalidMethodCall,
       
    38 	EScreenDriverPanicInvalidSize,
       
    39 	EScreenDriverPanicInvalidHalValue,
       
    40 	EScreenDriverPanicInvalidScreenNo,
       
    41 	EScreenDriverPanicIncompatiblePreviousDevice		//<The previous device in SetDisplayMode was not compatible
       
    42 	};
       
    43 
       
    44 /**
       
    45 @publishedPartner
       
    46 @released
       
    47 */
       
    48 GLREF_C void Panic(TScreenDriverPanic aPanicCode);
       
    49 
       
    50 
       
    51 /**
       
    52 @publishedPartner
       
    53 @released
       
    54 */
       
    55 class CFbsDrawDevice : public CBase
       
    56 	{
       
    57 public:
       
    58 	/**
       
    59 	Defines possible Shadowmode values
       
    60 	*/
       
    61 	enum TShadowMode
       
    62 		{
       
    63 		/** No Shadow mode is supported.
       
    64 		*/
       
    65 		ENoShadow	= 0x0,
       
    66 		/** Shadow mode is supported. 
       
    67 		*/
       
    68 		EShadow		= 0x1,
       
    69 		/** Faded mode is supported.
       
    70 		*/
       
    71 		EFade		= 0x2,
       
    72 		/** Shadow and faded mode is supported. 
       
    73 		*/
       
    74 		EShadowFade	= 0x3
       
    75 		};
       
    76 	/**
       
    77 	Defines possible rotation values
       
    78 	*/
       
    79 	enum TOrientation
       
    80 		{
       
    81 		/** Normal orientation is supported. 
       
    82 		*/
       
    83 		EOrientationNormal,
       
    84 		/** A 90 degree rotation is supported. 
       
    85 		*/
       
    86 		EOrientationRotated90,
       
    87 		/** A 180 degree rotation is supported. 
       
    88 		*/
       
    89 		EOrientationRotated180,
       
    90 		/** A 270 degree rotation is supported. 
       
    91 		*/
       
    92 		EOrientationRotated270
       
    93 		};
       
    94 public:
       
    95    	/** 
       
    96    	DEPRECATED: Use NewScreenDeviceL(TInt aScreenNo, TDisplayMode aDispMode)
       
    97    	
       
    98 	@deprecated
       
    99 	*/
       
   100 	IMPORT_C static CFbsDrawDevice* NewScreenDeviceL(TScreenInfoV01 aInfo,TDisplayMode aDispMode);
       
   101 	
       
   102 	/**
       
   103 	Creates a new screen device instance, which implements CFbsDrawDevice interface.
       
   104 	The method has to be implemented for each type of supported video hardware.
       
   105 	@param aScreenNo    Screen number
       
   106 	@param aDispMode    Requested display mode
       
   107 	@return A pointer to just created screen device, which implements CFbsDrawDevice interface
       
   108 	@leave 	KErrNoMemory Not enough memory
       
   109 	KErrNotSupported The requested screen device type is not supported
       
   110 	*/
       
   111 	IMPORT_C static CFbsDrawDevice* NewScreenDeviceL(TInt aScreenNo, TDisplayMode aDispMode);
       
   112 	
       
   113 	/** 
       
   114 	DEPRECATED: Use NewBitmapDeviceL(const TSize& aSize, TDisplayMode aDispMode, TInt aDataStride)
       
   115 	
       
   116 	@deprecated 
       
   117 	*/
       
   118 	IMPORT_C static CFbsDrawDevice* NewBitmapDeviceL(TScreenInfoV01 aInfo, TDisplayMode aDispMode, TInt aDataStride);
       
   119 	
       
   120 	/**	
       
   121 	Creates a new bitmap device instance, which implements CFbsDrawDevice interface.
       
   122 	
       
   123 	@param  aSize       Bitmap device size
       
   124 	@param  aDispMode   Bitmap display mode
       
   125 	@param  aDataStride Bitmap data stride 
       
   126 	@return A pointer to just created bitmap device, which implements CFbsDrawDevice interface
       
   127 	@leave	KErrNoMemory Not enough memory
       
   128 	KErrArgument Invalid aSize value
       
   129 	*/
       
   130 	IMPORT_C static CFbsDrawDevice* NewBitmapDeviceL(const TSize& aSize, TDisplayMode aDispMode, TInt aDataStride);
       
   131 	
       
   132 	/**	
       
   133 	Depending on current graphics hardware the method will return one of 
       
   134 	two possible 16M video modes: 
       
   135 	EColor16M or EColor16MU. If the hardware doesn't support EColor16M 
       
   136 	or EColor16MU mode, the return value will be ENone.
       
   137 	
       
   138 	@return	EColor16M, EColor16MU or ENone.	
       
   139 	ENone - it means that current hardware doesn't support 16M color mode.
       
   140 	*/
       
   141 	IMPORT_C static TDisplayMode DisplayMode16M();
       
   142 
       
   143 	/**
       
   144 	Return the display mode of the device.
       
   145 	@return Display mode
       
   146 	*/
       
   147 	virtual TDisplayMode DisplayMode() const = 0;
       
   148 
       
   149 	/**
       
   150 	Scanline width in pixels. 
       
   151 	The return value can be greater or equal than iSize.iWidth, because
       
   152 	the scan line memory is allocated in 32-bit words and can be rounded up, if
       
   153 	the display mode allows more than 1 pixel to be stored in a single byte.
       
   154 	@return The (adjusted) width in pixels.
       
   155 	*/
       
   156 	virtual TInt LongWidth() const = 0;
       
   157 	
       
   158 	/**
       
   159 	Alter the colours within a defined rectangle according to the supplied mapping.
       
   160 	The colour map is supplied as pairs of TRgb objects. One member of the pair defines a colour value
       
   161 	to match, the other defines a colour to replace that value by.
       
   162 	Note that, for comparison purposes, smaller gamuts (e.g. 64K colour) are mapped to TRgb form before
       
   163 	comparison, so a colour that is not representable in the current display mode will not be matched.
       
   164 	Pixels in the original that do not match an entry in the colour map are unchanged.
       
   165 	@param aRect 			Area of the device/bitmap to be mapped in logical coordinates
       
   166 	@param aColors 			Colour map. This should be provided as a set of TRgb pairs, one to be matched
       
   167 							and the other to provide a replacement. 
       
   168 	@param aNumPairs 		Number of pairs of colours in aColors.
       
   169 	@param aMapForwards 	If ETrue, match the first colour of a pair and replace by the second, otherwise
       
   170 	                    	match the second and replace by the first.
       
   171 	@panic EScreenDriverPanicOutOfBounds 	if aRect transforms back to illegal physical coordinates.
       
   172 	@panic EScreenDriverPanicNullPointer 	if aColors == NULL
       
   173 	@panic EScreenDriverPanicZeroLength 	if aNumPairs == 0
       
   174 	*/
       
   175 	virtual void MapColors(const TRect& aRect,const TRgb* aColors,TInt aNumPairs,TBool aMapForwards) = 0;
       
   176 	
       
   177 	/**
       
   178 	Reads a line of aLength pixels starting at [aX, aY] (in logical coordinates). The direction of reading
       
   179 	is affected by the current orientation, and the "stride" taken in sampling pixels is affected by
       
   180 	any scaling currently in force. Pixels are converted (if necessary) to the form specified by
       
   181 	aDispMode before being written to the buffer. The entire line to be read must be within the
       
   182 	physical bounds of the bitmap or device
       
   183 	@param aX			X coordinate of the pixel to start reading from (logical coordinates)
       
   184 	@param aY			Y coordinate of the pixel to start reading from(logical coordinates)
       
   185 	@param aLength		Number of pixels to read
       
   186 	@param aBuffer		Buffer to receive the pixel data (must be large enough)
       
   187 	@param aDispMode	Format to use for writing pixels into the buffer.
       
   188 	@panic EScreenDriverPanicOutOfBounds 	if either end of the line is out of bounds
       
   189 	@panic EScreenDriverPanicNullPointer 	if aBuffer == NULL
       
   190 	@panic EScreenDriverPanicZeroLength 	if aLength == 0
       
   191 	*/
       
   192 	virtual void ReadLine(TInt aX,TInt aY,TInt aLength,TAny* aBuffer,TDisplayMode aDispMode) const = 0;
       
   193 	
       
   194 	/**
       
   195 	Get the colour of the pixel at the logical position [aX,aY]
       
   196 	@param aX	X-coordinate of pixel to read (logical coordinates)
       
   197 	@param aY	Y-coordinate of pixel to read (logical coordinates)
       
   198 	@return The colour pf the pixel at [aX,aY]
       
   199 	@panic EScreenDriverPanicOutOfBounds 	if [aX,aY] transforms back to illegal physical coordinates.
       
   200 	*/
       
   201 	virtual TRgb ReadPixel(TInt aX,TInt aY) const = 0;
       
   202 
       
   203 	/**
       
   204 	Returns a pointer to a buffer large enough to read a line of pixels of maximum length. Ownership of
       
   205 	the buffer is retained by the bitmap or device object. Repeated calls to this function will return
       
   206 	the same buffer.
       
   207 	@return A pointer to a scan line buffer
       
   208 	*/
       
   209 	virtual TUint32* ScanLineBuffer() const = 0;
       
   210 	
       
   211 	/**
       
   212 	Scanline width in bytes. The return value may be greater than the actual number of bytes needed
       
   213 	to store the pixels, since scan line memory is allocated in 32-bit words and can be rounded up.
       
   214 	@return The (adjusted) width in bytes.
       
   215 	*/
       
   216 	virtual TInt ScanLineBytes() const = 0;
       
   217 	
       
   218 	/**
       
   219 	Return the display mode to be used when passing pixel data to the device using the scanline buffer.
       
   220 	@return Display mode
       
   221 	@see CFbsDrawDevice::DisplayMode
       
   222 	*/
       
   223 	virtual TDisplayMode ScanLineDisplayMode() const = 0;
       
   224 	
       
   225 	/**
       
   226 	Returns the screen size in pixels, taking the orientation into account.
       
   227 	Always prefer GetDrawRect() to SizeInPixels() call. 
       
   228 	GetDrawRect() will take into account possible non-[0,0] top-left corner of the drawing
       
   229 	rectangle if the device is scaled.
       
   230 	@return TSize Screen size in pixels
       
   231 	*/
       
   232 	virtual TSize SizeInPixels() const = 0;
       
   233 
       
   234 	/**
       
   235 	Allows the caller to calculate the physical size of a bitmap on the current hardware
       
   236 	by calculating how many twips a 1000-pixel wide bitmap would be. Only applicable to
       
   237 	screen-based devices; bitmap devices return 0.
       
   238 	@return Twips per 1000 pixels
       
   239 	*/
       
   240 	virtual TInt HorzTwipsPerThousandPixels() const = 0;
       
   241 	
       
   242 	/**
       
   243 	Allows the caller to calculate the physical size of a bitmap on the current hardware
       
   244 	by calculating how many twips a 1000-pixel high bitmap would be. Only applicable to
       
   245 	screen-based devices; bitmap devices return 0.
       
   246 	@return Twips per 1000 pixels
       
   247 	*/
       
   248 	virtual TInt VertTwipsPerThousandPixels() const = 0;
       
   249 	
       
   250 	/**
       
   251 	Reports on which orientations are available on the device/bitmap.
       
   252 	@param aOrientation	Array to receive the capability (use CFbsDrawDevice::TOrientation as an index)
       
   253 	*/
       
   254 	virtual void OrientationsAvailable(TBool aOrientation[4]) = 0;
       
   255 	
       
   256 	/**
       
   257 	Set the orientation of the device
       
   258 	@param aOrientation	Orientation to set
       
   259 	@return ETrue if the new orientation was set successfully, EFalse otherwise
       
   260 	*/
       
   261 	virtual TBool SetOrientation(TOrientation aOrientation) = 0;
       
   262 
       
   263 	/**
       
   264 	Combines the current content of the device/bitmap with a supplied colour, based on a bitmask and
       
   265 	a draw mode. The bitmask is supplied as an array of TUint32s, one for each line (so there should
       
   266 	be aHeight entries in the array). Since one word is used per line, aLength must be <= 32. Each bit
       
   267 	of the mask controls one pixel - if the bit is 1, the pixel is combined with aColor, if the bit
       
   268 	is 0, the pixel is left unchanged. Note that bits in the bitmask are examined in low-high order,
       
   269 	so bit0 affects the pixel at aX, bit1 affects the pixel at aX+1 and so forth.
       
   270 	If the shadowing/fading flag is set, the resulting pixels will be shadowed/faded.
       
   271 	@param aX			Left edge of the rectangle (logical coordinates)
       
   272 	@param aY			Top edge of the rectangle (logical coordinates)
       
   273 	@param aBuffer		Array of bitmasks - one per line
       
   274 	@param aLength		Width of the rectangle (must be >0 and <= 32)
       
   275 	@param aHeight		Height of the rectangle (== number of entries in aBuffer)
       
   276 	@param aColor		Colour to combine with the existing pixel data
       
   277 	@param aDrawMode	Combination function for source and destination pixels.			
       
   278 	@panic EScreenDriverPanicOutOfBounds	If any part of the rectangle maps to an illegal physical coordinate
       
   279 											or if aLength > 32.
       
   280 	@panic EScreenDriverPanicNullPointer	If aBuffer == NULL
       
   281 	@panic EScreenDriverPanicZeroLength		If aLength <= 0
       
   282 	*/
       
   283 	virtual void WriteBinary(TInt aX,TInt aY,TUint32* aBuffer,TInt aLength,TInt aHeight,TRgb aColor,CGraphicsContext::TDrawMode aDrawMode) = 0;
       
   284 	
       
   285 	/**
       
   286 	Combines the current content of the device/bitmap with a supplied colour, based on a bitmask and
       
   287 	a draw mode. This function differs from WriteBinary, in that aLength can be greater than 32, and
       
   288 	the height is implicitly 1. aBuffer must contain sufficient elements to hold aLength bits
       
   289 	If the shadowing/fading flag is set, the resulting pixels will be shadowed/faded.
       
   290 	@param aX			Starting X coordinate (logical coordinates)
       
   291 	@param aY			Starting Y coordinate (logical coordinates)
       
   292 	@param aBuffer		Array of bitmasks
       
   293 	@param aLength		Number of pixels
       
   294 	@param aColor		Colour to combine with existing pixels
       
   295 	@param aDrawMode	Combination function for source and destination pixels.			
       
   296 	@panic EScreenDriverPanicOutOfBounds	If any part of the line maps to an illegal physical coordinate
       
   297 	@panic EScreenDriverPanicNullPointer	If aBuffer == NULL
       
   298 	@panic EScreenDriverPanicZeroLength		If aLength <= 0
       
   299 	@see WriteBinary
       
   300 	*/
       
   301 	virtual void WriteBinaryLine(TInt aX,TInt aY,TUint32* aBuffer,TInt aLength,TRgb aColor,CGraphicsContext::TDrawMode aDrawMode) = 0;
       
   302 
       
   303 	/**
       
   304 	Similar to WriteBinaryLine, but writes a vertical, rather than a horizontal line. LIne is drawn upward
       
   305 	(decreasing Y) if aUp == ETrue.
       
   306 	@see WriteBinaryLine 
       
   307 	*/	
       
   308 	virtual void WriteBinaryLineVertical(TInt aX,TInt aY,TUint32* aBuffer,TInt aHeight,TRgb aColor,CGraphicsContext::TDrawMode aDrawMode,TBool aUp) = 0;
       
   309 
       
   310 	/**
       
   311 	Write the given colour to the location [aX,aY], combining it with the existing pixel
       
   312 	using aDrawMode
       
   313 	If the shadowing/fading flag is set, the resulting pixels will be shadowed/faded.
       
   314 	@param aX			X coordinate (logical coordinates)
       
   315 	@param aY			Y coordinate (logical coordinates)
       
   316 	@param aColor		Colour to write
       
   317 	@param aDrawMode	Combination function for source and destination pixels.			
       
   318 	@panic EScreenDriverPanicOutOfBounds	If [aX,aY] maps to an illegal physical address
       
   319 	*/
       
   320 	virtual void WriteRgb(TInt aX,TInt aY,TRgb aColor,CGraphicsContext::TDrawMode aDrawMode) = 0;
       
   321 
       
   322 	/**
       
   323 	Write the given colour to the rectangle [aX,aY] - [aX+aLength,aY+aHeight], combining it
       
   324 	with the exiasting pixels using aDrawMode
       
   325 	If the shadowing/fading flag is set, the resulting pixels will be shadowed/faded.
       
   326 	@param aX			X coordinate (logical coordinates)
       
   327 	@param aY			Y coordinate (logical coordinates)
       
   328 	@param aLength		Width of the rectangle (logical coordinates)
       
   329 	@param aHeight		Height of the rectangle (logical coordinates)
       
   330 	@param aColor		Colour to write
       
   331 	@param aDrawMode	Combination function for source and destination pixels.			
       
   332 	@panic EScreenDriverPanicOutOfBounds	If any part of the rectangle maps to an illegal physical address
       
   333 	*/
       
   334 	virtual void WriteRgbMulti(TInt aX,TInt aY,TInt aLength,TInt aHeight,TRgb aColor,CGraphicsContext::TDrawMode aDrawMode) = 0;
       
   335 	
       
   336 	/**
       
   337 	The method performs an alpha blending of the source data - aRgbBuffer and screen pixels, using
       
   338 	the data from aMaskBuffer buffer as an alpha blending factor.
       
   339 	The formula used for that, is:
       
   340 		(C1 * A + C2 * (255 - A)) / 255, where:
       
   341 			- C1 - a pixel from aRgbBuffer;
       
   342 			- C2 - a pixel from the sceen;
       
   343 			- A  - a pixel from aMaskBuffer;
       
   344 	The content of source and mask buffers is preserved.
       
   345 	The calculated alpha blended pixel is written to the destination - the screen or a bitmap.
       
   346 	If the shadowing/fading flag is set, a shadow/fade copy of the source bitmap will be used.
       
   347 	@param aX 			Logical X coordinate of the start of the line.
       
   348 	@param aY 			Logical Y coordinate of the line.
       
   349 	@param aLength 		Source data - length in pixels.
       
   350 	@param aRgbBuffer 	A pointer to a line of the source bitmap data.
       
   351 	                    Must be in ERgb format.
       
   352 	@param aMaskBuffer 	Buffer containing the data which should be used as an 
       
   353 	                   	alpha blending factor. Must be in EGray256 format.
       
   354 	@param aDrawMode	Combination function for source and destination pixels.
       
   355 	@panic EScreenDriverPanicOutOfBounds	If any part of the line maps to an illegal physical address
       
   356 	*/
       
   357 	virtual void WriteRgbAlphaLine(TInt aX,TInt aY,TInt aLength,TUint8* aRgbBuffer,TUint8* aMaskBuffer, CGraphicsContext::TDrawMode aDrawMode) = 0;
       
   358 
       
   359 	/**
       
   360 	Combine the data in aBuffer with existing pixels along the line [aX,aY]-[aX+aLength,aY],
       
   361 	using aDrawMode as the combining function.
       
   362 	If the shadowing/fading flag is set, the resulting pixels will be shadowed/faded.
       
   363 	@param aX 			Logical X coordinate of the start of the line.
       
   364 	@param aY 			Logical Y coordinate of the line.
       
   365 	@param aLength 		Source data - length in pixels.
       
   366 	@param aBuffer		Source data. Must be in the format returned by ScanLineDisplayMode().
       
   367 	@param aDrawMode	Combination function for source and destination pixels.			
       
   368 	@panic EScreenDriverPanicOutOfBounds	If any part of the line maps to an illegal physical address
       
   369 	*/
       
   370 	virtual void WriteLine(TInt aX,TInt aY,TInt aLength,TUint32* aBuffer,CGraphicsContext::TDrawMode aDrawMode) = 0;
       
   371 public:
       
   372 
       
   373 	/**
       
   374 	Do any necessary initialisation on screen devices (default applies to bitmaps)
       
   375 	@return Success/failure code
       
   376 	*/
       
   377 	virtual TInt InitScreen() {return(KErrNone);}
       
   378 	
       
   379 	/** Sets or unsets auto-update for the screen.
       
   380 
       
   381 	@param aValue ETrue, if the screen is set to auto-update; EFalse, otherwise. 
       
   382 	*/
       
   383 	virtual void SetAutoUpdate(TBool aValue) {(void) aValue;}	// To avoid compiler warning for unused parameter
       
   384 	
       
   385 	/**
       
   386 	Set the internal data buffer to point to the supplied buffer. No checks are made that the buffer
       
   387 	is appropriate for the purpose. Ownership is not taken.
       
   388 	@param aBits	A buffer of sufficient size.
       
   389 	*/
       
   390 	virtual void SetBits(TAny*) {}
       
   391 	
       
   392 	/**
       
   393 	Set up a custom palette for those bit formats that support palettised colour
       
   394 	@param aPalette		Palette to use
       
   395 	@return Success/failure code
       
   396 	*/
       
   397 	virtual TInt SetCustomPalette(const CPalette*) { return KErrNotSupported; }
       
   398 
       
   399 	/**
       
   400 	Retrieve a custom palette, if the bit format supports it.
       
   401 	@param aPalette	Pointer to a CPalette. The palette will be created by this function.
       
   402 	@return Success/failure code
       
   403 	*/
       
   404 	virtual TInt GetCustomPalette(CPalette*&) { return KErrNotSupported; }
       
   405 
       
   406 	/**
       
   407 	Copies all settings (scaling, orientation, etc.) from the supplied device
       
   408 	and reinitialised the current device.
       
   409 	@param aDrawDevice	Device to get settings from
       
   410 	*/
       
   411 	virtual void SetDisplayMode(CFbsDrawDevice*) {}
       
   412 
       
   413 	/**
       
   414 	Set the origin point of the dither matrix (if appropriate)
       
   415 	@param aPoint	Dither origin (logical coordiantes)
       
   416 	*/
       
   417 	virtual void SetDitherOrigin(const TPoint&) {}
       
   418 
       
   419 	/**
       
   420 	Sets the user display mode - used for certain colour mapping functions
       
   421 	*/
       
   422 	virtual void SetUserDisplayMode(TDisplayMode) {}
       
   423 	
       
   424 	/**
       
   425 	Sets the current shadowing mode
       
   426 	@see TShadowMode
       
   427 	*/
       
   428 	virtual void SetShadowMode(TShadowMode) {}
       
   429 
       
   430 	/**
       
   431 	Set the current fading parameters
       
   432 	@param aBlackMap	Black point
       
   433 	@param aWhiteMap	White point
       
   434 	*/
       
   435 	virtual void SetFadingParameters(TUint8 /*aBlackMap*/,TUint8 /*aWhiteMap*/) {}
       
   436 
       
   437 	/**
       
   438 	Apply shadow processing to all the pixels in the supplied rectangle
       
   439 	@param aRect	Area to apply shadow processing to (logical coordinates)
       
   440 	@panic EScreenDriverPanicOutOfBounds	If any part of the rectangle maps to an illegal physical address
       
   441 	*/
       
   442 	virtual void ShadowArea(const TRect&) {} // Obeys shadow mode
       
   443 
       
   444 	/**
       
   445 	Applies shadow processing to the supplied buffer
       
   446 	@param aLength		Length of buffer in pixels
       
   447 	@param aBuffer		Buffer to process in the format returned by ScanLineDisplayMode()
       
   448 	@panic EScreenDriverPanicZeroLength If aLength <= 0
       
   449 	@panic EScreenDriverPanicNullPointer If aBuffer == NULL
       
   450 	*/
       
   451 	virtual void ShadowBuffer(TInt,TUint32*) {} // Obeys shadow mode
       
   452 
       
   453 	/**
       
   454 	Update the screen with the update region.
       
   455 	*/
       
   456 	virtual void Update() {}
       
   457 
       
   458 	/**
       
   459 	Update the screen with the union of the update and specified regions.
       
   460 	@param aRegion		Region to update (logical coordinates)
       
   461 	*/
       
   462 	virtual void Update(const TRegion&) {}
       
   463 
       
   464 	/**
       
   465 	Update the update region.
       
   466 	@param aRegion		Region to update (logical coordinates)
       
   467 	*/
       
   468 	virtual void UpdateRegion(const TRect&) {}
       
   469 public:
       
   470 
       
   471 	/**
       
   472 	Blend aColor with the pixels along the line [aX,aY]-[aX+aLength,aY], using aMaskBuffer
       
   473 	as alpha data
       
   474 	If the shadowing/fading flag is set, a shadow/fade copy of the source bitmap will be used.
       
   475 	@param aX			Logical X coordinate of the start of the line
       
   476 	@param aY			Logical Y coordinate of the line.
       
   477 	@param aLength		Length of line to modify
       
   478 	@param aColor		Colour to blend with existing pixels
       
   479 	@param aMaskBuffer	Buffer containing the data which should be used as an 
       
   480 	                   	alpha blending factor.
       
   481 	@panic EScreenDriverPanicOutOfBounds	If any part of the line maps to an illegal physical address
       
   482 	*/
       
   483 	virtual void WriteRgbAlphaMulti(TInt aX,TInt aY,TInt aLength,TRgb aColor,const TUint8* aMaskBuffer) = 0;
       
   484 
       
   485 	/**
       
   486 	The method performs an alpha blending of the source data - aRgbBuffer1 and aBuffer2, using
       
   487 	the data from aMaskBuffer buffer as an alpha blending factor.
       
   488 	If the shadowing/fading flag is set, the resulting pixels will be shadowed/faded.
       
   489 	The formula used for that, is:
       
   490 		(C1 * A + C2 * (255 - A)) / 255, where:
       
   491 			- C1 - a pixel from aRgbBuffer1;
       
   492 			- C2 - a pixel from aBuffer2;
       
   493 			- A  - a pixel from aMaskBuffer;
       
   494 	The content of source and mask buffers is preserved.
       
   495 	The calculated alpha blended pixel is written to the destination - the screen or a bitmap.
       
   496 	If the shadowing/fading flag is set, the resulting pixels will be shadowed/faded.
       
   497 	@param aX Logical X coordinate of the position in the target the result should be drawn to.
       
   498 	@param aY Logical Y coordinate of the position in the target the result should be drawn to.
       
   499 	@param aLength Source data - length in pixels.
       
   500 	@param aRgbBuffer1 A pointer to a line of the source bitmap data 1.
       
   501 	                   Must be in ERgb format.
       
   502 	@param aBuffer2 A pointer to a line of the source bitmap data 2.
       
   503 	                Must be in the format returned by ScanLineDisplayMode().
       
   504 	@param aMaskBuffer Buffer containing the data which should be used as an 
       
   505 	                   alpha blending factor. Must be in EGray256 format.
       
   506 	@param aDrawMode Drawing mode
       
   507 	*/
       
   508 	virtual void WriteRgbAlphaLine(TInt aX,TInt aY,TInt aLength,
       
   509 								   const TUint8* aRgbBuffer1,
       
   510 								   const TUint8* aBuffer2,
       
   511 								   const TUint8* aMaskBuffer,
       
   512 								   CGraphicsContext::TDrawMode aDrawMode) = 0;
       
   513 	/**
       
   514 	Retrieves a pointer to the specified CFbsDrawDevice interface extension.
       
   515 	@param aInterfaceId Interface identifier of the interface to be retrieved.
       
   516 	@param aInterface Address of pointer variable that retrieves the specified interface.
       
   517 	@return KErrNone If the interface is supported, KErrNotSupported otherwise.
       
   518 	@see BitDrawInterfaceId.h file for the IDs of supported interfaces
       
   519 	*/
       
   520 	virtual TInt GetInterface(TInt aInterfaceId, TAny*& aInterface) = 0;
       
   521 	
       
   522 	/**
       
   523 	Gets logical coordinates of the drawing rectangle.
       
   524 	If the device is not scaled and with zero origin, logocal coordinates of 
       
   525 	the drawing rectangle are the same as its physical coordinates.
       
   526 	If the device is rotated, drawing rectangle width and height are swapped.
       
   527 	Always prefer GetDrawRect() to SizeInPixels() call. SizeInPixels() will return
       
   528 	drawing rectangle width and height. But if the device is scaled or with nonzero origin,
       
   529 	GetDrawRect() will take into account and the top-left corner of the drawing rectangle too,
       
   530 	which may not be [0, 0].
       
   531 	@param aDrawRect Upon return aRect contains drawing rectangle logical coordinates.
       
   532 	*/
       
   533 	virtual void GetDrawRect(TRect& aDrawRect) const = 0;
       
   534 	
       
   535 	/**
       
   536 	The method swaps bitmap device's width and height.
       
   537 	For example: if the size is (40, 20), the swapped size will be (20, 40).
       
   538 	The device's content is not preserved.
       
   539 	The method leaves CDrawBitmap object in a consistent state - 
       
   540 	scaling settings will be set with their default values (the scaling is switched off),
       
   541 	iDitherOrigin will be set to (0,0), iOrigin to (0,0).
       
   542 	Note: This method is used internally by BITGDI component. Do not call it!
       
   543 	*/
       
   544 	virtual void SwapWidthAndHeight() = 0;
       
   545 	};
       
   546 
       
   547 #endif
       
   548