ERY.AgateLib.ImplBase.SurfaceImpl Class Reference

Base class for implementing a Surface structure. More...

Inherits ERY.AgateLib.ImplBase.IRenderTargetImpl.

List of all members.

Public Member Functions

 SurfaceImpl ()
 Constructs a SurfaceImpl object.
abstract void Dispose ()
 Frees unmanaged resources.
virtual void Draw (Rectangle destRect)
 For function use, see documentation of Surface.
abstract void Draw (Rectangle srcRect, Rectangle destRect)
 For function use, see documentation of Surface.
virtual void Draw (Point destPt)
 For function use, see documentation of Surface.
abstract void Draw (float destX, float destY)
 For function use, see documentation of Surface.
abstract void Draw (float destX, float destY, float rotationCenterX, float rotationCenterY)
 For function use, see documentation of Surface.
virtual void DrawPoints (Point[] destPts)
 For function use, see documentation of Surface.
virtual void Draw ()
 For function use, see documentation of Surface.
virtual void DrawRects (Rectangle[] srcRects, Rectangle[] destRects)
 For function use, see documentation of Surface.
void BeginQueueRects ()
 Sets up data structures to queue rects to draw to the screen.
void BeginQueueRects (int guessCount)
 Sets up data structures to queue rects to draw to the screen.
void QueueRect (Rectangle src_rect, Rectangle dest_rect)
 Adds a src/dest rectangle pair to the queue. Make sure to call BeginQueueRects first.
void EndQueueRects ()
 Ends adding rects to the queue and draws all of them to the screen.
abstract void SaveTo (string filename, ImageFileFormat format)
 Saves the surface data to the specified file in the specified format.
abstract SurfaceImpl CarveSubSurface (Surface surface, Rectangle srcRect)
 Creates a new SurfaceImpl object which comes from a small sub-rectangle on this surface.
abstract void SetSourceSurface (SurfaceImpl surf, Rectangle srcRect)
 Used by Display.BuildPackedSurface.
virtual PixelBuffer ReadPixels (PixelFormat format)
 Creates a PixelBuffer object with a copy of the pixel data, in the specified format.
abstract PixelBuffer ReadPixels (PixelFormat format, Rectangle rect)
 Creates a PixelBuffer object with a copy of the pixel data in the specified rectangle, in the specified format.
abstract void WritePixels (PixelBuffer buffer)
 Writes pixel data to the surface.
abstract void WritePixels (PixelBuffer buffer, Point startPoint)
 Writes pixel data to the surface.
void SetScale (double width, double height)
 Sets the amount of scaling when this surface is drawn. 1.0 is no scaling. Scale values can be negative, this causes the surface to be mirrored in that direction. This does not affect how the surface is aligned; eg. if DisplayAlignment is top-left and ScaleWidth < 0, the surface will still be drawn to the right of the point supplied to Draw(Point).
void GetScale (out double width, out double height)
 Gets the amount of scaling when this surface is drawn. 1.0 is no scaling. Scale values can be negative, this causes the surface to be mirrored in that direction. This does not affect how the surface is aligned; eg. if DisplayAlignment is top-left and ScaleWidth < 0, the surface will still be drawn to the right of the point supplied to Draw(Point).
void IncrementRotationAngle (double radians)
 Increments the rotation angle of this surface.
void IncrementRotationAngleDegrees (double degrees)
 Increments the rotation angle of this surface. Value supplied is in degrees.
abstract bool IsSurfaceBlank ()
 Checks to see whether the surface pixels all have alpha value less than the value of the AlphaThreshold of the display object..
abstract bool IsSurfaceBlank (int alphaThreshold)
 Checks to see whether the surface pixels all have alpha value less than the given value.
abstract bool IsRowBlank (int row)
 Checks to see whether all the pixels along the given row are all transparent, within the threshold.
abstract bool IsColumnBlank (int col)
 Checks to see whether all the pixels along the given column are all transparent, within the threshold.
abstract void BeginRender ()
 Utility function which can be called by BeginFrame to begin a render pass.
abstract void EndRender ()
 Utility function which can be called by EndFrame to end a render pass.

Properties

int TesselateFactor [get, set]
 Gets or sets how many squares the surface should be broken into when drawn.
bool IsDisposed [get]
 Returns true if Dispose() has been called on this surface.
bool ShouldBePacked [get, set]
 Gets or sets a bool value which indicates whether or not this surface should be considered for packing when Display.PackAllSurfaces() is called.
int DisplayWidth [get, set]
 Get or sets the width of the surface in pixels when it will be displayed on screen.
int DisplayHeight [get, set]
 Gets or sets the height of the surface in pixels when it is displayed on screen.
Size DisplaySize [get, set]
 Gets or sets the Size of the area used by this surface when displayed on screen.
