sdljavax.gfx

Class SDLGfx

public class SDLGfx extends Object

Binding to the SDL_gfx library

Note: all ___Color routines expect the color to be in format 0xRRGGBBAA

Also note in the functions which take a list of points (ShortBuffer), the length is inferred from the size of the buffer, you do not have to specify it to the function, SDLGfx will take care of this for you. No checking is done to ensure vx.capacity() = vy[].capacity() so make sure they are the same length or the results could will most likely be a segfault.

Version: $Id: SDLGfx.java,v 1.10 2005/02/19 02:02:06 ivan_ganza Exp $

Author: Ivan Z. Ganza

Method Summary
static intaacircleColor(SDLSurface dst, int x, int y, int r, long color)
aacircleColor
static intaacircleRGBA(SDLSurface dst, int x, int y, int rad, int r, int g, int b, int a)
aacircleRGBA
static intaaellipseColor(SDLSurface dst, int xc, int yc, int rx, int ry, long color)
aaellipseColor
static intaaellipseRGBA(SDLSurface dst, int x, int y, int rx, int ry, int r, int g, int b, int a)
aaellipseRGBA
static intaalineColor(SDLSurface dst, int x1, int y1, int x2, int y2, long color)
aalineColor
static intaalineRGBA(SDLSurface dst, int x1, int y1, int x2, int y2, int r, int g, int b, int a)
aalineRGBA
static intaapolygonColor(SDLSurface dst, ShortBuffer vx, ShortBuffer vy, long color)
aapolygonColor
static intaapolygonRGBA(SDLSurface dst, ShortBuffer vx, ShortBuffer vy, short r, short g, short b, short a)
aapolygonRGBA
static intaatrigonColor(SDLSurface dst, int x1, int y1, int x2, int y2, int x3, int y3, long color)
aatrigonColor
static intaatrigonRGBA(SDLSurface dst, int x1, int y1, int x2, int y2, int x3, int y3, int r, int g, int b, int a)
aatrigonRGBA
static intbezierColor(SDLSurface dst, ShortBuffer vx, ShortBuffer vy, short s, long color)
bezierColor
static intbezierRGBA(SDLSurface dst, ShortBuffer vx, ShortBuffer vy, short s, short r, short g, short b, short a)
bezierRGBA
static intboxColor(SDLSurface dst, int x1, int y1, int x2, int y2, long color)
boxColor
static intboxRGBA(SDLSurface dst, int x1, int y1, int x2, int y2, int r, int g, int b, int a)
boxRGBA
static intcharacterColor(SDLSurface dst, int x, int y, char c, long color)
characterColor
static intcharacterRGBA(SDLSurface dst, int x, int y, char c, int r, int g, int b, int a)
characterRGBA
static intcircleColor(SDLSurface dst, int x, int y, int r, long color)
circleColor
static intcircleRGBA(SDLSurface dst, int x, int y, int rad, int r, int g, int b, int a)
circleRGBA
static intellipseColor(SDLSurface dst, int x, int y, int rx, int ry, long color)
ellipseColor
static intellipseRGBA(SDLSurface dst, int x, int y, int rx, int ry, int r, int g, int b, int a)
ellipseRGBA
static intfilledCircleColor(SDLSurface dst, int x, int y, int r, long color)
filledCircleColor
static intfilledCircleRGBA(SDLSurface dst, int x, int y, int rad, int r, int g, int b, int a)
filledCircleRGBA
static intfilledEllipseColor(SDLSurface dst, int x, int y, int rx, int ry, long color)
filledEllipseColor
static intfilledEllipseRGBA(SDLSurface dst, int x, int y, int rx, int ry, int r, int g, int b, int a)
filledEllipseRGBA
static intfilledpieColor(SDLSurface dst, int x, int y, int rad, int start, int end, long color)
filledpieColor
static intfilledpieRGBA(SDLSurface dst, int x, int y, int rad, int start, int end, int r, int g, int b, int a)
filledpieRGBA
static intfilledPolygonColor(SDLSurface dst, ShortBuffer vx, ShortBuffer vy, short color)
filledPolygonColor
static intfilledPolygonRGBA(SDLSurface dst, ShortBuffer vx, ShortBuffer vy, short r, short g, short b, short a)
filledPolygonRGBA
static intfilledTrigonColor(SDLSurface dst, int x1, int y1, int x2, int y2, int x3, int y3, int color)
filledTrigonColor
static intfilledTrigonRGBA(SDLSurface dst, int x1, int y1, int x2, int y2, int x3, int y3, int r, int g, int b, int a)
filledTrigonRGBA
static inthlineColor(SDLSurface dst, int x1, int x2, int y, long color)
hlineColor
static inthlineRGBA(SDLSurface dst, int x1, int x2, int y, int r, int g, int b, int a)
hlineRGBA
static intlineColor(SDLSurface dst, int x1, int y1, int x2, int y2, long color)
lineColor
static intlineRGBA(SDLSurface dst, int x1, int y1, int x2, int y2, int r, int g, int b, int a)
lineRGBA
static intpixelColor(SDLSurface dst, int x, int y, long color)
pixelColor
static intpixelRGBA(SDLSurface dst, int x, int y, int r, int g, int b, int a)
pixelRGBA
static intpolygonColor(SDLSurface dst, ShortBuffer vx, ShortBuffer vy, long color)
polygonColor
static intpolygonRGBA(SDLSurface dst, ShortBuffer vx, ShortBuffer vy, short r, short g, short b, short a)
polygonRGBA
static intrectangleColor(SDLSurface dst, int x1, int y1, int x2, int y2, long color)
rectangleColor
static intrectangleRGBA(SDLSurface dst, int x1, int y1, int x2, int y2, int r, int g, int b, int a)
rectangleRGBA
static SDLSurfacerotozoomSurface(SDLSurface src, double angle, double zoom, boolean smooth)
Rotates and zoomes a 32bit or 8bit 'src' surface to newly created 'dst' surface.
static DimensionrotozoomSurfaceSize(int width, int height, double angle, double zoom)
Compute the size that would be required to hold the surface after the zoom
static intstringColor(SDLSurface dst, int x, int y, String c, long color)
stringColor
static intstringRGBA(SDLSurface dst, int x, int y, String c, int r, int g, int b, int a)
stringRGBA
static inttrigonColor(SDLSurface dst, int x1, int y1, int x2, int y2, int x3, int y3, long color)
trigonColor
static inttrigonRGBA(SDLSurface dst, int x1, int y1, int x2, int y2, int x3, int y3, int r, int g, int b, int a)
trigonRGBA
static intvlineColor(SDLSurface dst, int x, int y1, int y2, long color)
vlineColor
static intvlineRGBA(SDLSurface dst, int x, int y1, int y2, int r, int g, int b, int a)
vlineRGBA
static SDLSurfacezoomSurface(SDLSurface src, double zoomx, double zoomy, boolean smooth)
Zoomes a 32bit or 8bit 'src' surface to newly created 'dst' surface.
static DimensionzoomSurfaceSize(int width, int height, double zoomx, double zoomy)
Compute the size that would be required to hold the surface after the zoom

