![]() |
drawImage
I'm looking at the drawImage routines in the Graphics class:
http://docs.oracle.com/javase/1.4.2/.../Graphics.html I noticed all of them take integers for the x, y, width, height. This is not necessarily the best thing since you may have a matrix that scales the canvas by… say 1000 times. Then, it might make sense to have a float passed in. Maybe there should be drawImageF versions or something so we can pass floats in? Any ideas? |
Re: drawImage
On 1/18/13 1:53 PM, bob smith wrote:
> I'm looking at the drawImage routines in the Graphics class: > > http://docs.oracle.com/javase/1.4.2/.../Graphics.html > > I noticed all of them take integers for the x, y, width, height. > > This is not necessarily the best thing since you may have a matrix that scales the canvas by… say 1000 times. Then, it might make sense to have a float passed in. > > Maybe there should be drawImageF versions or something so we can pass floats in? > > Any ideas? > First off, you're looking at the wrong class. Second off, you're looking at a very old version of the wrong class. <http://docs.oracle.com/javase/7/docs/api/java/awt/Graphics2D.html> If you look in here, you'll see there is a method which takes an image and an AffineTransform instance. |
Re: drawImage
On Fri, 18 Jan 2013 13:53:05 -0800 (PST), bob smith
<bob@coolfone.comze.com> wrote, quoted or indirectly quoted someone who said : >I noticed all of them take integers for the x, y, width, height. =20 Sun had the same thought. Have a look at Graphics2D where there are AffineTransforms and double/float versions of a number of the methods, but not all! See http://mindprod.com/jgloss/graphics2d.html http://mindprod.com/jgloss/affinetransform.html -- Roedy Green Canadian Mind Products http://mindprod.com The first 90% of the code accounts for the first 90% of the development time. The remaining 10% of the code accounts for the other 90% of the development time. ~ Tom Cargill Ninety-ninety Law |
Re: drawImage
Daniel Pitts wrote:
>bob smith wrote: >> I'm looking at the drawImage routines in the Graphics class: >> http://docs.oracle.com/javase/1.4.2/.../Graphics.html > >> I noticed all of them take integers for the x, y, width, height. >> This is not necessarily the best thing since you may have a matrix that scales >> the canvas by� say 1000 times. Then, it might make sense to have a float passed in. >> Maybe there should be drawImageF versions or something so we can pass floats in? > >> Any ideas? > > First off, you're looking at the wrong class. > Second off, you're looking at a very old version of the wrong class. > > <http://docs.oracle.com/javase/7/docs/api/java/awt/Graphics2D.html> > > If you look in here, you'll see there is a method which takes an image > and an AffineTransform instance. And on other methods you'll see, e.g., not two but four 'drawString()' overloads that, like the 'drawImage()' overloads, do not bother with naming the method differently. That "F" wart in the name 'drawImageF' is not necessary. Also, it is not compliant with the Java Coding Conventions. Some argue against overloads. I say use them if they suit. One place they do not is factory methods. -- Lew |
| All times are GMT. The time now is 01:51 PM. |
Powered by vBulletin®. Copyright ©2000 - 2013, vBulletin Solutions, Inc.
SEO by vBSEO ©2010, Crawlability, Inc.