|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--sdl.video.SDLSurface
Represents a chunk of memory that may be drawn on.
There are three layers to this memory: The Java level buffer, the SDL level buffer, and if the SDLSurface represents a screen, a onscreen video buffer.
m_Pixels contains the Java level buffer. Call updateRawPixels() to update the SDL level buffer with the contents of the Java level buffer. It is nesecary to do this before calling functions that manipulate the SDL level buffer, such as blitSurface(), updateRect(), flip(), saveToBMP(), convertSurface(), fillRect() and possibly others.
Call flip() or updateRect() to transfer the SDL level buffer to the onscreen video buffer. You can call updateRawPixelsAndAllArea() to update both the SDL buffer and the onscreen video buffer in one step.
The easiest way to create a new pixel is with the convenience routinemapRGB(red,green,blue);
Addressing a pixel in the SDL buffer is done as follows
int byteCount= surface.m_Format.m_BytesPerPixel int realStartByteOffset = (surface.m_Pitch * y + (x*byteCount))
SDLPixelFormat
Field Summary | |
static boolean |
DBG
|
SDLRect |
m_ClipRect
Not sure... |
int |
m_Flags
Flags passed to Video.createRGBSurface(). |
SDLPixelFormat |
m_Format
Pixel format used by this surface. |
int |
m_Height
Height in pixels |
short |
m_Pitch
Bytes per scanline. |
byte[] |
m_Pixels
Java-level pixel buffer. |
int |
m_Width
Width in pixels. |
Constructor Summary | |
SDLSurface(int handle)
Do not use directly, use Video.createRGBSurface() instead. |
|
SDLSurface(java.lang.String fileNameBMP)
|
Method Summary | |
void |
blitSurface(SDLRect src,
SDLSurface destSurface,
SDLRect dest)
Blit pixels from this to destSurface. |
SDLSurface |
convertSurface(SDLPixelFormat format,
int flags)
Convert a surface from one pixel format to another, and as change flags. |
SDLOverlay |
createYUVOverlay(int width,
int height,
int format)
|
int |
displayFormat()
|
SDLSurface |
displayFormatAlpha()
|
boolean |
fillRect(int x,
int y,
int width,
int height,
int color)
Fills specified rectangle with color |
boolean |
fillRect(SDLRect rect,
int color)
Fills specified rectangle with color. |
protected void |
finalize()
|
int |
flip()
Using hardware accelaration if possible, transfer the SDL level buffer onto the onscreen video buffer. |
void |
freeSurface()
Deallocate this surface. |
SDLRect |
getClipRect()
|
int |
getHandle()
Returns the handle for this surface. |
int |
mapRGB(byte red,
byte green,
byte blue)
Returns a system dependant integer pixel value based on the RGB values. |
boolean |
saveToBMP(java.lang.String fileName)
Dump this surface to a Microsoft Windows Bitmap file. |
int |
setAlpha(int flags,
byte alpha)
|
void |
setClipRect(int x,
int y,
int w,
int h)
|
void |
setClipRect(SDLRect rect)
|
int |
setColor(SDLColor[] color,
int firstColor,
int nbColors)
|
void |
setColorKey(int flags,
int colorKey)
|
java.lang.String |
toString()
|
void |
updateRawPixels()
Transfer the bytes stored in m_Pixels[] to the low level SDL representation. |
void |
updateRawPixelsAndAllArea()
Calls updateRawPixels(), then updateRect(0,0,m_Width,m_Height). |
void |
updateRect(int x,
int y,
int w,
int h)
Update the screen with the pixels in the SDL level pixel buffer. |
Methods inherited from class java.lang.Object |
clone, equals, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Field Detail |
public int m_Flags
public SDLPixelFormat m_Format
public int m_Width
public int m_Height
public short m_Pitch
public byte[] m_Pixels
updateRawPixels()
public SDLRect m_ClipRect
public static boolean DBG
Constructor Detail |
public SDLSurface(int handle)
public SDLSurface(java.lang.String fileNameBMP) throws java.io.FileNotFoundException
Method Detail |
public int getHandle()
public void freeSurface()
public void updateRect(int x, int y, int w, int h)
Only valid for screen surfaces
flip()
,
updateRawPixels()
,
updateRawPixelsAndAllArea()
public void updateRawPixels()
Only valid for screen surfaces
updateRawPixelsAndAllArea()
,
blitSurface(SDLRect, SDLSurface, SDLRect)
,
updateRect(int, int, int, int)
,
flip()
public void updateRawPixelsAndAllArea()
Only valid for screen surfaces
public void blitSurface(SDLRect src, SDLSurface destSurface, SDLRect dest)
src
- region to blit from this.destSurface
- SDLSurface to blit to.dest
- region to place blit on destSurfacepublic int mapRGB(byte red, byte green, byte blue)
Color c=Color.magenta; int pixel = mapRGB(c.getRed(), c.getGreen(), c.getBlue());
public void setColorKey(int flags, int colorKey)
public int setAlpha(int flags, byte alpha)
public int setColor(SDLColor[] color, int firstColor, int nbColors)
public int displayFormat()
public int flip()
Only valid for screen surfaces
TODO: could this return boolean instead?
public java.lang.String toString()
toString
in class java.lang.Object
public boolean saveToBMP(java.lang.String fileName)
public void setClipRect(SDLRect rect)
public void setClipRect(int x, int y, int w, int h)
public SDLRect getClipRect()
public SDLSurface convertSurface(SDLPixelFormat format, int flags)
public boolean fillRect(SDLRect rect, int color)
public boolean fillRect(int x, int y, int width, int height, int color)
public SDLSurface displayFormatAlpha()
public SDLOverlay createYUVOverlay(int width, int height, int format)
protected void finalize() throws java.lang.Throwable
finalize
in class java.lang.Object
java.lang.Throwable
|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |