net.sourceforge.jiu.data

Class MemoryPaletted8Image

Implemented Interfaces:
ByteChannelImage, IntegerImage, Paletted8Image, PalettedImage, PalettedIntegerImage, PixelImage

public class MemoryPaletted8Image
extends MemoryByteChannelImage
implements Paletted8Image

This class stores a paletted image with one byte per sample in memory.
Author:
Marco Schmidt
See Also:
ByteChannelImage, IntegerImage, Palette

Field Summary

private int
maxSampleValue
private Palette
palette
This image's palette.

Fields inherited from class net.sourceforge.jiu.data.MemoryByteChannelImage

data, firstChannel, height, numChannels, numPixels, width

Constructor Summary

MemoryPaletted8Image(int width, int height)
Create an image of byte channels.
MemoryPaletted8Image(int width, int height, Palette palette)

Method Summary

static void
checkPalette(Palette palette)
PixelImage
createCompatibleImage(int width, int height)
long
getAllocatedMemory()
Class
getImageType()
int
getMaxSample(int channel)
Palette
getPalette()
Returns this image's palette.
String
getTypeDescription()
void
setPalette(Palette palette)
Sets this image's palette to a new value.

Methods inherited from class net.sourceforge.jiu.data.MemoryByteChannelImage

checkPositionAndNumber, clear, clear, clear, clear, createCompatibleImage, createCopy, getAllocatedMemory, getBitsPerPixel, getByteSample, getByteSample, getByteSamples, getHeight, getMaxSample, getNumChannels, getSample, getSample, getSamples, getWidth, putByteSample, putByteSample, putByteSamples, putSample, putSample, putSamples

Field Details

maxSampleValue

private int maxSampleValue

palette

private Palette palette
This image's palette.

Constructor Details

MemoryPaletted8Image

public MemoryPaletted8Image(int width,
                            int height)
Create an image of byte channels. Image data will be completely in memory, so memory requirements are width * height * numChannels bytes. Note that the data will not be initialized, so you should not assume anything about its content.
Parameters:
width - the horizontal resolution, must be non-zero and positive
height - the vertical resolution, must be non-zero and positive

MemoryPaletted8Image

public MemoryPaletted8Image(int width,
                            int height,
                            Palette palette)

Method Details

checkPalette

public static void checkPalette(Palette palette)

createCompatibleImage

public PixelImage createCompatibleImage(int width,
                                        int height)
Specified by:
createCompatibleImage in interface PixelImage
Overrides:
createCompatibleImage in interface MemoryByteChannelImage

getAllocatedMemory

public long getAllocatedMemory()
Specified by:
getAllocatedMemory in interface PixelImage
Overrides:
getAllocatedMemory in interface MemoryByteChannelImage

getImageType

public Class getImageType()
Specified by:
getImageType in interface PixelImage

getMaxSample

public int getMaxSample(int channel)
Specified by:
getMaxSample in interface IntegerImage
Overrides:
getMaxSample in interface MemoryByteChannelImage

getPalette

public Palette getPalette()
Returns this image's palette.
Specified by:
getPalette in interface PalettedImage

getTypeDescription

public String getTypeDescription()

setPalette

public void setPalette(Palette palette)
Sets this image's palette to a new value.
Specified by:
setPalette in interface PalettedImage
See Also:
getPalette()