Package com.ms.awt Previous
Previous
Microsoft Packages
Microsoft Packages
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);
}

A class then encapsulates an extended graphics object


Constructors


GraphicsX

public GraphicsX(Win32PrintJob pj) 

Create a graphics object for a print job.

ParameterDescription
pj The print job.

See Also: Win32PrintJob


GraphicsX

public GraphicsX(GraphicsX g) 

Create a graphics object based on another graphics object.

ParameterDescription
g The graphics object.


GraphicsX

public GraphicsX(Win32Graphics g) 

Create a graphics object based on another graphics object.

ParameterDescription
g The graphics object.

See Also: Win32Graphics


GraphicsX

public GraphicsX(MComponentPeer comp) 

Create a graphics object for a component.

ParameterDescription
comp The component.

See Also: MComponentPeer


GraphicsX

public GraphicsX(Win32Image image) 

Create a graphics object for an off-screen image.

ParameterDescription
image The off-screen image.

See Also: Win32Image


Methods


gethdc

public int gethdc()

Retrieve 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.

See Also: 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 draw.
offset Offset of the first character in the data array to be drawn.
length Number of characters to draw.
x and y The position to draw the first character.


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 draw.
offset Offset of the first character in the data array to be drawn.
length Number of characters to draw.
x and y The position to draw the first character.


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 draw.
offset Offset of the first value in the data array to be drawn.
length Number of characters to draw.
x and y The position to draw the first character.


drawString

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

Draws the given string.

Return Value:

No return value.

ParameterDescription
str The string to draw.
x and y The position to draw the string.


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 The string to draw.
x and y The position to draw the string.


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 draw.
offset Offset of the first value in the data array to be drawn.
length Number of characters to draw.
x and y The position to draw the first character.


getGlyphOutline

public GlyphOutline getGlyphOutline(char ch)

Gets 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 The character whose outline is requested.


drawOutlinePolygon

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

Draws an outline polygon.

ParameterDescription
xOrig The horizontal starting point for the shape.
yOrig The vertical starting point for the shape.
op The outline polygon.



Top© 1996 Microsoft Corporation. All rights reserved.