westei / thumbnailator

Automatically exported from code.google.com/p/thumbnailator
Other
0 stars 0 forks source link

add Builder.drawTo(Grapgics2D g, ...) method #28

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
Please add Builder.drawTo(Grapgics2D g, ...) to write the thumbnail to existing 
graphics directly.

Original issue reported on code.google.com by m.zd...@gmail.com on 16 Nov 2011 at 8:45

GoogleCodeExporter commented 9 years ago
Once again, thank you for your suggestion.

I'm trying to think of an exact use case for this function.
Perhaps, passing a pre-tranformed `Graphics2D` object to which the thumbnail 
should be drawn on?

Internally, the smallest unit used for processing is a `BufferedImage` object, 
and any drawing is done by first obtaining an `Graphics2D` object from the 
`BufferedImage` rather than passing around `Graphics` objects. (Reworking the 
internals to pass around `Graphics` objects would be a very large endeavor 
which I feel doesn't have a good return on investment.)

Therefore, a hypothetical `Builder.drawTo(Graphics g)` method would just be a 
method which internally draws the `BufferedImage` onto the given `Graphics` 
object.

If that's all that's needed, it shouldn't be too difficult to add to the 
`Builder` class, but I feel that's something that could be done just as simply 
outside of the Thumbnailator API:

  Graphics g = getGraphicsFromSomewhere();

  BufferedImage img = 
    Thumbnails.of("path/to/image")
      .size(100, 100)
      .asBufferedImage();

  g.drawImage(img, 0, 0, null);

Original comment by coobird...@gmail.com on 26 Nov 2011 at 8:09

GoogleCodeExporter commented 9 years ago
This issue has been open for more than 6 months without much interest (only a 
single star has been given), and I find it difficult to find an use case for 
this addition, so I'll be closing this issue without additional action.

Original comment by coobird...@gmail.com on 9 Jun 2012 at 6:40