double Alpha [get, set]
 Alpha value for displaying this surface. Valid values range from 0.0 (completely transparent) to 1.0 (completely opaque). Internally stored as a byte, so granularity is only 1/255.0.
virtual double RotationAngle [get, set]
 Gets or sets the rotation angle in radians. Positive angles indicate rotation in the Counter-Clockwise direction.
double RotationAngleDegrees [get, set]
 Gets or sets the rotation angle in degrees. Positive angles indicate rotation in the Counter-Clockwise direction.
virtual OriginAlignment RotationCenter [get, set]
 Gets or sets the point on the surface which is used to rotate around.
virtual OriginAlignment DisplayAlignment [get, set]
 Gets or sets the point where the surface is aligned to when drawn.
double ScaleWidth [get, set]
 Gets or sets the amount the width is scaled when this surface is drawn. 1.0 is no scaling. Scale values can be negative, this causes the surface to be mirrored in that direction. This does not affect how the surface is aligned; eg. if DisplayAlignment is top-left and ScaleWidth < 0, the surface will still be drawn to the right of the point supplied to Draw(Point).
double ScaleHeight [get, set]
 Gets or sets the amount the height is scaled when this surface is drawn. 1.0 is no scaling.
virtual Color Color [get, set]
 Gets or sets the multiplicative color for this surface. Remember, Color structures have an alpha field, so setting this will override any value set by Alpha. If you want to set Alpha separately, set the Alpha property after the SurfaceColor property.
virtual int SurfaceWidth [get]
 Gets the width of the source surface in pixels.
virtual int SurfaceHeight [get]
 Gets the height of the source surface in pixels.
abstract Size SurfaceSize [get]
 Gets the Size of the source surface in pixels.


Detailed Description

Base class for implementing a Surface structure.


Constructor & Destructor Documentation

ERY.AgateLib.ImplBase.SurfaceImpl.SurfaceImpl (  ) 

Constructs a SurfaceImpl object.


Member Function Documentation

abstract void ERY.AgateLib.ImplBase.SurfaceImpl.Dispose (  )  [pure virtual]

Frees unmanaged resources.

virtual void ERY.AgateLib.ImplBase.SurfaceImpl.Draw ( Rectangle  destRect  )  [virtual]

For function use, see documentation of Surface.

Info for developers: This method should Draw the surface to the screen, ignoring all scaling, rotation and alignment state data. Color and Alpha are still to be used.

It is recommended to override this method, as the base class implementation saves the state, draws, then restores the state.

Parameters:
destRect 

abstract void ERY.AgateLib.ImplBase.SurfaceImpl.Draw ( Rectangle  srcRect,
Rectangle  destRect 
) [pure virtual]

For function use, see documentation of Surface.

Info for developers: This method should draw a portion of the surface to the screen, ignoring all scaling, rotation and alignment state data. Color and Alpha are still to be used.

This method must be overriden.

Parameters:
srcRect 
destRect 

virtual void ERY.AgateLib.ImplBase.SurfaceImpl.Draw ( Point  destPt  )  [virtual]

For function use, see documentation of Surface.

Info for developers: This method should draw the surface to the screen, using all the scaling, rotation, etc. state data in the stored Surface object. The base class method calls Draw(PointF).

This method may be overriden, if it is convenient to provide an alternate implementation which takes integral drawing values.

Parameters:
destPt 

abstract void ERY.AgateLib.ImplBase.SurfaceImpl.Draw ( float  destX,
float  destY 
) [pure virtual]

For function use, see documentation of Surface.

Info for developers: This method should draw the surface to the screen, using all the scaling, rotation, etc. state data in the stored Surface object.

This method must be overriden.

Parameters:
destX 
destY 

abstract void ERY.AgateLib.ImplBase.SurfaceImpl.Draw ( float  destX,
float  destY,
float  rotationCenterX,
float  rotationCenterY 
) [pure virtual]

For function use, see documentation of Surface.

Info for developers: This method should draw the surface to the screen, using all the scaling, rotation, etc. state data in the stored Surface object, except for RotationCenter. Use the point passed for the center of rotation.

This method must be overriden.

Parameters:
destX 
destY 
rotationCenterX 
rotationCenterY 

virtual void ERY.AgateLib.ImplBase.SurfaceImpl.DrawPoints ( Point[]  destPts  )  [virtual]

For function use, see documentation of Surface.

Info for developers: This method should draw the surface to the screen, with the same result as if Draw was called once for each Point passed.

Parameters:
destPts 

virtual void ERY.AgateLib.ImplBase.SurfaceImpl.Draw (  )  [virtual]

For function use, see documentation of Surface.

Info for developers: This method draws the surface at (0, 0). The base class implementation simply calls Draw(Point.Empty).

virtual void ERY.AgateLib.ImplBase.SurfaceImpl.DrawRects ( Rectangle[]  srcRects,
Rectangle[]  destRects 
) [virtual]

