Package net.sourceforge.jiu.data
Interface IntegerImage
-
- All Superinterfaces:
PixelImage
- All Known Subinterfaces:
BilevelImage
,ByteChannelImage
,Gray16Image
,Gray8Image
,GrayIntegerImage
,Paletted8Image
,PalettedIntegerImage
,RGB24Image
,RGB48Image
,RGBIntegerImage
,ShortChannelImage
- All Known Implementing Classes:
BufferedRGB24Image
,MemoryBilevelImage
,MemoryByteChannelImage
,MemoryGray16Image
,MemoryGray8Image
,MemoryPaletted8Image
,MemoryRGB24Image
,MemoryRGB48Image
,MemoryShortChannelImage
public interface IntegerImage extends PixelImage
Extends thePixelImage
interface to access image data asint
values. Image types based onbyte
,char
,short
andint
will work with this interface.long
will not.Using this interface provides a nice way of accessing a large variety of image types, but for performance reasons it might be preferable to use one of the class-specific access methods that get or put several values at a time, e.g. getByteSamples in
ByteChannelImage
.- Author:
- Marco Schmidt
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description void
clear(int newValue)
Sets all samples in the first channel to the argument value.void
clear(int channelIndex, int newValue)
Sets all samples of thechannelIndex
'th channel tonewValue
.int
getMaxSample(int channel)
Returns the maximum value for one of the image's channels.int
getSample(int x, int y)
Returns one sample of the first channel (index 0).int
getSample(int channel, int x, int y)
Returns one sample, specified by its channel index and location.void
getSamples(int channelIndex, int x, int y, int w, int h, int[] dest, int destOffs)
Copies a number of samples from this image to anint[]
object.void
putSample(int x, int y, int newValue)
This method sets one sample of the first channel (index 0) to a new value.void
putSample(int channel, int x, int y, int newValue)
This method sets one sample to a new value.void
putSamples(int channel, int x, int y, int w, int h, int[] src, int srcOffset)
Copies a number of samples from anint[]
array to this image.-
Methods inherited from interface net.sourceforge.jiu.data.PixelImage
createCompatibleImage, createCopy, getAllocatedMemory, getBitsPerPixel, getHeight, getImageType, getNumChannels, getWidth
-
-
-
-
Method Detail
-
clear
void clear(int newValue)
Sets all samples in the first channel to the argument value. Equal toclear(0, newValue);
:
-
clear
void clear(int channelIndex, int newValue)
Sets all samples of thechannelIndex
'th channel tonewValue
.
-
getMaxSample
int getMaxSample(int channel)
Returns the maximum value for one of the image's channels. The minimum value is always0
.- Parameters:
channel
- zero-based index of the channel, from0
toPixelImage.getNumChannels()
- 1
- Returns:
- maximum allowed sample value
-
getSample
int getSample(int x, int y)
Returns one sample of the first channel (index 0). A call to this method must have the same result as the callgetSample(0, x, y);
.- Parameters:
x
- the horizontal position of the sample, from0
toPixelImage.getWidth()
- 1
y
- the vertical position of the sample, from0
toPixelImage.getHeight()
- 1
- Returns:
- the desired sample
-
getSample
int getSample(int channel, int x, int y)
Returns one sample, specified by its channel index and location.- Parameters:
channel
- the number of the channel, from0
toPixelImage.getNumChannels()
- 1
x
- the horizontal position of the sample, from0
toPixelImage.getWidth()
- 1
y
- the vertical position of the sample, from0
toPixelImage.getHeight()
- 1
- Returns:
- the desired sample
-
getSamples
void getSamples(int channelIndex, int x, int y, int w, int h, int[] dest, int destOffs)
Copies a number of samples from this image to anint[]
object. A rectangular part of one channel is copied. The channel index is given by - the upper left corner of that rectangle is given by the point x / y. Width and height of that rectangle are given by w and h. Each sample will be stored as oneint
value dest, starting at index destOffs.- Parameters:
channelIndex
- zero-based index of the channel from which data is to be copied (valid values: 0 toPixelImage.getNumChannels()
- 1)x
- horizontal position of upper left corner of the rectangle to be copiedy
- vertical position of upper left corner of the rectangle to be copiedw
- width of rectangle to be copiedh
- height of rectangle to be copieddest
- int array to which the samples will be copieddestOffs
- int index into the dest array for the position to which the samples will be copied
-
putSample
void putSample(int x, int y, int newValue)
This method sets one sample of the first channel (index 0) to a new value. This call must have the same result as the callputSample(0, x, y)
. The sample location is given by the spatial coordinates, x and y.- Parameters:
x
- the horizontal position of the sample, from0
toPixelImage.getWidth()
- 1
y
- the vertical position of the sample, from0
toPixelImage.getHeight()
- 1
newValue
- the new value of the sample
-
putSample
void putSample(int channel, int x, int y, int newValue)
This method sets one sample to a new value. The sample location is given by the channel index and the spatial coordinates, x and y.- Parameters:
channel
- the number of the channel, from0
toPixelImage.getNumChannels()
- 1
x
- the horizontal position of the sample, from0
toPixelImage.getWidth()
- 1
y
- the vertical position of the sample, from0
toPixelImage.getHeight()
- 1
newValue
- the new value of the sample
-
putSamples
void putSamples(int channel, int x, int y, int w, int h, int[] src, int srcOffset)
Copies a number of samples from anint[]
array to this image. A rectangular part of one channel is copied - the upper left corner of that rectangle is given by the point x / y. Width and height of that rectangle are given by w and h. Each sample will be stored as oneint
value src, starting at index srcOffset.- Parameters:
channel
- int (from 0 to getNumChannels() - 1) to indicate the channel to which data is copiedx
- horizontal position of upper left corner of the rectangle to be copiedy
- vertical position of upper left corner of the rectangle to be copiedw
- width of rectangle to be copiedh
- height of rectangle to be copiedsrc
- int array from which the samples will be copiedsrcOffset
- int index into the src array for the position from which the samples will be copied
-
-