Method Detail

aacircleColor

public static int aacircleColor(SDLSurface dst, int x, int y, int r, long color)
aacircleColor

Parameters: dst a SDLSurface value x a int value y a int value r a int value color a long value

Returns: an int value

aacircleRGBA

public static int aacircleRGBA(SDLSurface dst, int x, int y, int rad, int r, int g, int b, int a)
aacircleRGBA

Parameters: dst a SDLSurface value x a int value y a int value rad a int value r a int value g a int value b a int value a a int value

Returns: an int value

aaellipseColor

public static int aaellipseColor(SDLSurface dst, int xc, int yc, int rx, int ry, long color)
aaellipseColor

Parameters: dst a SDLSurface value xc a int value yc a int value rx a int value ry a int value color a long value

Returns: an int value

aaellipseRGBA

public static int aaellipseRGBA(SDLSurface dst, int x, int y, int rx, int ry, int r, int g, int b, int a)
aaellipseRGBA

Parameters: dst a SDLSurface value x a int value y a int value rx a int value ry a int value r a int value g a int value b a int value a a int value

Returns: an int value

aalineColor

public static int aalineColor(SDLSurface dst, int x1, int y1, int x2, int y2, long color)
aalineColor

Parameters: dst a SDLSurface value (short)x1 a int value (short)y1 a int value (short)x2 a int value (short)y2 a int value color a long value

Returns: an int value

aalineRGBA

public static int aalineRGBA(SDLSurface dst, int x1, int y1, int x2, int y2, int r, int g, int b, int a)
aalineRGBA

Parameters: dst a SDLSurface value (short)x1 a int value (short)y1 a int value (short)x2 a int value (short)y2 a int value r a int value g a int value b a int value a a int value

Returns: an int value

aapolygonColor

