APIdia Launch Partner
Top Description Inners Fields Constructors Methods
javax.swing.plaf.nimbus

pack-priv Class ImageScalingHelper

extends Object
Class Inheritance
Imports
java.awt.Graphics, .Image, .Insets

ImageScalingHelper
Author
Created by Jasper Potts (Aug 8, 2007)

Nested and Inner Type Summary

Modifier and TypeClass and Description
pack-priv static enum
ImageScalingHelper.PaintType

Enumeration for the types of painting this class can handle.

Field Summary

Modifier and TypeField and Description
private static final Insets
pack-priv static final int
PAINT_ALL

Specifies that all regions should be painted.

pack-priv static final int
pack-priv static final int
pack-priv static final int
pack-priv static final int
pack-priv static final int
pack-priv static final int
pack-priv static final int
pack-priv static final int
pack-priv static final int

Constructor Summary

AccessConstructor and Description
pack-priv

Method Summary

Modifier and TypeMethod and Description
private static void
drawChunk(Image
Image to render.
image
,
Graphics
Graphics to render to
g
,
boolean
Whether the image should be stretched or timed in the provided space.
stretch
,
int
X origin to draw to
dx1
,
int
Y origin to draw to
dy1
,
int
End x location to draw to
dx2
,
int
End y location to draw to
dy2
,
int
X origin to draw from
sx1
,
int
Y origin to draw from
sy1
,
int
Max x location to draw from
sx2
,
int
Max y location to draw from
sy2
,
boolean
Used if the image is not stretched. If true it indicates the image should be tiled along the x axis.
xDirection
)

Draws a portion of an image, stretched or tiled.

private static void
drawImage(Image image, Graphics g, int dx1, int dy1, int dx2, int dy2, int sx1, int sy1, int sx2, int sy2)

public static void
paint(Graphics
Graphics to render to
g
,
int
X-coordinate
x
,
int
Y-coordinate
y
,
int
Width to render to
w
,
int
Height to render to
h
,
Image
Image to render from, if null this method will do nothing
image
,
Insets
Insets specifying the portion of the image that will be stretched or tiled, if null empty Insets will be used.
sInsets
,
Insets
Destination insets specifying the portion of the image will be stretched or tiled, if null empty Insets will be used.
dInsets
,
ImageScalingHelper.PaintType
Specifies what type of algorithm to use in painting
paintType
,
int
Specifies portion of image to render, if PAINT_ALL is specified, any other regions specified will not be painted, for example PAINT_ALL | PAINT_CENTER paints everything but the center.
mask
)

Paints using the algorithm specified by paintType.

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

EMPTY_INSETSback to summary
private static final Insets EMPTY_INSETS
PAINT_ALLback to summary
pack-priv static final int PAINT_ALL

Specifies that all regions should be painted. If this is set any other regions specified will not be painted. For example PAINT_ALL | PAINT_CENTER will paint all but the center.

PAINT_BOTTOMback to summary
pack-priv static final int PAINT_BOTTOM
PAINT_BOTTOM_LEFTback to summary
pack-priv static final int PAINT_BOTTOM_LEFT
PAINT_BOTTOM_RIGHTback to summary
pack-priv static final int PAINT_BOTTOM_RIGHT
PAINT_CENTERback to summary
pack-priv static final int PAINT_CENTER
PAINT_LEFTback to summary
pack-priv static final int PAINT_LEFT
PAINT_RIGHTback to summary
pack-priv static final int PAINT_RIGHT
PAINT_TOPback to summary
pack-priv static final int PAINT_TOP
PAINT_TOP_LEFTback to summary
pack-priv static final int PAINT_TOP_LEFT
PAINT_TOP_RIGHTback to summary
pack-priv static final int PAINT_TOP_RIGHT

Constructor Detail

ImageScalingHelperback to summary
pack-priv ImageScalingHelper()

Method Detail

