Docjar: A Java Source and Docuemnt Enginecom.*    java.*    javax.*    org.*    all    new    plug-in

Quick Search    Search Deep

org.libsdl.video
Class SDLPixelFormat  view SDLPixelFormat download SDLPixelFormat.java

java.lang.Object
  extended byorg.libsdl.SDLStruct
      extended byorg.libsdl.video.SDLPixelFormat

public class SDLPixelFormat
extends org.libsdl.SDLStruct

The SDLPixelFormat class represents an SDL_PixelFormat C struct. The class extends SDLStruct and thus represents a native C structure. The SDLPixelFormat class typically represents the properties of an SDLSurface, such as bit depth, palette, masks, and shifts (to name a few).

A SDLPixelFormat cannot be instantiated directly. It must be created by the surface that it represents.

------ EXAMPLE ------

     SDL sdl = SDL.getInstance();
     SDLVideo video = sdl.getVideo();
     SDLVideoInfo vidinfo = video.getVideoInfo();
     SDLPixelFormat format = vidinfo.getPixelFormat();
     short bpp = format.bitsPerPixel();  // etc...
 

------ EXAMPLE ------

     SDLSurface surf = ...
     SDLPixelFormat format = surf.getPixelFormat();
     short bpp = format.bitsPerPixel();  // etc...
 

Version:
$revision$

Field Summary
 
Fields inherited from class org.libsdl.SDLStruct
pointer
 
Constructor Summary
protected SDLPixelFormat(int l)
           
 
Method Summary
 short alpha()
          Get the alpha loss
 short alphaLoss()
          Get the alpha loss
 int alphaMask()
          Get the alpha mask
 short alphaShift()
          Get the alpha shift
 short bitsPerPixel()
          Get the bit depth.
 short blueLoss()
          Get the blue loss
 int blueMask()
          Get the blue mask
 short blueShift()
          Get the blue shift
 short bytesPerPixel()
          Get the byte depth.
 int colorKey()
          Get the color key
 SDLRGB getRGB(int pixel)
          Converts a 32 bit integer pixel into an SDLRGB object
 SDLRGBA getRGBA(int pixel)
          Converts a 32 bit integer pixel into an SDLRGBA object
 short greenLoss()
          Get the green loss
 int greenMask()
          Get the green mask
 short greenShift()
          Get the green shift
 int mapRGB(SDLRGB rgb)
          Converts an SDLRGB object into a 32 bit integer pixel.
 int mapRGB(short r, short g, short b)
          Converts red, green, and blue components into a 32 bit integer pixel.
 int mapRGBA(SDLRGBA rgba)
          Converts an SDLRGBA object into a 32 bit integer pixel.
 int mapRGBA(short r, short g, short b, short a)
          Converts red, green, blue, and alpha components into a 32 bit integer pixel.
 SDLPalette palette()
          Get this SDLPixelFormat's palette.
 short redLoss()
          Get the red loss
 int redMask()
          Get the red mask
 short redShift()
          Get the red shift
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

SDLPixelFormat

protected SDLPixelFormat(int l)
Method Detail

palette

public SDLPalette palette()
Get this SDLPixelFormat's palette.


bitsPerPixel

public short bitsPerPixel()
Get the bit depth.


bytesPerPixel

public short bytesPerPixel()
Get the byte depth.


redMask

public int redMask()
Get the red mask


greenMask

public int greenMask()
Get the green mask


blueMask

public int blueMask()
Get the blue mask


alphaMask

public int alphaMask()
Get the alpha mask


redShift

public short redShift()
Get the red shift


greenShift

public short greenShift()
Get the green shift


blueShift

public short blueShift()
Get the blue shift


alphaShift

public short alphaShift()
Get the alpha shift


redLoss

public short redLoss()
Get the red loss


greenLoss

public short greenLoss()
Get the green loss


blueLoss

public short blueLoss()
Get the blue loss


alphaLoss

public short alphaLoss()
Get the alpha loss


colorKey

public int colorKey()
Get the color key


alpha

public short alpha()
Get the alpha loss


getRGB

public SDLRGB getRGB(int pixel)
Converts a 32 bit integer pixel into an SDLRGB object

Corresponds:

SDL_GetRGB()


getRGBA

public SDLRGBA getRGBA(int pixel)
Converts a 32 bit integer pixel into an SDLRGBA object

Corresponds:

SDL_GetRGBA()


mapRGB

public int mapRGB(short r,
                  short g,
                  short b)
Converts red, green, and blue components into a 32 bit integer pixel.

Corresponds:

SDL_MapRGB()


mapRGBA

public int mapRGBA(short r,
                   short g,
                   short b,
                   short a)
Converts red, green, blue, and alpha components into a 32 bit integer pixel.

Corresponds:

SDL_MapRGBA()


mapRGB

public int mapRGB(SDLRGB rgb)
Converts an SDLRGB object into a 32 bit integer pixel.


mapRGBA

public int mapRGBA(SDLRGBA rgba)
Converts an SDLRGBA object into a 32 bit integer pixel.