Examples of DirectColorModel


Examples of java.awt.image.DirectColorModel

        }
        dumpState();
    }

    public FrameBufferConfiguration[] getConfigs() {
        final ColorModel cm = new DirectColorModel(bitsPerPixel, redMask, greenMask, blueMask, alphaMask);
        return new FrameBufferConfiguration[]{
            new VMWareConfiguration(800, 600, cm),
            new VMWareConfiguration(1024, 768, cm),
            new VMWareConfiguration(1280, 1024, cm),
            new VMWareConfiguration(640, 480, cm),
View Full Code Here

Examples of java.awt.image.DirectColorModel

    public NVidiaVgaState getVgaState() {
        return vgaState;
    }

    private static ColorModel createColorModel(int bpp) {
        return new DirectColorModel(bpp, 0xff0000, 0x00ff00, 0x0000ff);
    }
View Full Code Here

Examples of java.awt.image.DirectColorModel

     *
     * @param bpp
     * @return
     */
    private static ColorModel createColorModel(int bpp) {
        return new DirectColorModel(bpp, 0xff0000, 0x00ff00, 0x0000ff);
    }
View Full Code Here

Examples of java.awt.image.DirectColorModel

     * @author peda
     */
    public class CirrusConfiguration extends FrameBufferConfiguration {

        public CirrusConfiguration(int width, int height, int bpp) {
            super(width, height, new DirectColorModel(bpp, 0xff0000, 0x00ff00,
                    0x0000ff));
        }
View Full Code Here

Examples of java.awt.image.DirectColorModel

    harness.check(dest.getSampleModel().getTransferType(),
                  img.getColorModel().getTransferType());
   
    // Try a different colour model
    img = new BufferedImage(25, 40, BufferedImage.TYPE_BYTE_GRAY);
    DirectColorModel cm = new DirectColorModel(32, 0x00ff0000, 0x0000ff00, 0x000000ff);
    dest = op.createCompatibleDestImage(img, cm);
   
    harness.check(dest.getHeight(), 40);
    harness.check(dest.getWidth(), 25);
    harness.check(dest.getColorModel(), cm);
    harness.check(dest.getSampleModel().getTransferType(), cm.getTransferType());

    op = new ColorConvertOp(null);
    dest = op.createCompatibleDestImage(img, img.getColorModel());
    harness.check(dest.getHeight(), 40);
    harness.check(dest.getWidth(), 25);
View Full Code Here

Examples of java.awt.image.DirectColorModel

    harness.check(dest.getWidth(), 25);
    harness.check(dest.getColorModel(), img.getColorModel());
   
    // Try a different colour model
    img = new BufferedImage(25, 40, BufferedImage.TYPE_INT_RGB);
    DirectColorModel cm = new DirectColorModel(16, 0x0f00, 0x00f0, 0x000f);
    dest = op.createCompatibleDestImage(img, cm);
   
    harness.check(dest.getHeight(), 40);
    harness.check(dest.getWidth(), 25);
    harness.check(dest.getColorModel(), cm);
View Full Code Here

Examples of java.awt.image.DirectColorModel

  }  

  private void testConstructor1(TestHarness harness)
  { 
    harness.checkPoint("(ColorSpace, int, int, int, int, int, boolean, int)");
    DirectColorModel m1 = new DirectColorModel(ColorSpace.getInstance(ColorSpace.CS_sRGB),
            32, 0xF000, 0xF00, 0xF0, 0xF, false, DataBuffer.TYPE_INT);
    harness.check(m1.getTransparency(), Transparency.TRANSLUCENT);
   
    // try null ColorSpace
    boolean pass = false;
    try
    {
      m1 = new DirectColorModel(null, 32, 0xF000, 0xF00, 0xF0, 0xF, false,
            DataBuffer.TYPE_INT);
        
    }
    catch (NullPointerException e)
    {
      pass = true;
    }
    harness.check(pass);
   
    // try non-RGB ColorSpace
    pass = false;
    try
    {
      m1 = new DirectColorModel(ColorSpace.getInstance(ColorSpace.CS_GRAY), 32,
            0xF000, 0xF00, 0xF0, 0xF, false, DataBuffer.TYPE_INT);
        
    }
    catch (IllegalArgumentException e)
    {
View Full Code Here

Examples of java.awt.image.DirectColorModel

  private void testConstructor2(TestHarness harness)
  { 
    harness.checkPoint("(int, int, int, int)");

    // first an 8 bit model
    DirectColorModel m1 = new DirectColorModel(8, 0xF0, 0x0C, 0x03);
    harness.check(m1.getPixelSize(), 8);
    harness.check(m1.getComponentSize(0), 4);
    harness.check(m1.getComponentSize(1), 2);
    harness.check(m1.getComponentSize(2), 2);
    harness.check(m1.getTransparency(), Transparency.OPAQUE);
    harness.check(m1.getTransferType(), DataBuffer.TYPE_BYTE);
   
    // 16 bit model
    DirectColorModel m2 = new DirectColorModel(16, 0xFF00, 0xF0, 0x0F);
    harness.check(m2.getPixelSize(), 16);
    harness.check(m2.getComponentSize(0), 8);
    harness.check(m2.getComponentSize(1), 4);
    harness.check(m2.getComponentSize(2), 4);
    harness.check(m2.getTransparency(), Transparency.OPAQUE);
    harness.check(m2.getTransferType(), DataBuffer.TYPE_USHORT);
   
    // 32 bit model
    DirectColorModel m3 = new DirectColorModel(32, 0xFFFF00, 0xFF00, 0xFF);
    harness.check(m3.getPixelSize(), 32);
    harness.check(m3.getComponentSize(0), 16);
    harness.check(m3.getComponentSize(1), 8);
    harness.check(m3.getComponentSize(2), 8);
    harness.check(m3.getTransparency(), Transparency.OPAQUE);
    harness.check(m3.getTransferType(), DataBuffer.TYPE_INT);
   
    // check negative bits
    boolean pass = false;
    try
    {
      /* ColorModel m = */ new DirectColorModel(-1, 0xFFFF00, 0xFF00, 0xFF);
    }
    catch (IllegalArgumentException e)
    {
      pass = true;  
    }
    harness.check(pass);

    // check bits > 32
    pass = false;
    try
    {
      /* ColorModel m = */ new DirectColorModel(33, 0xFFFF00, 0xFF00, 0xFF);
    }
    catch (IllegalArgumentException e)
    {
      pass = true;  
    }
View Full Code Here

Examples of java.awt.image.DirectColorModel

  private void testConstructor3(TestHarness harness)
  { 
    harness.checkPoint("DirectColorModel(int, int, int, int, int)");

    // first an 8 bit model
    DirectColorModel m1 = new DirectColorModel(8, 0xC0, 0x30, 0x0C, 0x03);
    harness.check(m1.getPixelSize(), 8);
    harness.check(m1.getComponentSize(0), 2);
    harness.check(m1.getComponentSize(1), 2);
    harness.check(m1.getComponentSize(2), 2);
    harness.check(m1.getComponentSize(3), 2);
    harness.check(m1.getTransparency(), Transparency.TRANSLUCENT);
    harness.check(m1.getTransferType(), DataBuffer.TYPE_BYTE);
   
    // 16 bit model
    DirectColorModel m2 = new DirectColorModel(16, 0xF000, 0x0F00, 0xF0, 0x0F);
    harness.check(m2.getPixelSize(), 16);
    harness.check(m2.getComponentSize(0), 4);
    harness.check(m2.getComponentSize(1), 4);
    harness.check(m2.getComponentSize(2), 4);
    harness.check(m2.getComponentSize(3), 4);
    harness.check(m2.getTransparency(), Transparency.TRANSLUCENT);
    harness.check(m2.getTransferType(), DataBuffer.TYPE_USHORT);
   
    // 32 bit model
    DirectColorModel m3 = new DirectColorModel(32, 0xFF000000, 0xFF0000, 0xFF00, 0xFF);
    harness.check(m3.getPixelSize(), 32);
    harness.check(m3.getComponentSize(0), 8);
    harness.check(m3.getComponentSize(1), 8);
    harness.check(m3.getComponentSize(2), 8);
    harness.check(m3.getComponentSize(3), 8);
    harness.check(m3.getTransparency(), Transparency.TRANSLUCENT);
    harness.check(m3.getTransferType(), DataBuffer.TYPE_INT);
   
    // check negative bits
    boolean pass = false;
    try
    {
      /* ColorModel m = */ new DirectColorModel(-1, 0xFF000000, 0xFF0000, 0xFF00, 0xFF);
    }
    catch (IllegalArgumentException e)
    {
      pass = true;  
    }
    harness.check(pass);
   
    // check bits > 32
    pass = false;
    try
    {
      /* ColorModel m = */ new DirectColorModel(33, 0xFF000000, 0xFF0000, 0xFF00, 0xFF);
    }
    catch (IllegalArgumentException e)
    {
      pass = true;  
    }
View Full Code Here

Examples of java.awt.image.DirectColorModel

          if (b < 3)
            rast.setSample(x, y, b, (float)x+y+b);
          else
            rast.setSample(x, y, b, (float)((x+y)));

    DirectColorModel dcm = new DirectColorModel(32, 0x00ff0000, 0x0000ff00,
                                                0x000000ff, 0xff000000);
   
    harness.check(dcm.isAlphaPremultiplied(), false);
   
    // Check to ensure data is not changed needlessly
    ColorModel resultCM = dcm.coerceData(rast, false);
    harness.check(resultCM.getClass().equals(dcm.getClass()));
    harness.check(resultCM.isAlphaPremultiplied(), false);
    harness.check(dcm, resultCM);
    for (int x = 0; x < 50; x++)
      for (int y = 0; y < 50; y++)
        for (int b = 0; b < 4; b++)
          {
            if (b < 3)
              harness.check(rast.getSample(x, y, b), (x+y+b));
            else
              harness.check(rast.getSampleFloat(x, y, b), (x+y));
          }
   
    // Coerce data into a premultiplied state
    resultCM = dcm.coerceData(rast, true);
   
    // Ensure we're still using the same color model!
    harness.check(resultCM.getClass().equals(dcm.getClass()));
    harness.check(resultCM.isAlphaPremultiplied(), true);
    harness.check(! (dcm == resultCM));     // object is cloned...
   
    // Check values
    for (int x = 0; x < 50; x++)
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.