Package java.awt.image

Examples of java.awt.image.DataBufferInt


   * @param harness  the test harness (<code>null</code> not permitted).
   */
  public void test(TestHarness harness)     
  {
    //
    DataBuffer b1 = new DataBufferInt(new int[] {1, 2, 3}, 3, 1);
    int[] offsets = b1.getOffsets();
    harness.check(offsets.length == 1);
    harness.check(offsets[0] == 1);
  }
View Full Code Here


   * @param harness  the test harness (<code>null</code> not permitted).
   */
  public void test(TestHarness harness)       
  {
    BandedSampleModel m = new BandedSampleModel(DataBuffer.TYPE_INT, 2, 3, 2);
    DataBufferInt b = new DataBufferInt(6, 2);
    b.setElem(0, 0, 0xA0);
    b.setElem(0, 1, 0xA1);
    b.setElem(0, 2, 0xA2);
    b.setElem(0, 3, 0xA3);
    b.setElem(0, 4, 0xA4);
    b.setElem(0, 5, 0xA5);
    b.setElem(1, 0, 0xB0);
    b.setElem(1, 1, 0xB1);
    b.setElem(1, 2, 0xB2);
    b.setElem(1, 3, 0xB3);
    b.setElem(1, 4, 0xB4);
    b.setElem(1, 5, 0xB5);
    harness.check(m.getSample(0, 0, 0, b), 0xA0);
    harness.check(m.getSample(1, 0, 0, b), 0xA1);
    harness.check(m.getSample(0, 1, 0, b), 0xA2);
    harness.check(m.getSample(1, 1, 0, b), 0xA3);
    harness.check(m.getSample(0, 2, 0, b), 0xA4);
View Full Code Here

   * @param harness  the test harness (<code>null</code> not permitted).
   */
  public void test(TestHarness harness)       
  {
    BandedSampleModel m = new BandedSampleModel(DataBuffer.TYPE_INT, 2, 3, 2);
    DataBufferInt b = new DataBufferInt(6, 2);
    b.setElem(0, 0, 0xA0);
    b.setElem(0, 1, 0xA1);
    b.setElem(0, 2, 0xA2);
    b.setElem(0, 3, 0xA3);
    b.setElem(0, 4, 0xA4);
    b.setElem(0, 5, 0xA5);
    b.setElem(1, 0, 0xB0);
    b.setElem(1, 1, 0xB1);
    b.setElem(1, 2, 0xB2);
    b.setElem(1, 3, 0xB3);
    b.setElem(1, 4, 0xB4);
    b.setElem(1, 5, 0xB5);
    harness.check(m.getPixel(0, 0, (int[]) null, b)[0], 0xA0);
    harness.check(m.getPixel(1, 0, (int[]) null, b)[0], 0xA1);
    harness.check(m.getPixel(0, 1, (int[]) null, b)[0], 0xA2);
    harness.check(m.getPixel(1, 1, (int[]) null, b)[0], 0xA3);
    harness.check(m.getPixel(0, 2, (int[]) null, b)[0], 0xA4);
View Full Code Here

    harness.check(db.getElem(0, 10), 99.0d);
    m.setSample(2, 1, 1, 88.8, db);
    harness.check(db.getElem(0, 11), 88.0d);
   
    // what happens if the data buffer doesn't hold doubles?
    DataBuffer db2 = new DataBufferInt(12);
    m.setSample(2, 1, 0, 99.9d, db2);
    harness.check(db2.getElem(0, 10), 99);
    m.setSample(2, 1, 1, 88.8d, db2);
    harness.check(db2.getElem(0, 11), 88);

    // check that a null data buffer generates a NullPointerException
    boolean pass = false;
    try
      {
View Full Code Here

    harness.check(db.getElem(0, 10), 99.0f);
    m.setSample(2, 1, 1, 88.8f, db);
    harness.check(db.getElem(0, 11), 88.0f);
   
    // what happens if the data buffer doesn't hold floats?
    DataBuffer db2 = new DataBufferInt(12);
    m.setSample(2, 1, 0, 99.9f, db2);
    harness.check(db2.getElem(0, 10), 99);
    m.setSample(2, 1, 1, 88.8f, db2);
    harness.check(db2.getElem(0, 11), 88);
    
    // check that a null data buffer generates a NullPointerException
    boolean pass = false;
    try
      {
View Full Code Here

 
  private void test3(TestHarness harness)
  {
    harness.checkPoint("(int, int, int, int, DataBuffer)")
   
    DataBuffer db = new DataBufferInt(12);
    ComponentSampleModel m = new ComponentSampleModel(DataBuffer.TYPE_INT,
            3, 2, 2, 6, new int[] {0, 1});
    m.setSample(2, 1, 0, 99, db);
    harness.check(db.getElem(0, 10), 99);
    m.setSample(2, 1, 1, 88, db);
    harness.check(db.getElem(0, 11), 88);
   
    // what happens if the data buffer doesn't hold integers?
    DataBuffer db2 = new DataBufferByte(12);
    m.setSample(2, 1, 0, 99, db2);
    harness.check(db2.getElem(0, 10), 99);
View Full Code Here

public class getDataElements implements Testlet
{
  public void test(TestHarness harness)
  {
    DataBuffer db = new DataBufferInt(12);
    for (int i = 0; i < 12; i++)
      db.setElem(i, i);
    ComponentSampleModel m = new ComponentSampleModel(DataBuffer.TYPE_INT,
            3, 2, 2, 6, new int[] {0, 1});
    Object elements = m.getDataElements(0, 0, 2, 1, null, db);
    int[] de = (int[]) elements;
    harness.check(de.length, 4);
View Full Code Here

    harness.checkPoint("(int, int, Object, DataBuffer(Int))");
    SinglePixelPackedSampleModel m1 = new SinglePixelPackedSampleModel(
      DataBuffer.TYPE_INT, 2, 3, new int[] { 0xFFFF00, 0x00FFFF }
    );
    int[] i = new int[] { (int) 0x11111111, (int) 0x22222222, (int) 0x33333333, (int) 0x44444444, (int) 0x55555555, (int) 0x66666666 };
    DataBuffer db = new DataBufferInt(i, 6)

    // set a value
    m1.setDataElements(0, 0, new int[] { (int) 0x77777777 }, db);
    m1.setDataElements(1, 0, new int[] { (int) 0x88888888 }, db);
    m1.setDataElements(0, 1, new int[] { (int) 0x99999999 }, db);
    m1.setDataElements(1, 1, new int[] { (int) 0xAAAAAAAA }, db);
    m1.setDataElements(0, 2, new int[] { (int) 0xBBBBBBBB }, db);
    m1.setDataElements(1, 2, new int[] { (int) 0xCCCCCCCC }, db);
    harness.check(db.getElem(0), 0x77777777);
    harness.check(db.getElem(1), 0x88888888);
    harness.check(db.getElem(2), 0x99999999);
    harness.check(db.getElem(3), 0xAAAAAAAA);
    harness.check(db.getElem(4), 0xBBBBBBBB);
    harness.check(db.getElem(5), 0xCCCCCCCC);
       
    // set a value with non-standard scanline stride
    SinglePixelPackedSampleModel m2 = new SinglePixelPackedSampleModel(
      DataBuffer.TYPE_INT, 2, 2, 3, new int[] { 0xFFFF00, 0x00FFFF }
    );
    m2.setDataElements(0, 0, new int[] { (int) 0x11111111 }, db);
    m2.setDataElements(1, 0, new int[] { (int) 0x22222222 }, db);
    m2.setDataElements(0, 1, new int[] { (int) 0x33333333 }, db);
    m2.setDataElements(1, 1, new int[] { (int) 0x44444444 }, db);
    harness.check(db.getElem(0), 0x11111111);
    harness.check(db.getElem(1), 0x22222222);
    harness.check(db.getElem(3), 0x33333333);
    harness.check(db.getElem(4), 0x44444444);
         
    // set a value with x < 0
    try
    {
      m1.setDataElements(-1, 0, new int[] { (int) 0x9999 }, db);
View Full Code Here

   */
  public void test(TestHarness harness)       
  {
    harness.checkPoint("(int, int, int, int, DataBuffer)");
    BandedSampleModel m = new BandedSampleModel(DataBuffer.TYPE_INT, 2, 3, 2);
    DataBufferInt b = new DataBufferInt(6, 2);
    m.setDataElements(0, 0, new int[] {0xA0, 0xB0}, b);
    m.setDataElements(1, 0, new int[] {0xA1, 0xB1}, b);
    m.setDataElements(0, 1, new int[] {0xA2, 0xB2}, b);
    m.setDataElements(1, 1, new int[] {0xA3, 0xB3}, b);
    m.setDataElements(0, 2, new int[] {0xA4, 0xB4}, b);
    m.setDataElements(1, 2, new int[] {0xA5, 0xB5}, b);
    harness.check(b.getElem(0, 0), 0xA0);
    harness.check(b.getElem(0, 1), 0xA1);
    harness.check(b.getElem(0, 2), 0xA2);
    harness.check(b.getElem(0, 3), 0xA3);
    harness.check(b.getElem(0, 4), 0xA4);
    harness.check(b.getElem(0, 5), 0xA5);
    harness.check(b.getElem(1, 0), 0xB0);
    harness.check(b.getElem(1, 1), 0xB1);
    harness.check(b.getElem(1, 2), 0xB2);
    harness.check(b.getElem(1, 3), 0xB3);
    harness.check(b.getElem(1, 4), 0xB4);
    harness.check(b.getElem(1, 5), 0xB5) ;
    // check negative x
    boolean pass = false;
    try
    {
View Full Code Here

public class setPixel implements Testlet
{
  public void test(TestHarness harness)
  {
    DataBuffer db = new DataBufferInt(12);
    int[] pixel = new int[] {11, 22};
    ComponentSampleModel m = new ComponentSampleModel(DataBuffer.TYPE_INT,
            3, 2, 2, 6, new int[] {0, 1});
    m.setPixel(1, 1, pixel, db);
    harness.check(db.getElem(0, 8), 11);
    harness.check(db.getElem(0, 9), 22);
       
    // check that a null pixel array generates a NullPointerException
    boolean pass = false;
    try
      {
View Full Code Here

TOP

Related Classes of java.awt.image.DataBufferInt

Copyright © 2018 www.massapicom. 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.