Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.java.programmer > #21545 > unrolled thread

drawImage

Started bybob smith <bob@coolfone.comze.com>
First post2013-01-18 13:53 -0800
Last post2013-01-18 14:53 -0800
Articles 4 — 4 participants

Back to article view | Back to comp.lang.java.programmer


Contents

  drawImage bob smith <bob@coolfone.comze.com> - 2013-01-18 13:53 -0800
    Re: drawImage Daniel Pitts <newsgroup.nospam@virtualinfinity.net> - 2013-01-18 13:57 -0800
      Re: drawImage Lew <lewbloch@gmail.com> - 2013-01-18 16:44 -0800
    Re: drawImage Roedy Green <see_website@mindprod.com.invalid> - 2013-01-18 14:53 -0800

#21545 — drawImage

Frombob smith <bob@coolfone.comze.com>
Date2013-01-18 13:53 -0800
SubjectdrawImage
Message-ID<aff1a9e3-cee8-4b14-8dbb-eb103c6963b4@googlegroups.com>
I'm looking at the drawImage routines in the Graphics class:

http://docs.oracle.com/javase/1.4.2/docs/api/java/awt/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?

[toc] | [next] | [standalone]


#21546

FromDaniel Pitts <newsgroup.nospam@virtualinfinity.net>
Date2013-01-18 13:57 -0800
Message-ID<xzjKs.12227$O02.3391@newsfe18.iad>
In reply to#21545
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/docs/api/java/awt/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.


[toc] | [prev] | [next] | [standalone]


#21558

FromLew <lewbloch@gmail.com>
Date2013-01-18 16:44 -0800
Message-ID<6f917b7b-0916-4146-8b81-43d99c6f327a@googlegroups.com>
In reply to#21546
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/docs/api/java/awt/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

[toc] | [prev] | [next] | [standalone]


#21549

FromRoedy Green <see_website@mindprod.com.invalid>
Date2013-01-18 14:53 -0800
Message-ID<ufkjf8dbudtbmtfchnmba28ds17hftvudi@4ax.com>
In reply to#21545
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 

[toc] | [prev] | [standalone]


Back to top | Article view | comp.lang.java.programmer


csiph-web