Package com.ms.awt Previous
Previous
Contents
Contents
Index
Index
Next
Next

Class GraphicsX

Constructors , Methods

public class GraphicsX extends Win32Graphics 
{
	// Constructors
	public GraphicsX(Win32PrintJob pj);
	public GraphicsX(GraphicsX g);
	public GraphicsX(Win32Graphics g);
	public GraphicsX(MComponentPeer comp);
	public GraphicsX(Win32Image image);

	// Methods
	public int gethdc();
	public void setFont(Font font);
	public void drawChars(char data[], int offset, int length, int x, int y);
	public int drawCharsWidth(char data[], int offset, int length, int x, int y);
	public void drawBytes(byte data[], int offset, int length, int x, int y);
	public void drawString(String str, int x, int y);
	public int drawStringWidth(String str, int x, int y);
	public int drawBytesWidth(byte data[], int offset, int length, int x, int y);
	public GlyphOutline getGlyphOutline(char ch);
	public void drawOutlinePolygon(int xOrig, int yOrig, OutlinePolygon op);
}

Encapsulates an extended graphics object.


Constructors


GraphicsX

public GraphicsX(Win32PrintJob pj); 

Creates a graphics object for a print job.

ParameterDescription
pj Print job which the object is created for.


GraphicsX

public GraphicsX(GraphicsX g); 

Creates a graphics object based on another graphics object.

ParameterDescription
g The graphics object.


GraphicsX

public GraphicsX(Win32Graphics g); 

Creates a graphics object based on another graphics object.

ParameterDescription
g The graphics object.


GraphicsX

public GraphicsX(MComponentPeer comp); 

Creates a graphics object for a component.

ParameterDescription
comp Component for which the object will be created.


GraphicsX

public GraphicsX(Win32Image image); 

Creates a graphics object for an off-screen image.

ParameterDescription
image Off-screen image for which the object will be created.


Methods


gethdc

public int gethdc();

Retrieves the Win32 display context handle.

Return Value:

Returns the display context handle.


setFont

public void setFont(Font font);

Sets the font for all subsequent text-drawing operations.

ParameterDescription
font The specified font.


drawChars

public void drawChars(char data[], int offset, int length, int x, int y);

Draws the given character array.

Return Value:

No return value.

ParameterDescription
data Characters to be drawn.
offset Offset of the first character in the data array to be drawn.
length Number of characters to be drawn.
x and y The x- and y-coordinates of the position where the first character will be drawn.


drawCharsWidth

public int drawCharsWidth(char data[], int offset, int length, int x, int y);

Draws the given character array and returns the width in pixels of all characters drawn.

Return Value:

Returns the width. If font is not set, returns -1.

ParameterDescription
data Characters to be drawn.
offset Offset of the first character in the data array to be drawn.
length Number of characters to be drawn.
x and y The x- and y-coordinates of the position where the first character will be drawn.


drawBytes

public void drawBytes(byte data[], int offset, int length, int x, int y);

Draws the given byte array.

Return Value:

No return value.

ParameterDescription
data Byte values of characters to be drawn.
offset Offset of the first value in the data array to be drawn.
length Number of characters to be drawn.
x and y The x- and y-coordinates of the position where the first character will be drawn.


drawString

public void drawString(String str, int x, int y);

Draws the given string.

Return Value:

No return value.

ParameterDescription
str String to be drawn.
x and y The x- and y-coordinates of the position where the string will be drawn.


drawStringWidth

public int drawStringWidth(String str, int x, int y);

Draws the given string and returns the length of the drawn string in pixels.

Return Value:

Returns the width. If font is not set, returns -1.

ParameterDescription
str String to be drawn.
x and y The x- and y-coordinates of the position where the string will be drawn.


drawBytesWidth

public int drawBytesWidth(byte data[], int offset, int length, int x, int y);

Draws the given character array and return the width in pixels.

Return Value:

Returns the width. If font is not set, returns -1.

ParameterDescription
data Byte values of characters to be drawn.
offset Offset of the first value in the data array to be drawn.
length Number of characters to be drawn.
x and y The x- and y-coordinates of the position where the first character will be drawn.


getGlyphOutline

public GlyphOutline getGlyphOutline(char ch);

Retrieves the outline of a character in the currently selected font.

Return Value:

Returns an OutlinePolygon object. If the font is not an outline font, returns null.

ParameterDescription
ch Character whose outline is requested.


drawOutlinePolygon

public void drawOutlinePolygon(int xOrig, int yOrig, OutlinePolygon op);

Draws an outline polygon.

ParameterDescription
xOrig Horizontal starting point for the shape.
yOrig Vertical starting point for the shape.
op Outline polygon to be drawn.



Top© 1997 Microsoft Corporation. All rights reserved. Legal Notices.