For function use, see documentation of Surface.

Info for developers: This method should draw the surface to the screen, with the same result as if Draw was called once for each src and dest rect pairs. It should be overridden, to minimize calls across managed/unmanaged boundaries.

Parameters:
srcRects 
destRects 

void ERY.AgateLib.ImplBase.SurfaceImpl.BeginQueueRects (  ) 

Sets up data structures to queue rects to draw to the screen.

void ERY.AgateLib.ImplBase.SurfaceImpl.BeginQueueRects ( int  guessCount  ) 

Sets up data structures to queue rects to draw to the screen.

Parameters:
guessCount A good guess for how many rects you are going to draw.

void ERY.AgateLib.ImplBase.SurfaceImpl.QueueRect ( Rectangle  src_rect,
Rectangle  dest_rect 
)

Adds a src/dest rectangle pair to the queue. Make sure to call BeginQueueRects first.

Parameters:
src_rect 
dest_rect 

void ERY.AgateLib.ImplBase.SurfaceImpl.EndQueueRects (  ) 

Ends adding rects to the queue and draws all of them to the screen.

abstract void ERY.AgateLib.ImplBase.SurfaceImpl.SaveTo ( string  filename,
ImageFileFormat  format 
) [pure virtual]

Saves the surface data to the specified file in the specified format.

Parameters:
filename 
format 

abstract SurfaceImpl ERY.AgateLib.ImplBase.SurfaceImpl.CarveSubSurface ( Surface  surface,
Rectangle  srcRect 
) [pure virtual]

Creates a new SurfaceImpl object which comes from a small sub-rectangle on this surface.

Parameters:
surface 
srcRect 
Returns:

abstract void ERY.AgateLib.ImplBase.SurfaceImpl.SetSourceSurface ( SurfaceImpl  surf,
Rectangle  srcRect 
) [pure virtual]

Used by Display.BuildPackedSurface.

Parameters:
surf 
srcRect 

virtual PixelBuffer ERY.AgateLib.ImplBase.SurfaceImpl.ReadPixels ( PixelFormat  format  )  [virtual]

Creates a PixelBuffer object with a copy of the pixel data, in the specified format.

Parameters:
format 
Returns:

abstract PixelBuffer ERY.AgateLib.ImplBase.SurfaceImpl.ReadPixels ( PixelFormat  format,
Rectangle  rect 
) [pure virtual]

Creates a PixelBuffer object with a copy of the pixel data in the specified rectangle, in the specified format.

Parameters:
format 
rect 
Returns:

abstract void ERY.AgateLib.ImplBase.SurfaceImpl.WritePixels ( PixelBuffer  buffer  )  [pure virtual]

Writes pixel data to the surface.

Parameters:
buffer 

abstract void ERY.AgateLib.ImplBase.SurfaceImpl.WritePixels ( PixelBuffer  buffer,
Point  startPoint 
) [pure virtual]

Writes pixel data to the surface.

Parameters:
buffer 
startPoint 

void ERY.AgateLib.ImplBase.SurfaceImpl.SetScale ( double  width,
double  height 
)

Sets the amount of scaling when this surface is drawn. 1.0 is no scaling. Scale values can be negative, this causes the surface to be mirrored in that direction. This does not affect how the surface is aligned; eg. if DisplayAlignment is top-left and ScaleWidth < 0, the surface will still be drawn to the right of the point supplied to Draw(Point).

Parameters:
width 
height 

void ERY.AgateLib.ImplBase.SurfaceImpl.GetScale ( out double  width,
out double  height 
)

Gets the amount of scaling when this surface is drawn. 1.0 is no scaling. Scale values can be negative, this causes the surface to be mirrored in that direction. This does not affect how the surface is aligned; eg. if DisplayAlignment is top-left and ScaleWidth < 0, the surface will still be drawn to the right of the point supplied to Draw(Point).

Parameters:
width 
height 

void ERY.AgateLib.ImplBase.SurfaceImpl.IncrementRotationAngle ( double  radians  ) 

Increments the rotation angle of this surface.

Parameters:
radians Value in radians to increase the rotation by.

void ERY.AgateLib.ImplBase.SurfaceImpl.IncrementRotationAngleDegrees ( double  degrees  ) 

Increments the rotation angle of this surface. Value supplied is in degrees.

Parameters:
degrees 

abstract bool ERY.AgateLib.ImplBase.SurfaceImpl.IsSurfaceBlank (  )  [pure virtual]

Checks to see whether the surface pixels all have alpha value less than the value of the AlphaThreshold of the display object..

Returns:

abstract bool ERY.AgateLib.ImplBase.SurfaceImpl.IsSurfaceBlank ( int  alphaThreshold  )  [pure virtual]

Checks to see whether the surface pixels all have alpha value less than the given value.

