sdl.test
Class TestVideo3
java.lang.Object
|
+--sdl.test.TestVideo3
- public class TestVideo3
- extends java.lang.Object
Demo of direct pixel access to draw 5 vertical lines on the screen.
My early attempts to test the pixel color.
You should see 5 lines of different color. There is likely a bug in the pixel
rendering JNI code somewhere.
Idealy the same RGB value will do make the same color whether you are using
8,16,24 bits of color. Unfortunately, now if you change the color depth,
you will get completely different color lines.
Scott Straw
8/02/02
Method Summary |
static short |
createHiColor(sdl.video.SDLPixelFormat fmt,
byte red,
byte green,
byte blue)
|
static void |
drawLine(sdl.video.SDLSurface surface,
int x1,
int y1,
int width,
int height)
|
static void |
drawPixel(int x,
int y)
draws a pixel of the current color. |
static void |
drawRect(sdl.video.SDLSurface surface,
int x1,
int y1,
int width,
int height)
|
static void |
fillRect(sdl.video.SDLSurface surface,
int x1,
int y1,
int width,
int height)
|
static sdl.video.SDLColor |
getPixelColorAt(int offset)
|
static byte[] |
getShort(short s)
|
static void |
main(java.lang.String[] args)
|
static void |
setColor(int b,
int g,
int r)
|
static void |
setPixelColorAt(int pixelOffset,
int r,
int g,
int b)
|
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
pixel_color
public static int pixel_color
aSurface
public static sdl.video.SDLSurface aSurface
TestVideo3
public TestVideo3()
createHiColor
public static short createHiColor(sdl.video.SDLPixelFormat fmt,
byte red,
byte green,
byte blue)
getShort
public static byte[] getShort(short s)
main
public static void main(java.lang.String[] args)
getPixelColorAt
public static sdl.video.SDLColor getPixelColorAt(int offset)
setPixelColorAt
public static void setPixelColorAt(int pixelOffset,
int r,
int g,
int b)
setColor
public static void setColor(int b,
int g,
int r)
drawPixel
public static void drawPixel(int x,
int y)
- draws a pixel of the current color.
notice the pixels are converted to byte in the following buffer
aSurface.m_Pixels[offset] = (byte)colorByte;
drawLine
public static void drawLine(sdl.video.SDLSurface surface,
int x1,
int y1,
int width,
int height)
drawRect
public static void drawRect(sdl.video.SDLSurface surface,
int x1,
int y1,
int width,
int height)
fillRect
public static void fillRect(sdl.video.SDLSurface surface,
int x1,
int y1,
int width,
int height)