org.jagatoo.loaders.textures.pixelprocessing
Class PixelProcessor

java.lang.Object
  extended by org.jagatoo.loaders.textures.pixelprocessing.PixelProcessor
Direct Known Subclasses:
PixelProcessorLUM, PixelProcessorRGB, PixelProcessorRGBA

public abstract class PixelProcessor
extends java.lang.Object

Pixel Processor.


Constructor Summary
protected PixelProcessor(int pixelSize)
           
 
Method Summary
 AbstractTextureImage calcMipMap(AbstractTextureImage srcImg, int trgOffset, int trgWidth, int trgHeight, int trgLineSize, TextureFactory texFactory)
          Note: This can work inplace, if srcOff == trgOff and srcLineSize >= trgLineSize.
 AbstractTextureImage createTextureImage(java.awt.image.BufferedImage img, int orgWidth, int orgHeight, TextureFormat format, boolean flipVertically, TextureFactory texFactory)
           
 int getLineSize(int width)
           
 int getPixelSize()
           
 int getStartOffset(int x, int y, int width)
           
abstract  TextureImageFormat getTextureImageFormat()
           
abstract  int readImageData(java.awt.image.BufferedImage img, int startX, int startY, int width, int height, java.nio.ByteBuffer trg, int trgOffset, boolean flipVertically)
           
static PixelProcessor selectPixelProcessor(java.awt.image.BufferedImage img, boolean acceptAlpha)
           
static PixelProcessor selectPixelProcessor(java.awt.image.BufferedImage img, TextureFormat texFormat)
           
static PixelProcessor selectPixelProcessor(TextureFormat texFormat)
           
static PixelProcessor selectPixelProcessor(TextureImageFormat tiFormat)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

PixelProcessor

protected PixelProcessor(int pixelSize)
Method Detail

getPixelSize

public final int getPixelSize()

getLineSize

public final int getLineSize(int width)

getStartOffset

public final int getStartOffset(int x,
                                int y,
                                int width)

getTextureImageFormat

public abstract TextureImageFormat getTextureImageFormat()

readImageData

public abstract int readImageData(java.awt.image.BufferedImage img,
                                  int startX,
                                  int startY,
                                  int width,
                                  int height,
                                  java.nio.ByteBuffer trg,
                                  int trgOffset,
                                  boolean flipVertically)

createTextureImage

public AbstractTextureImage createTextureImage(java.awt.image.BufferedImage img,
                                               int orgWidth,
                                               int orgHeight,
                                               TextureFormat format,
                                               boolean flipVertically,
                                               TextureFactory texFactory)

calcMipMap

public AbstractTextureImage calcMipMap(AbstractTextureImage srcImg,
                                       int trgOffset,
                                       int trgWidth,
                                       int trgHeight,
                                       int trgLineSize,
                                       TextureFactory texFactory)
Note: This can work inplace, if srcOff == trgOff and srcLineSize >= trgLineSize.


selectPixelProcessor

public static final PixelProcessor selectPixelProcessor(TextureImageFormat tiFormat)

selectPixelProcessor

public static final PixelProcessor selectPixelProcessor(TextureFormat texFormat)

selectPixelProcessor

public static final PixelProcessor selectPixelProcessor(java.awt.image.BufferedImage img,
                                                        TextureFormat texFormat)
Parameters:
img - A BufferedImage on which the decision should be based.
texFormat - The desired format.
Returns:
the best fitting PixelProcessor based on the BufferedImage format and the given format.
Throws:
java.lang.IllegalArgumentException - if the format is unknown.

selectPixelProcessor

public static final PixelProcessor selectPixelProcessor(java.awt.image.BufferedImage img,
                                                        boolean acceptAlpha)
Parameters:
img - A BufferedImage on which the decision should be based.
acceptAlpha - is an alpha channel accepted
Returns:
the best fitting PixelProcessor based on the BufferedImage format and the given format.
Throws:
java.lang.IllegalArgumentException - if the format is unknown.