Parameters:
alphaThreshold The alpha value below which to consider a pixel blank. In the range 0 <= alphaThreshold <= 255.
Returns:

abstract bool ERY.AgateLib.ImplBase.SurfaceImpl.IsRowBlank ( int  row  )  [pure virtual]

Checks to see whether all the pixels along the given row are all transparent, within the threshold.

Parameters:
row Which row. Valid range is between 0 and SurfaceSize.Height - 1.
Returns:

abstract bool ERY.AgateLib.ImplBase.SurfaceImpl.IsColumnBlank ( int  col  )  [pure virtual]

Checks to see whether all the pixels along the given column are all transparent, within the threshold.

Parameters:
col Which column. Valid range is between 0 and SurfaceSize.Width - 1.
Returns:

abstract void ERY.AgateLib.ImplBase.SurfaceImpl.BeginRender (  )  [pure virtual]

Utility function which can be called by BeginFrame to begin a render pass.

Implements ERY.AgateLib.ImplBase.IRenderTargetImpl.

abstract void ERY.AgateLib.ImplBase.SurfaceImpl.EndRender (  )  [pure virtual]

Utility function which can be called by EndFrame to end a render pass.

Implements ERY.AgateLib.ImplBase.IRenderTargetImpl.


Property Documentation

int ERY.AgateLib.ImplBase.SurfaceImpl.TesselateFactor [get, set]

Gets or sets how many squares the surface should be broken into when drawn.

bool ERY.AgateLib.ImplBase.SurfaceImpl.IsDisposed [get]

Returns true if Dispose() has been called on this surface.

bool ERY.AgateLib.ImplBase.SurfaceImpl.ShouldBePacked [get, set]

Gets or sets a bool value which indicates whether or not this surface should be considered for packing when Display.PackAllSurfaces() is called.

int ERY.AgateLib.ImplBase.SurfaceImpl.DisplayWidth [get, set]

Get or sets the width of the surface in pixels when it will be displayed on screen.

int ERY.AgateLib.ImplBase.SurfaceImpl.DisplayHeight [get, set]

Gets or sets the height of the surface in pixels when it is displayed on screen.

Size ERY.AgateLib.ImplBase.SurfaceImpl.DisplaySize [get, set]

Gets or sets the Size of the area used by this surface when displayed on screen.

double ERY.AgateLib.ImplBase.SurfaceImpl.Alpha [get, set]

Alpha value for displaying this surface. Valid values range from 0.0 (completely transparent) to 1.0 (completely opaque). Internally stored as a byte, so granularity is only 1/255.0.

virtual double ERY.AgateLib.ImplBase.SurfaceImpl.RotationAngle [get, set]

Gets or sets the rotation angle in radians. Positive angles indicate rotation in the Counter-Clockwise direction.

double ERY.AgateLib.ImplBase.SurfaceImpl.RotationAngleDegrees [get, set]

Gets or sets the rotation angle in degrees. Positive angles indicate rotation in the Counter-Clockwise direction.

virtual OriginAlignment ERY.AgateLib.ImplBase.SurfaceImpl.RotationCenter [get, set]

Gets or sets the point on the surface which is used to rotate around.

virtual OriginAlignment ERY.AgateLib.ImplBase.SurfaceImpl.DisplayAlignment [get, set]

Gets or sets the point where the surface is aligned to when drawn.

double ERY.AgateLib.ImplBase.SurfaceImpl.ScaleWidth [get, set]

Gets or sets the amount the width is scaled when this surface is drawn. 1.0 is no scaling. Scale values can be negative, this causes the surface to be mirrored in that direction. This does not affect how the surface is aligned; eg. if DisplayAlignment is top-left and ScaleWidth < 0, the surface will still be drawn to the right of the point supplied to Draw(Point).

double ERY.AgateLib.ImplBase.SurfaceImpl.ScaleHeight [get, set]

Gets or sets the amount the height is scaled when this surface is drawn. 1.0 is no scaling.

virtual Color ERY.AgateLib.ImplBase.SurfaceImpl.Color [get, set]

Gets or sets the multiplicative color for this surface. Remember, Color structures have an alpha field, so setting this will override any value set by Alpha. If you want to set Alpha separately, set the Alpha property after the SurfaceColor property.

virtual int ERY.AgateLib.ImplBase.SurfaceImpl.SurfaceWidth [get]

Gets the width of the source surface in pixels.

virtual int ERY.AgateLib.ImplBase.SurfaceImpl.SurfaceHeight [get]

Gets the height of the source surface in pixels.

abstract Size ERY.AgateLib.ImplBase.SurfaceImpl.SurfaceSize [get]

Gets the Size of the source surface in pixels.


The documentation for this class was generated from the following file:
AgateLib
Awesome Game and Tool Engine Library
SourceForge.net Logo