public static int aapolygonColor(SDLSurface dst, ShortBuffer vx, ShortBuffer vy, long color)
aapolygonColor

Parameters: dst a SDLSurface value vx a int[] value vy a int[] value n an int value color a long value

Returns: an int value

aapolygonRGBA

public static int aapolygonRGBA(SDLSurface dst, ShortBuffer vx, ShortBuffer vy, short r, short g, short b, short a)
aapolygonRGBA

Parameters: dst a SDLSurface value vx a ShortBuffer value vy a ShortBuffer value r a int value g a int value b a int value a a int value

Returns: an int value

aatrigonColor

public static int aatrigonColor(SDLSurface dst, int x1, int y1, int x2, int y2, int x3, int y3, long color)
aatrigonColor

Parameters: dst a SDLSurface value (short)x1 a int value (short)y1 a int value (short)x2 a int value (short)y2 a int value x3 a int value y3 a int value color a long value

Returns: an int value

aatrigonRGBA

public static int aatrigonRGBA(SDLSurface dst, int x1, int y1, int x2, int y2, int x3, int y3, int r, int g, int b, int a)
aatrigonRGBA

Parameters: dst a SDLSurface value (short)x1 a int value (short)y1 a int value (short)x2 a int value (short)y2 a int value x3 a int value y3 a int value r a int value g a int value b a int value a a int value

Returns: an int value

bezierColor

public static int bezierColor(SDLSurface dst, ShortBuffer vx, ShortBuffer vy, short s, long color)
bezierColor

Parameters: dst a SDLSurface value vx a ShortBuffer value vy a ShortBuffer value s an int value color a long value

Returns: an int value

Throws: SDLException if an error occurs

bezierRGBA

public static int bezierRGBA(SDLSurface dst, ShortBuffer vx, ShortBuffer vy, short s, short r, short g, short b, short a)
bezierRGBA

Parameters: dst a SDLSurface value vx a ShortBuffer value vy a ShortBuffer value s an int value r a int value g a int value b a int value a a int value

Returns: an int value

boxColor

public static int boxColor(SDLSurface dst, int x1, int y1, int x2, int y2, long color)
boxColor

Parameters: dst a SDLSurface value x1 a int value y1 a int value x2 a int value y2 a int value color a long value

Returns: an int value

boxRGBA

public static int boxRGBA(SDLSurface dst, int x1, int y1, int x2, int y2, int r, int g, int b, int a)
boxRGBA

Parameters: dst a SDLSurface value x1 a int value y1 a int value x2 a int value y2 a int value r a int value g a int value b a int value a a int value

Returns: an int value

characterColor

public static int characterColor(SDLSurface dst, int x, int y, char c, long color)
characterColor

Parameters: dst a SDLSurface value x a int value y a int value c a char value color a long value

Returns: an int value

characterRGBA

public static int characterRGBA(SDLSurface dst, int x, int y, char c, int r, int g, int b, int a)
characterRGBA

Parameters: dst a SDLSurface value x a int value y a int value c a char value r a int value g a int value b a int value a a int value

Returns: an int value

circleColor

public static int circleColor(SDLSurface dst, int x, int y, int r, long color)
circleColor

Parameters: dst a SDLSurface value x a int value y a int value r a int value color a long value

Returns: an int value

circleRGBA

public static int circleRGBA(SDLSurface dst, int x, int y, int rad, int r, int g, int b, int a)
circleRGBA

Parameters: dst a SDLSurface value x a int value y a int value rad a int value r a int value g a int value b a int value a a int value

Returns: an int value

ellipseColor

public static int ellipseColor(SDLSurface dst, int x, int y, int rx, int ry, long color)
ellipseColor

Parameters: dst a SDLSurface value x a int value y a int value rx a int value ry a int value color a long value

Returns: an int value

ellipseRGBA

public static int ellipseRGBA(SDLSurface dst, int x, int y, int rx, int ry, int r, int g, int b, int a)
ellipseRGBA

Parameters: dst a SDLSurface value x a int value y a int value rx a int value ry a int value r a int value g a int value b a int value a a int value

Returns: an int value

filledCircleColor

public static int filledCircleColor(SDLSurface dst, int x, int y, int r, long color)
filledCircleColor

Parameters: dst a SDLSurface value x a int value y a int value r a int value color a long value

Returns: an int value

filledCircleRGBA

public static int filledCircleRGBA(SDLSurface dst, int x, int y, int rad, int r, int g, int b, int a)
filledCircleRGBA

