Share via


Graphics.create

Class Overview | Class Members | This Package | All Packages

Syntax 1

public abstract Graphics create()

Returns

a new graphics context that is a copy of this graphics context.

Description

Creates a new Graphics object that is a copy of this Graphics object.

Syntax 2

public Graphics create( int x**, int** y**, int** width**, int** height )

Parameters
  • x
    the x coordinate.
  • y
    the y coordinate.
  • width
    the width of the clipping rectangle.
  • height
    the height of the clipping rectangle.
Returns

a new graphics context.

Description

Creates a new Graphics object based on this Graphics object, but with a new translation and clip area. The new Graphics object has its origin translated to the specified point (xy). Its clip area is determined by the intersection of the original clip area with the specified rectangle. The arguments are all interpreted in the coordinate system of the original Graphics object. The new graphics context is identical to the original, except in two respects:

  • The new graphics context is translated by (xy). That is to say, the point (00) in the new graphics context is the same as (xy) in the original graphics context.
  • The new graphics context has an additional clipping rectangle, in addition to whatever (translated) clipping rectangle it inherited from the original graphics context. The origin of the new clipping rectangle is at (00), and its size is specified by the width and height arguments.
See Also

translate, clipRect