Package net.sourceforge.jiu.data
Class MemoryGray8Image
- java.lang.Object
-
- net.sourceforge.jiu.data.MemoryByteChannelImage
-
- net.sourceforge.jiu.data.MemoryGray8Image
-
- All Implemented Interfaces:
ByteChannelImage
,Gray8Image
,GrayImage
,GrayIntegerImage
,IntegerImage
,PixelImage
public class MemoryGray8Image extends MemoryByteChannelImage implements Gray8Image
An implementation ofGray8Image
that keeps the complete image in memory. This class inherits most of its functionality from its parent classMemoryByteChannelImage
, using one byte channel.- Author:
- Marco Schmidt
-
-
Constructor Summary
Constructors Constructor Description MemoryGray8Image(int width, int height)
Creates a new MemoryGray8Image object with the specified resolution.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description PixelImage
createCompatibleImage(int width, int height)
Creates an instance of the same class as this one, with width and height given by the arguments.Class
getImageType()
If there is a single interface or class that describes the image data type of this class, theClass
object associated with that interface (or class) is returned (ornull
otherwise).boolean
isBlack(int x, int y)
Returns if the pixel specified by the location in the arguments is black.boolean
isWhite(int x, int y)
Returns if the pixel specified by the location in the arguments is white.void
putBlack(int x, int y)
Sets a pixel to black (minimum intensity value).void
putWhite(int x, int y)
Sets a pixel to white (maximum intensity value).-
Methods inherited from class net.sourceforge.jiu.data.MemoryByteChannelImage
checkPositionAndNumber, clear, clear, clear, clear, createCopy, getAllocatedMemory, getBitsPerPixel, getByteSample, getByteSample, getByteSamples, getHeight, getMaxSample, getNumChannels, getSample, getSample, getSamples, getWidth, putByteSample, putByteSample, putByteSamples, putSample, putSample, putSamples
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface net.sourceforge.jiu.data.ByteChannelImage
clear, clear, getByteSample, getByteSample, getByteSamples, putByteSample, putByteSample, putByteSamples
-
Methods inherited from interface net.sourceforge.jiu.data.IntegerImage
clear, clear, getMaxSample, getSample, getSample, getSamples, putSample, putSample, putSamples
-
Methods inherited from interface net.sourceforge.jiu.data.PixelImage
createCopy, getAllocatedMemory, getBitsPerPixel, getHeight, getNumChannels, getWidth
-
-
-
-
Constructor Detail
-
MemoryGray8Image
public MemoryGray8Image(int width, int height)
Creates a new MemoryGray8Image object with the specified resolution. Simply gives1
(for one channel) and the two resolution arguments to the super constructor (of the parent classMemoryByteChannelImage
).- Parameters:
width
- the horizontal resolution, must be non-zero and positiveheight
- the vertical resolution, must be non-zero and positive
-
-
Method Detail
-
createCompatibleImage
public PixelImage createCompatibleImage(int width, int height)
Description copied from interface:PixelImage
Creates an instance of the same class as this one, with width and height given by the arguments.- Specified by:
createCompatibleImage
in interfacePixelImage
- Specified by:
createCompatibleImage
in classMemoryByteChannelImage
- Parameters:
width
- the horizontal resolution of the new imageheight
- the vertical resolution of the new image- Returns:
- the new image
-
getImageType
public Class getImageType()
Description copied from interface:PixelImage
If there is a single interface or class that describes the image data type of this class, theClass
object associated with that interface (or class) is returned (ornull
otherwise). ThisClass
object, if available for two image objects, can be used to find out if they are compatible. Example:MemoryGray8Image
returnsnet.sourceforge.jiu.data.Gray8Image.class
.- Specified by:
getImageType
in interfacePixelImage
-
isBlack
public boolean isBlack(int x, int y)
Description copied from interface:GrayImage
Returns if the pixel specified by the location in the arguments is black.
-
isWhite
public boolean isWhite(int x, int y)
Description copied from interface:GrayImage
Returns if the pixel specified by the location in the arguments is white.
-
putBlack
public void putBlack(int x, int y)
Description copied from interface:GrayImage
Sets a pixel to black (minimum intensity value).
-
-