Here is another report. Thanks, -Oleg > > ************************************************ >Your report has been assigned an internal review ID of: 137624 > >This review ID is NOT visible on the "Java Developer Connection" (JDC). >-------------------------------------------- >dateCreated: Thu Dec 20 16:59:56 MST 2001 >type: bug >cust_name: Oleg Pariser >cust_email: [EMAIL PROTECTED] >jdcid: opariser >status: Waiting >category: java3d >subcategory: other >company: Jet Propulsion Lab >release: 1.2.1 >hardware: sun4 >OSversion: sol2.7 >priority: 4 >synopsis: J3DGraphics2D.drawAndFlushImage(...) doesn't work well >with J3DG2D.copyArea() >description: FULL PRODUCT VERSION : >java version "1.4.0-beta3" >Java(TM) 2 Runtime Environment, Standard Edition (build >1.4.0-beta3-b84) >Java HotSpot(TM) Client VM (build 1.4.0-beta3-b84, mixed >mode) > >FULL OPERATING SYSTEM VERSION : >SunOS monolith 5.7 Generic_106541-16 sun4u sparc >SUNW,Ultra-5_10 > > > >EXTRA RELEVANT SYSTEM CONFIGURATION : >Java 3D(TM) 1.3 Beta 1 >Java Advanced Imaging(JAI) v1.1.1 > >A DESCRIPTION OF THE PROBLEM : >The new method call in Java3D v1.3 beta1 >J3DGraphics2D.drawAndFlushImage(...) gives inconsistent >results when followed by J3DGraphics2D.copyArea(...) call. >By inconsistent results I mean repainting the image leads to >the one of the following: >a) copyArea is not copied >b) copyArea is copied( correct result) >c) Only first few rows of Image repainted, the rest is >background color. >d) Only copied area gets repainted, the rest is background >color. >e) The whole image area of background color. > >++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ >Here is a rendering loop: > >_j3DG2D.flush(true); >_gc3D.clear(); >_j3DG2D.drawAndFlushImage(_image, 0, 0, null); >_j3DG2D.copyArea(30, 30, 100, 100, 100, 200); >_j3DG2D.flush(true); >_gc3D.flush(true); > >If I substitute _j3DG2D.drawAndFlushImage(_image, 0, 0, >null) call with equivalent two separate calls listed below, >then the behavior of the program is consistent and correct. > >_j3DG2D.drawImage(_image, 0, 0, null); >_j3DG2D.flush(true); > > > >STEPS TO FOLLOW TO REPRODUCE THE PROBLEM : >1.Compile and run attached program Test.java >2.Resize window or do something else to trigger >paint(Graphics g) execution. >3.Look at the results. > >EXPECTED VERSUS ACTUAL BEHAVIOR : >Expected result is that image gets redrawn with portion of >the image gets copied as specified by copyArea(...) call. > >Actual result varies: >a) copyArea is not copied >b) copyArea is copied( correct result) >c) Only first few rows of Image repainted, the rest is >background color. >d) Only copied area gets repainted, the rest is background >color. >e) The whole image area of background color. > >This bug can be reproduced always. > >---------- BEGIN SOURCE ---------- >import java.awt.*; >import java.awt.image.*; >import java.awt.color.*; >import javax.swing.*; >import javax.vecmath.*; >import javax.media.j3d.*; >import javax.media.jai.*; >import com.sun.j3d.utils.universe.SimpleUniverse; >import com.sun.media.jai.codec.ImageCodec; > >public class Test extends Canvas3D { > > //Properties > > private GraphicsContext3D _gc3D; > private J3DGraphics2D _j3DG2D; > private BufferedImage _image; > > public Test(GraphicsConfiguration config, BufferedImage >image) > { > super(config); > > _image = image; > > //Stop the renderer, since we use immediate mode rendering. > stopRenderer(); > // Create a simple scene and attach it to the virtual universe > SimpleUniverse universe = new SimpleUniverse(this); > > // This will move the ViewPlatform back a bit so the > // objects in the scene can be viewed. > >universe.getViewingPlatform().setNominalViewingTransform(); > } > > public void paint(Graphics g) > { > super.paint(g); > if(_gc3D == null || _j3DG2D == null) { > > setDoubleBufferEnable(false); > > _gc3D = getGraphicsContext3D(); > _gc3D.setBufferOverride(true); > _gc3D.setAppearance(new Appearance()); > _gc3D.setBackground(new Background(new >Color3f(Color.black))); > > _j3DG2D = getGraphics2D(); > } > > _j3DG2D.flush(true); > _gc3D.clear(); > > _j3DG2D.drawAndFlushImage(_image, 0, 0, null); > /* > _j3DG2D.drawImage(_image, 0, 0, null); > _j3DG2D.flush(true); > */ > _j3DG2D.copyArea(30, 30, 100, 100, 100, 200); > _j3DG2D.flush(true); > _gc3D.flush(true); > } > > /** > * This function simply calls paint(Graphics g) which is >different > * from parent's implementation > */ > public void update(Graphics g) > { > paint(g); > } > > public static void main(String[] argv) > { > if(argv.length != 1){ > System.out.println("Usage: java Test imageFileName"); > System.exit(0); > } > GraphicsConfigTemplate3D template = new >GraphicsConfigTemplate3D(); > GraphicsConfiguration config > = >GraphicsEnvironment.getLocalGraphicsEnvironment(). > >getDefaultScreenDevice().getBestConfiguration(template); > > PlanarImage image = JAI.create("fileload", argv[0]); > Test myCanvas3D = new Test(config, >image.getAsBufferedImage()); > > JFrame jFrame = new JFrame(); > jFrame.getContentPane().setLayout(new BorderLayout()); > jFrame.getContentPane().add(myCanvas3D, >BorderLayout.CENTER); > > jFrame.pack(); > jFrame.setSize(400, 500); > jFrame.setVisible(true); > } >} >---------- END SOURCE ---------- > >CUSTOMER WORKAROUND : >Instead of using new feature in Java3D v1.3 >J3DGraphics2D.drawAndFlushImage(...), use two separate >calls: >J3DGraphics2D.drawImage(...); >J3DGraphics2D.flush(true); > >which is equivalent but involves extra image copy which >affects performance. >workaround: >comments: (company - Jet Propulsion Lab , email - [EMAIL PROTECTED])
-- =========================================================================== To unsubscribe, send email to [EMAIL PROTECTED] and include in the body of the message "signoff JAVA3D-INTEREST". For general help, send email to [EMAIL PROTECTED] and include in the body of the message "help".