I am using the lastest JDK 1.4.1_01 on a Win98SE machine with PentiumIII (Geforce2MX/MX400 with 64MB)
and i modified my code now a little bit
... loading pixel data (special format)
// now create image from pixels
itsImage = gc.createCompatibleImage(width, height, Transparency.BITMASK);
BufferedImage aBufferedImage = (BufferedImage)itsImage; // <-- is this safe ????
... use setRGB to set only some pixels
aBufferedImage.setRGB(..);
aBufferedImage = null; // <-- is this needed ?
now we come to the funny part in a ScrollPane i draw the Image in paint() and i do not use an special Offscreen technic, first i call super.paint() then i do my g.drawImage on a Graphics Object
with Dsun.java2d.trace=log output is
sun.java2d.loops.Blit::Blit(IntArgbBm, SrcOverNoEa, Ushort565Rgb)
image is not drawn correctly i paint it on (11,11) but its displayed at (9,9)
then i click on my console created ( i use java not javaw ) but any other window will do fine 2.
the window will overlap and hide my image so when i return to my application screen must be redrawn
sun.awt.windows.Win32BlitLoops$DelegateBlitBgLoop::BlitBg(Any, SrcNoEa, “Short 5
65 RGB DirectDraw with 1 bit transp”)
sun.java2d.loops.SetFillRectANY::FillRect(AnyColor, SrcNoEa, Any)
sun.java2d.loops.Blit::Blit(IntArgbBm, SrcOverNoEa, Ushort565Rgb)
sun.java2d.loops.Blit::Blit(Ushort565Rgb, SrcNoEa, Ushort565Rgb)
sun.awt.windows.Win32BlitLoops::Blit("Short 565 RGB DirectDraw with 1 bit transp
", SrcOverNoEa, “Short 565 RGB DirectDraw”)
looks nice because now java uses hw acceleration
and image is now painted correctly at (10,10)
now i click again at my console window which comes to foreground and overlaps my application again and then i click again in my application , so my image and window must be redrawn
sun.java2d.loops.Blit::Blit(IntArgbBm, SrcOverNoEa, Ushort565Rgb)
hw acceleration is not used anymore, funny, but now i click again in my console it comes to foreground and overlapps my image and then switch back to my application
sun.awt.windows.Win32BlitLoops::Blit("Short 565 RGB DirectDraw with 1 bit transp
", SrcOverNoEa, “Short 565 RGB DirectDraw”)
what happened ? its now using hw acceleration again !!! and now u can click in console or move any other window over my image it will use hw acceleration every time.
My Image is a Tile for a Game its isometric ( its a floor tile ) and some parts are transparent, my application is a tile editor and draws a white rect first and paints then the image over it, otherweise i wouldnt recognize the wrong position (9,9) instead of (11,11)