package pl.wroc.pwr.image.model; import pl.wroc.pwr.image.IRGBImage; import pl.wroc.pwr.imagechannel.IImageChannel; import pl.wroc.pwr.imagechannel.IPixel; public class RGBImage extends MultiChannelImage implements IRGBImage { /** * */ private static final long serialVersionUID = -1804784284040797612L; public static final int CHANNEL_R = 0; public static final int CHANNEL_G = 1; public static final int CHANNEL_B = 2; public RGBImage( int sizeX, int sizeY ) { super( 3, sizeX, sizeY ); } public RGBImage( IImageChannel red, IImageChannel green, IImageChannel blue ) { super( new IImageChannel[ ]{ red, green, blue } ); } public RGBImage( int[ ] size ) { this( size[ IPixel.X ], size[ IPixel.Y ] ); } public IImageChannel getRedChannel( ) { return this.getChannel( RGBImage.CHANNEL_R ); } public IImageChannel getGreenChannel( ) { return this.getChannel( RGBImage.CHANNEL_G ); } public IImageChannel getBlueChannel( ) { return this.getChannel( RGBImage.CHANNEL_B ); } public void setRedChannel( IImageChannel channel ) { this.setChannel( channel, RGBImage.CHANNEL_R ); } public void setGreenChannel( IImageChannel channel ) { this.setChannel( channel, RGBImage.CHANNEL_G ); } public void setBlueChannel( IImageChannel channel ) { this.setChannel( channel, RGBImage.CHANNEL_B ); } @Override public String getChannelName(int number) { switch (number) { case CHANNEL_R: return "Red"; case CHANNEL_G: return "Green"; case CHANNEL_B: return "Blue"; default: return null; } } @Override public String toString() { return "RGBImage[" + this.getXSize() + ", " + this.getYSize() + "]"; //$NON-NLS-1$//$NON-NLS-2$ //$NON-NLS-3$ } }