C# Class LitDev.LDGraphicsWindow

Exibir arquivo Open project: litdev1/LitDev

Public Properties

Property Type Description
_ClosingDelegate SmallBasicCallback

Public Methods

Method Description
BackgroundBrush ( Primitive brush ) : void

Set the background as a gradient of colours.

BackgroundImage ( Primitive imageName ) : void

Set the background as an image. The backgound is auto rescaled to fill whatever size the GraphicsWindow is.

Capture ( Primitive fileName, Primitive border ) : Primitive

Save the GraphicsWindow as an image file (png, jpg, bmp, gif, tiff or ico). The window must be visible and a short delay may be required after updating the window before calling.

ExitButtonMode ( Primitive window, Primitive mode ) : void

Set the mode of the close button for a window.

FloodFill ( Primitive x, Primitive y, Primitive colour ) : void

Fill a region surrounding a specified pixel. All neighbour pixels of the same colour are changed. This only applies to the drawing layer of the GraphicsWindow.

GetPixel ( Primitive x, Primitive y ) : Primitive

Gets the color of the pixel at the specified x and y co-ordinates. This method works for background, drawing and shape layers.

PauseUpdates ( ) : void

Pause GraphicsWindow Updates.

Print ( Primitive border ) : void

Print the GraphicsWindow contents. The window must be visible and a short delay may be required after updating the window before calling.

Reposition ( Primitive scaleX, Primitive scaleY, Primitive panX, Primitive panY, Primitive angle ) : void

Scale and move all Shapes and Contols within the GraphicsWindow. This method resizes and moves the view rather than the shapes, so their positions and other properties remain unchanged but appear scaled within the repositioned region. For example Shapes.GetLeft remains unchanged although the view has been repositioned and GraphicsWindow.MouseX reports the coordinates relative to the repositioned view. Imagine the entire view is repositioned as if it were a shape inside the GrapicsWindow. The transformation between view coordinates (vX,vY) and GraphicsWindow coordinates (gwX,gwY) is: gwX = (vX+panX)*scaleX + gw*(1-scaleX)/2 gwY = (vY+panY)*scaleY + gh*(1-scaleY)/2 All drawing remains within the original GraphicsWindow.

RepositionPoint ( Primitive x, Primitive y, Primitive toGW ) : Primitive

Get coordinates transformed between GraphicsWindow and a repositioned View (See Reposition).

ResumeUpdates ( ) : void

Resume GraphicsWindow Updates.

SetActive ( ) : void

Set the GraphicsWindow as active (has focus).

SetFontFromFile ( Primitive fontFile ) : Primitive

Set font in GraphicsWindow from a local TTF font file.

TransparentGW ( ) : void

Create a transparent GraphicsWindow. This must be the called before any other GraphicsWindow, Controls or Shapes methods that create a window. To see anything you must add something to the transparent GraphicsWindow. For example, create a non-rectangular window using a transparent border png with LDShapes.BackgroundImage. The transparency can be altered with GraphicsWindow.BackgroundColor. Sometimes less than 100% transparency can be required (e.g. to register mouse movements).

Private Methods

Method Description
BackgroundBrushGradient ( Primitive brush ) : void
GetTransforms ( System.Windows.Controls.Canvas canvas ) : void
_ClosingEvent ( Object sender, CancelEventArgs e ) : void

Method Details

BackgroundBrush() public static method

Set the background as a gradient of colours.
public static BackgroundBrush ( Primitive brush ) : void
brush Primitive /// A previously created gradient or image brush (LDShapes.BrushGradient LDShapes.BrushImage). ///
return void

BackgroundImage() public static method

Set the background as an image. The backgound is auto rescaled to fill whatever size the GraphicsWindow is.
public static BackgroundImage ( Primitive imageName ) : void
imageName Primitive /// The image to load as the background. /// Value returned from ImageList.LoadImage or local or network image file. ///
return void

Capture() public static method

Save the GraphicsWindow as an image file (png, jpg, bmp, gif, tiff or ico). The window must be visible and a short delay may be required after updating the window before calling.
public static Capture ( Primitive fileName, Primitive border ) : Primitive
fileName Primitive /// The file to save the image to (*.png, *.jpg, *.bmp, *.gif, *.tiff or *.ico). /// If this is set to "", then the image is created internally as an ImageList. ///
border Primitive /// Include the window border ("True" or "False"). ///
return Primitive