Parameters: dst a SDLSurface value x a int value y a int value rad a int value r a int value g a int value b a int value a a int value

Returns: an int value

filledEllipseColor

public static int filledEllipseColor(SDLSurface dst, int x, int y, int rx, int ry, long color)
filledEllipseColor

Parameters: dst a SDLSurface value x a int value y a int value rx a int value ry a int value color a long value

Returns: an int value

filledEllipseRGBA

public static int filledEllipseRGBA(SDLSurface dst, int x, int y, int rx, int ry, int r, int g, int b, int a)
filledEllipseRGBA

Parameters: dst a SDLSurface value x a int value y a int value rx a int value ry a int value r a int value g a int value b a int value a a int value

Returns: an int value

filledpieColor

public static int filledpieColor(SDLSurface dst, int x, int y, int rad, int start, int end, long color)
filledpieColor

Parameters: dst a SDLSurface value x a int value y a int value rad a int value start a int value end a int value color a long value

Returns: an int value

filledpieRGBA

public static int filledpieRGBA(SDLSurface dst, int x, int y, int rad, int start, int end, int r, int g, int b, int a)
filledpieRGBA

Parameters: dst a SDLSurface value x a int value y a int value rad a int value start a int value end a int value r a int value g a int value b a int value a a int value

Returns: an int value

filledPolygonColor

public static int filledPolygonColor(SDLSurface dst, ShortBuffer vx, ShortBuffer vy, short color)
filledPolygonColor

Parameters: dst a SDLSurface value vx a ShortBuffer value vy a ShortBuffer value color an int value

Returns: an int value

filledPolygonRGBA

public static int filledPolygonRGBA(SDLSurface dst, ShortBuffer vx, ShortBuffer vy, short r, short g, short b, short a)
filledPolygonRGBA

Parameters: dst a SDLSurface value vx a ShortBuffer value vy a ShortBuffer value r a int value g a int value b a int value a a int value

Returns: an int value

filledTrigonColor

public static int filledTrigonColor(SDLSurface dst, int x1, int y1, int x2, int y2, int x3, int y3, int color)
filledTrigonColor

Parameters: dst a SDLSurface value (short)x1 a int value (short)y1 a int value (short)x2 a int value (short)y2 a int value x3 a int value y3 a int value color an int value

Returns: an int value

filledTrigonRGBA

public static int filledTrigonRGBA(SDLSurface dst, int x1, int y1, int x2, int y2, int x3, int y3, int r, int g, int b, int a)
filledTrigonRGBA

Parameters: dst a SDLSurface value (short)x1 a int value (short)y1 a int value (short)x2 a int value (short)y2 a int value x3 a int value y3 a int value r a int value g a int value b a int value a a int value

Returns: an int value

hlineColor

public static int hlineColor(SDLSurface dst, int x1, int x2, int y, long color)
hlineColor

Parameters: dst a SDLSurface value x1 a int value x2 a int value y a int value color a long value

Returns: an int value

hlineRGBA

public static int hlineRGBA(SDLSurface dst, int x1, int x2, int y, int r, int g, int b, int a)
hlineRGBA

Parameters: dst a SDLSurface value x1 a int value x2 a int value y a int value r a int value g a int value b a int value a a int value

Returns: an int value

lineColor

public static int lineColor(SDLSurface dst, int x1, int y1, int x2, int y2, long color)
lineColor

Parameters: dst a SDLSurface value x1 a int value y1 a int value x2 a int value y2 a int value color a long value

Returns: an int value

lineRGBA

public static int lineRGBA(SDLSurface dst, int x1, int y1, int x2, int y2, int r, int g, int b, int a)
lineRGBA

Parameters: dst a SDLSurface value (short)x1 a int value (short)y1 a int value (short)x2 a int value (short)y2 a int value r a int value g a int value b a int value a a int value

Returns: an int value

pixelColor

public static int pixelColor(SDLSurface dst, int x, int y, long color)
pixelColor

Parameters: dst a SDLSurface value x an int value y an int value color a long value

Returns: an int value

pixelRGBA

public static int pixelRGBA(SDLSurface dst, int x, int y, int r, int g, int b, int a)
pixelRGBA

Parameters: dst a SDLSurface value x a short value y a short value r a short value g a short value b a short value a a short value

Returns: an int value

polygonColor

public static int polygonColor(SDLSurface dst, ShortBuffer vx, ShortBuffer vy, long color)
polygonColor

Parameters: dst a SDLSurface value vx a ShortBuffer value vy a ShortBuffer value color a long value

Returns: an int value