drawChunkback to summary
private static void drawChunk(Image image, Graphics g, boolean stretch, int dx1, int dy1, int dx2, int dy2, int sx1, int sy1, int sx2, int sy2, boolean xDirection)

Draws a portion of an image, stretched or tiled.

Parameters
image:Image

Image to render.

g:Graphics

Graphics to render to

stretch:boolean

Whether the image should be stretched or timed in the provided space.

dx1:int

X origin to draw to

dy1:int

Y origin to draw to

dx2:int

End x location to draw to

dy2:int

End y location to draw to

sx1:int

X origin to draw from

sy1:int

Y origin to draw from

sx2:int

Max x location to draw from

sy2:int

Max y location to draw from

xDirection:boolean

Used if the image is not stretched. If true it indicates the image should be tiled along the x axis.

drawImageback to summary
private static void drawImage(Image image, Graphics g, int dx1, int dy1, int dx2, int dy2, int sx1, int sy1, int sx2, int sy2)
paintback to summary
public static void paint(Graphics g, int x, int y, int w, int h, Image image, Insets sInsets, Insets dInsets, ImageScalingHelper.PaintType paintType, int mask)

Paints using the algorithm specified by paintType.

Parameters
g:Graphics

Graphics to render to

x:int

X-coordinate

y:int

Y-coordinate

w:int

Width to render to

h:int

Height to render to

image:Image

Image to render from, if null this method will do nothing

sInsets:Insets

Insets specifying the portion of the image that will be stretched or tiled, if null empty Insets will be used.

dInsets:Insets

Destination insets specifying the portion of the image will be stretched or tiled, if null empty Insets will be used.

paintType:ImageScalingHelper.PaintType

Specifies what type of algorithm to use in painting

mask:int

Specifies portion of image to render, if PAINT_ALL is specified, any other regions specified will not be painted, for example PAINT_ALL | PAINT_CENTER paints everything but the center.

javax.swing.plaf.nimbus back to summary

pack-priv final Enum ImageScalingHelper.PaintType

extends Enum<ImageScalingHelper.PaintType>
Class Inheritance

Enumeration for the types of painting this class can handle.

Field Summary

Modifier and TypeField and Description
public static final ImageScalingHelper.PaintType
CENTER

Painting type indicating the image should be centered in the space provided.

public static final ImageScalingHelper.PaintType
PAINT9_STRETCH

Painting type indicating the image should be split into nine regions with the top, left, bottom and right areas stretched.

public static final ImageScalingHelper.PaintType
PAINT9_TILE

Painting type indicating the image should be split into nine regions with the top, left, bottom and right areas tiled.

public static final ImageScalingHelper.PaintType
TILE

Painting type indicating the image should be tiled across the specified width and height.

Constructor Summary

AccessConstructor and Description
private

Method Summary

Modifier and TypeMethod and Description
public static ImageScalingHelper.PaintType
public static ImageScalingHelper.PaintType[]
Inherited from java.lang.Enum:
clonecompareTodescribeConstableequalsfinalizegetDeclaringClasshashCodenameordinaltoStringvalueOf

Field Detail

CENTERback to summary
public static final ImageScalingHelper.PaintType CENTER

Painting type indicating the image should be centered in the space provided. When used the mask is ignored.

PAINT9_STRETCHback to summary
public static final ImageScalingHelper.PaintType PAINT9_STRETCH

Painting type indicating the image should be split into nine regions with the top, left, bottom and right areas stretched.

PAINT9_TILEback to summary
public static final ImageScalingHelper.PaintType PAINT9_TILE

Painting type indicating the image should be split into nine regions with the top, left, bottom and right areas tiled.

TILEback to summary
public static final ImageScalingHelper.PaintType TILE

Painting type indicating the image should be tiled across the specified width and height. When used the mask is ignored.

Constructor Detail

PaintTypeback to summary
private PaintType()

Method Detail

valueOfback to summary
public static ImageScalingHelper.PaintType valueOf(String name)
valuesback to summary
public static ImageScalingHelper.PaintType[] values()