ExitButtonMode() public static method

Set the mode of the close button for a window.
public static ExitButtonMode ( Primitive window, Primitive mode ) : void
window Primitive The window title, e.g. TextWindow.Title or GraphicsWindow.Title.
mode Primitive The mode "Enabled", "Disabled")
return void

FloodFill() public static method

Fill a region surrounding a specified pixel. All neighbour pixels of the same colour are changed. This only applies to the drawing layer of the GraphicsWindow.
public static FloodFill ( Primitive x, Primitive y, Primitive colour ) : void
x Primitive /// The x co-ordinate of the pixel to start the fill. ///
y Primitive /// The y co-ordinate of the pixel to start the fill. ///
colour Primitive /// The colour to fill with. ///
return void

GetPixel() public static method

Gets the color of the pixel at the specified x and y co-ordinates. This method works for background, drawing and shape layers.
public static GetPixel ( Primitive x, Primitive y ) : Primitive
x Primitive /// The x co-ordinate of the pixel. ///
y Primitive /// The y co-ordinate of the pixel. ///
return Primitive

PauseUpdates() public static method

Pause GraphicsWindow Updates.
public static PauseUpdates ( ) : void
return void

Print() public static method

Print the GraphicsWindow contents. The window must be visible and a short delay may be required after updating the window before calling.
public static Print ( Primitive border ) : void
border Primitive /// Include the window border ("True" or "False"). ///
return void

Reposition() public static method

Scale and move all Shapes and Contols within the GraphicsWindow. This method resizes and moves the view rather than the shapes, so their positions and other properties remain unchanged but appear scaled within the repositioned region. For example Shapes.GetLeft remains unchanged although the view has been repositioned and GraphicsWindow.MouseX reports the coordinates relative to the repositioned view. Imagine the entire view is repositioned as if it were a shape inside the GrapicsWindow. The transformation between view coordinates (vX,vY) and GraphicsWindow coordinates (gwX,gwY) is: gwX = (vX+panX)*scaleX + gw*(1-scaleX)/2 gwY = (vY+panY)*scaleY + gh*(1-scaleY)/2 All drawing remains within the original GraphicsWindow.
public static Reposition ( Primitive scaleX, Primitive scaleY, Primitive panX, Primitive panY, Primitive angle ) : void
scaleX Primitive The X direction scaling of the view.
scaleY Primitive The Y direction scaling of the view.
panX Primitive Pan the view in the X direction in the view scaling, 0 is centered in the GraphicsWindow.
panY Primitive Pan the view in the Y direction in the view scaling, 0 is centered in the GraphicsWindow.
angle Primitive An angle to rotate the view.
return void

RepositionPoint() public static method

Get coordinates transformed between GraphicsWindow and a repositioned View (See Reposition).
public static RepositionPoint ( Primitive x, Primitive y, Primitive toGW ) : Primitive
x Primitive The x coordinate to transform.
y Primitive The x coordinate to transform.
toGW Primitive Transfer from View to GraphicsWindow ("True") or from GraphicsWindow to View ("False").
return Primitive

ResumeUpdates() public static method

Resume GraphicsWindow Updates.
public static ResumeUpdates ( ) : void
return void

SetActive() public static method

Set the GraphicsWindow as active (has focus).
public static SetActive ( ) : void
return void

SetFontFromFile() public static method

Set font in GraphicsWindow from a local TTF font file.
public static SetFontFromFile ( Primitive fontFile ) : Primitive
fontFile Primitive Full path to font file to set.
return Primitive

TransparentGW() public static method

Create a transparent GraphicsWindow. This must be the called before any other GraphicsWindow, Controls or Shapes methods that create a window. To see anything you must add something to the transparent GraphicsWindow. For example, create a non-rectangular window using a transparent border png with LDShapes.BackgroundImage. The transparency can be altered with GraphicsWindow.BackgroundColor. Sometimes less than 100% transparency can be required (e.g. to register mouse movements).
public static TransparentGW ( ) : void
return void

Property Details

_ClosingDelegate public_oe static_oe property

public static SmallBasicCallback _ClosingDelegate
return SmallBasicCallback