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