I'm able to draw a rectangle over a tiff I loaded into my DisplayJAI which
is an extension of a JPanel.

Anyhow, when I draw the rectangle over the image I'd like to draw them in
certain colors for certain operations. My code to draw a rectangle currently
looks something like this:

      Graphics2D g2d = tileIm.createGraphics();
      g2d.setColor(Color.red);
      g2d.drawRect(Math.min(start_x,xor_x),Math.min(start_y,xor_y),
        Math.abs(start_x-xor_x),Math.abs(start_y-xor_y));
      xor_x = curr_x;
      xor_y = curr_y;
      g2d.drawRect(Math.min(start_x,xor_x),Math.min(start_y,xor_y),
        Math.abs(start_x-xor_x),Math.abs(start_y-xor_y));
      displayJAI.set(tileIm);

However, the rectangle is ALWAYS drawn in black. Does this have soemthing to
do with drawing on a tiff image? Any Ideas?

FYI here is how I'm loading my image into the DisplayJAI:

    ParameterBlock params = new ParameterBlock();
    params.addSource(image0);
    params.add(scaleFactorX);
    params.add(scaleFactorY);
    params.add(1.0F);         // x translate
    params.add(1.0F);         // y translate
    params.add(interp);       // interpolation method

    /* Create an operator to scale image1. */
    RenderedOp image2 = JAI.create("scale", params);
    PlanarImage ren1 = image2.createInstance();
    SampleModel sampleModel1 =
ren1.getSampleModel().createCompatibleSampleModel(image2.getWidth(),image2.getHeight());
    tileIm = new TiledImage(ren1.getMinX(),ren1.getMinY(), ren1.getWidth(),
      ren1.getHeight(), ren1.getTileGridXOffset(),
ren1.getTileGridYOffset(),
      sampleModel1, ren1.getColorModel());
    tileIm.set(image2);


Sorry for the long winded explanation!

Thanks!

-Sundhar


_________________________________________________________________
Get your FREE download of MSN Explorer at http://explorer.msn.com

===========================================================================
To unsubscribe, send email to [EMAIL PROTECTED] and include in the body
of the message "signoff JAVA2D-INTEREST".  For general help, send email to
[EMAIL PROTECTED] and include in the body of the message "help".

Reply via email to