polygonRGBA

public static int polygonRGBA(SDLSurface dst, ShortBuffer vx, ShortBuffer vy, short r, short g, short b, short a)
polygonRGBA

Parameters: dst a SDLSurface value vx a ShortBuffer value vy a ShortBuffer value r a int value g a int value b a int value a a int value

Returns: an int value

rectangleColor

public static int rectangleColor(SDLSurface dst, int x1, int y1, int x2, int y2, long color)
rectangleColor

Parameters: dst a SDLSurface value x1 a int value y1 a int value x2 a int value y2 a int value color a long value

Returns: an int value

rectangleRGBA

public static int rectangleRGBA(SDLSurface dst, int x1, int y1, int x2, int y2, int r, int g, int b, int a)
rectangleRGBA

Parameters: dst a SDLSurface value x1 a int value y1 a int value x2 a int value y2 a int value r a int value g a int value b a int value a a int value

Returns: an int value

rotozoomSurface

public static SDLSurface rotozoomSurface(SDLSurface src, double angle, double zoom, boolean smooth)
Rotates and zoomes a 32bit or 8bit 'src' surface to newly created 'dst' surface. 'angle' is the rotation in degrees. 'zoom' a scaling factor. If 'smooth' is true then the destination 32bit surface is anti-aliased. If the surface is not 8bit or 32bit RGBA/ABGR it will be converted into a 32bit RGBA format on the fly.

Parameters: src a SDLSurface value angle a double value zoom a double value smooth an int value

Returns: a SDLSurface value

Throws: SDLException if an error occurs

rotozoomSurfaceSize

public static Dimension rotozoomSurfaceSize(int width, int height, double angle, double zoom)
Compute the size that would be required to hold the surface after the zoom

Parameters: width an int value height an int value angle a double value zoom a double value

Returns: a Dimension value

Throws: SDLException if an error occurs

stringColor

public static int stringColor(SDLSurface dst, int x, int y, String c, long color)
stringColor

Parameters: dst a SDLSurface value x a int value y a int value c a String value color a long value

Returns: an int value

stringRGBA

public static int stringRGBA(SDLSurface dst, int x, int y, String c, int r, int g, int b, int a)
stringRGBA

Parameters: dst a SDLSurface value x a int value y a int value c a String value r a int value g a int value b a int value a a int value

Returns: an int value

trigonColor

public static int trigonColor(SDLSurface dst, int x1, int y1, int x2, int y2, int x3, int y3, long color)
trigonColor

Parameters: dst a SDLSurface value (short)x1 a int value (short)y1 a int value (short)x2 a int value (short)y2 a int value x3 a int value y3 a int value color a long value

Returns: an int value

trigonRGBA

public static int trigonRGBA(SDLSurface dst, int x1, int y1, int x2, int y2, int x3, int y3, int r, int g, int b, int a)
trigonRGBA

Parameters: dst a SDLSurface value (short)x1 a int value (short)y1 a int value (short)x2 a int value (short)y2 a int value x3 a int value y3 a int value r a int value g a int value b a int value a a int value

Returns: an int value

vlineColor

public static int vlineColor(SDLSurface dst, int x, int y1, int y2, long color)
vlineColor

Parameters: dst a SDLSurface value x a int value y1 a int value y2 a int value color a long value

Returns: an int value

vlineRGBA

public static int vlineRGBA(SDLSurface dst, int x, int y1, int y2, int r, int g, int b, int a)
vlineRGBA

Parameters: dst a SDLSurface value x a int value y1 a int value y2 a int value r a int value g a int value b a int value a a int value

Returns: an int value

zoomSurface

public static SDLSurface zoomSurface(SDLSurface src, double zoomx, double zoomy, boolean smooth)
Zoomes a 32bit or 8bit 'src' surface to newly created 'dst' surface. 'zoomx' and 'zoomy' are scaling factors for width and height. If 'smooth' is true then the destination 32bit surface is anti-aliased. If the surface is not 8bit or 32bit RGBA/ABGR it will be converted into a 32bit RGBA format on the fly.

Parameters: src a SDLSurface value zoomx a double value zoomy a double value smooth an int value

Returns: a SDLSurface value

Throws: SDLException if an error occurs

zoomSurfaceSize

public static Dimension zoomSurfaceSize(int width, int height, double zoomx, double zoomy)
Compute the size that would be required to hold the surface after the zoom

Parameters: width an int value height an int value zoomx a double value zoomy a double value

Returns:

Throws: SDLException if an error occurs