JAI problem of creating compound image from slices

Discussion in 'Java' started by Apc, Jun 2, 2004.

  1. Apc

    Apc Guest

    Hi,
    I am trying to create a compound image from 16 slices.I finished
    loading the images and it displays .But i want it to make it as a
    compound image so that can it be scaled ,moved etc.Can anyone please
    let me know how to do it
    The code is given below








    public class Acquire extends Applet {

    int x0,x1,x2,x3,x4,x5,x6,x7,x8,x9,x10,x11,x12,x13,x14,x15;
    int y0,y1,y2,y3,y4,y5,y6,y7,y8,y9,y10,y11,y12,y13,y14,y15;
    Image[] images = new Image[16];

    public void init() {
    images[0] = getImage(getDocumentBase(), "0_gr.gif");
    PlanarImage input0 = JAI.create("fileload", "0_gr.gif");
    y0=input0.getHeight();
    x0= input0.getWidth();

    images[1] = getImage(getDocumentBase(), "1_gr.gif");
    PlanarImage input1 = JAI.create("fileload", "1_gr.gif");
    y1=input1.getHeight();
    x1= input1.getWidth();



    images[2] = getImage(getDocumentBase(), "2_gr.gif");
    PlanarImage input2 = JAI.create("fileload", "2_gr.gif");
    y2=input2.getHeight();
    x2= input2.getWidth();


    images[3] = getImage(getDocumentBase(), "3_gr.gif");
    PlanarImage input3 = JAI.create("fileload", "3_gr.gif");
    y3=input3.getHeight();
    x3= input3.getWidth();

    images[4] = getImage(getDocumentBase(), "4_gr.gif");
    PlanarImage input4 = JAI.create("fileload", "4_gr.gif");
    y4=input4.getHeight();
    x4= input4.getWidth();


    images[5] = getImage(getDocumentBase(), "5_gr.gif");
    PlanarImage input5 = JAI.create("fileload", "5_gr.gif");
    y5=input5.getHeight();
    x5= input5.getWidth();


    images[6] = getImage(getDocumentBase(), "6_gr.gif");
    PlanarImage input6 = JAI.create("fileload", "6_gr.gif");
    y6=input6.getHeight();
    x6= input6.getWidth();


    images[7] = getImage(getDocumentBase(), "7_gr.gif");
    PlanarImage input7 = JAI.create("fileload", "7_gr.gif");
    y7=input7.getHeight();
    x7= input7.getWidth();


    images[8] = getImage(getDocumentBase(), "8_gr.gif");
    PlanarImage input8 = JAI.create("fileload", "8_gr.gif");
    y8=input8.getHeight();
    x8= input8.getWidth();


    images[9] = getImage(getDocumentBase(), "9_gr.gif");
    PlanarImage input9 = JAI.create("fileload", "9_gr.gif");
    y9=input9.getHeight();
    x9= input9.getWidth();


    images[10] = getImage(getDocumentBase(), "10_gr.gif");
    PlanarImage input10 = JAI.create("fileload", "10_gr.gif");
    y10=input10.getHeight();
    x10= input10.getWidth();


    images[11] = getImage(getDocumentBase(), "11_gr.gif");
    PlanarImage input11 = JAI.create("fileload", "11_gr.gif");
    y11=input11.getHeight();
    x11= input11.getWidth();

    images[12] = getImage(getDocumentBase(), "12_gr.gif");
    PlanarImage input12 = JAI.create("fileload", "12_gr.gif");
    y12=input12.getHeight();
    x12= input12.getWidth();

    images[13] = getImage(getDocumentBase(), "13_gr.gif");
    PlanarImage input13 = JAI.create("fileload", "13_gr.gif");
    y13=input13.getHeight();
    x13= input13.getWidth();

    images[14] = getImage(getDocumentBase(), "14_gr.gif");
    PlanarImage input14 = JAI.create("fileload", "14_gr.gif");
    y14=input14.getHeight();
    x14= input14.getWidth();

    images[15] = getImage(getDocumentBase(), "15_gr.gif");
    PlanarImage input15 = JAI.create("fileload", "15_gr.gif");
    y15=input15.getHeight();
    x15= input15.getWidth();




    }
    public void paint(Graphics g) {
    // Draw image
    g.drawImage(images[0], 0, 0, this);
    g.drawImage(images[1], x0, 0, this);
    g.drawImage(images[2], x0+x1, 0, this);
    g.drawImage(images[3], x0+x1+x2, 0, this);
    g.drawImage(images[4],0,y0,this);
    g.drawImage(images[5], x4,y0,this);
    g.drawImage(images[6], x4+x5, y0, this);
    g.drawImage(images[7], x4+x5+x6, y0, this);
    g.drawImage(images[8], 0, y0+y4, this);
    g.drawImage(images[9], x8,y0+y4,this);
    g.drawImage(images[10], x9+x8, y0+y4, this);
    g.drawImage(images[11], x10+x8+x9, y0+y4, this);
    g.drawImage(images[12], 0, y0+y4+y8, this);
    g.drawImage(images[13], x12,y0+y4+y8,this);
    g.drawImage(images[14], x12+x13, y0+y4+y8, this);
    g.drawImage(images[15], x12+x13+x14, y0+y4+y8, this);
    ParameterBlock pb=new ParameterBlock();



    }

    }
     
    Apc, Jun 2, 2004
    #1
    1. Advertising

  2. Apc

    ak Guest

    > I am trying to create a compound image from 16 slices.I finished
    > loading the images and it displays .But i want it to make it as a
    > compound image so that can it be scaled ,moved etc.Can anyone please
    > let me know how to do it

    the advantage of JAI allows you to mantain HUGE images.
    Why create 16 slices if you can just load full image?
    Very powerful component for displaying such huge (tested with 2 GB) images
    is JadeDisplay.
    For more info see http://www.openchannelfoundation.org/projects/JadeDisplay/

    search JAI archives for more info how to compose images
    http://swjscmail1.sun.com/archives/jai-interest.html

    --
    http://uio.dev.java.net
    http://reader.imagero.com
     
    ak, Jun 2, 2004
    #2
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Apc
    Replies:
    1
    Views:
    567
    Roedy Green
    Jun 2, 2004
  2. Michael David Pedersen
    Replies:
    2
    Views:
    3,589
    Michael David Pedersen
    Jul 22, 2004
  3. bulge
    Replies:
    8
    Views:
    6,074
    bulge
    Jul 19, 2004
  4. Java_New
    Replies:
    5
    Views:
    2,969
    Andrey Kuznetsov
    May 27, 2006
  5. voncroy14
    Replies:
    0
    Views:
    1,056
    voncroy14
    Jul 17, 2009
Loading...

Share This Page