Package ca.cgjennings.graphics.shapes
Class SubregionVectorImage
- java.lang.Object
-
- ca.cgjennings.graphics.shapes.AbstractVectorImage
-
- ca.cgjennings.graphics.shapes.SubregionVectorImage
-
- All Implemented Interfaces:
VectorImage
public class SubregionVectorImage extends AbstractVectorImage
A vector image that consists of a rectangular region within another vector image.- Since:
- 3.0
- Author:
- Chris Jennings
-
-
Field Summary
-
Fields inherited from class ca.cgjennings.graphics.shapes.AbstractVectorImage
ih, iw, tx, ty
-
-
Constructor Summary
Constructors Constructor Description SubregionVectorImage(AbstractVectorImage sourceImage, double x, double y, double width, double height)
Creates a new vector image that consists of a rectangular subregion of a source vector image.SubregionVectorImage(AbstractVectorImage sourceImage, java.awt.geom.Rectangle2D subregion)
Creates a new vector image that consists of a rectangular subregion of a source vector image.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description AbstractVectorImage
getSourceImage()
Returns the source image that this image is a subregion of.protected void
render(java.awt.Graphics2D g)
Renders the vector image into the specified graphics context.-
Methods inherited from class ca.cgjennings.graphics.shapes.AbstractVectorImage
createRasterImage, createRasterImage, getHeight, getWidth, paint, paint, paint
-
-
-
-
Constructor Detail
-
SubregionVectorImage
public SubregionVectorImage(AbstractVectorImage sourceImage, double x, double y, double width, double height)
Creates a new vector image that consists of a rectangular subregion of a source vector image.- Parameters:
sourceImage
- the image that this image is a subimage ofx
- the x-offset of the upper-left corner of the subregiony
- the y-offset of the upper-left corner of the subregionwidth
- the width of the subregionheight
- the height of the subregion
-
SubregionVectorImage
public SubregionVectorImage(AbstractVectorImage sourceImage, java.awt.geom.Rectangle2D subregion)
Creates a new vector image that consists of a rectangular subregion of a source vector image.- Parameters:
sourceImage
- the image that this image is a subimage ofsubregion
- a rectangle that defines the region of the source image covered by this image
-
-
Method Detail
-
getSourceImage
public AbstractVectorImage getSourceImage()
Returns the source image that this image is a subregion of.- Returns:
- the source image used to create this subimage
-
render
protected void render(java.awt.Graphics2D g)
Description copied from class:AbstractVectorImage
Renders the vector image into the specified graphics context. The upper left corner of the image should be at (-tx, -ty) and cover an area with widthAbstractVectorImage.iw
and heightAbstractVectorImage.ih
. Any changes to the state of the graphics context (stroke, paint, clip, etc.) must be restored before the method returns.- Specified by:
render
in classAbstractVectorImage
- Parameters:
g
- the graphics context to render the image into
-
-