Re: Read pixels that have been painted on a Canvas?



Cameron Fitzhugh wrote:
I've been painting on a Canvas using the Graphics object returned by getGraphics(). I would like to save an area on the Canvas and later write it back to the Canvas. I've been looking for some way to create a BufferedImage using the pixels from a Graphics object, but no luck.

How do I obtain the pixels from an area on a Canvas?

Thanks,
Cameron



Draw them on the BufferedImage first, then draw the BufferedImage onto the Canvas.

--

Knute Johnson
email s/nospam/knute/
.



Relevant Pages

  • Re: Drawing on TBitmaps canvas always shows white? - Part 2
    ... I have an array of pixels ... >> problem I have is when I want to draw these pixels on the canvas. ...
    (alt.comp.lang.borland-delphi)
  • Re: How can I speed up this pixel drawing code?
    ... > See the proc Raytrace in: ... That won't work for me because the pixels I need to draw aren't ... canvas when you need to draw. ...
    (comp.lang.tcl)
  • How can I speed up this pixel drawing code?
    ... I need to draw 5000+ pixels to a canvas. ... scattered and they're overlaid on a background image. ...
    (comp.lang.tcl)
  • Increasing size of TBitmap
    ... I have a TBitmap on my form (both autosize and stretch are false). ... Its width and height are 100 pixels. ... I also use its canvas to draw ...
    (alt.comp.lang.borland-delphi)
  • Re: Saving canvas
    ... are faqs on how to save a NEW canvas to file. ... on a BufferedImage and save that to the file using ImageIO. ... If the only drawing on your Canvas is done in the paintmethod you could use that method to draw onto the BufferedImage. ...
    (comp.lang.java.programmer)