AppletTalk.com Forum Index AppletTalk.com
Java discussions newsgroups
 
Archives   FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

points vs pixels.

 
Post new topic   Reply to topic    AppletTalk.com Forum Index -> Java Help
View previous topic :: View next topic  
Author Message
Roedy Green
Guest





PostPosted: Wed May 19, 2004 9:07 pm    Post subject: points vs pixels. Reply with quote



If you were ever confused about points vs pixels and font sizes, there
are two new pages in the Java glossary to help you.

http://mindprod.com/jgloss/point.html
and
http://mindprod.com/fontshower.html

--
Canadian Mind Products, Roedy Green.
Coaching, problem solving, economical contract programming.
See http://mindprod.com/jgloss/jgloss.html for The Java Glossary.
Back to top
Luke Tulkas
Guest





PostPosted: Thu May 20, 2004 9:51 am    Post subject: Re: points vs pixels. Reply with quote




"Roedy Green" <look-on (AT) mindprod (DOT) com.invalid> wrote

Quote:
If you were ever confused about points vs pixels and font sizes, there
are two new pages in the Java glossary to help you.

http://mindprod.com/jgloss/point.html
and
http://mindprod.com/fontshower.html

Drawing (painting) to different graphical devices can present a problem
if you do it the old way (using integer Points, Rectangles, Fonts,
etc.). But...

There are other ways of doing it. Using Graphics2D (float Points,
Rectangles, etc.), FontRenderContexts and TextLayouts, AffineTransforms.
A bit more complicated, but it works (behind the scenes) like a charm.
Everywhere. You don't even have to know the difference between pixels
and points and that they're not the same on all devices. Maybe you could
mention that in your glossary, too.



Back to top
Tom
Guest





PostPosted: Thu May 20, 2004 1:10 pm    Post subject: Re: points vs pixels. Reply with quote



Roedy Green <look-on (AT) mindprod (DOT) com.invalid> wrote

Quote:
If you were ever confused about points vs pixels and font sizes, there
are two new pages in the Java glossary to help you.

http://mindprod.com/jgloss/point.html
and
http://mindprod.com/fontshower.html

Thanks for all you do Roedy.

One FYI/nit. When I viewed the applet in Mozilla, the last button on
the right was cut off. Thought you'd want to know.

Back to top
Roedy Green
Guest





PostPosted: Thu May 20, 2004 4:08 pm    Post subject: Re: points vs pixels. Reply with quote

On 20 May 2004 06:10:16 -0700, [email]tom.cowdery (AT) bigfoot (DOT) com[/email] (Tom) wrote or
quoted :

Quote:
One FYI/nit. When I viewed the applet in Mozilla, the last button on
the right was cut off. Thought you'd want to know.

I looked with Mozilla and all seemed ok. Which button are you
referring to?
--
Canadian Mind Products, Roedy Green.
Coaching, problem solving, economical contract programming.
See http://mindprod.com/jgloss/jgloss.html for The Java Glossary.

Back to top
Roedy Green
Guest





PostPosted: Thu May 20, 2004 4:36 pm    Post subject: Re: points vs pixels. Reply with quote

On Wed, 19 May 2004 23:21:55 GMT-5, [email]DaleKing (AT) newsrvr (DOT) tce.com[/email] (Dale
King) wrote or quoted :

Quote:
The
default device coordinate space is 72 units per inch which does
not necessarily correspond to pixels. The user can then add an
affine transform to create whatever coordinate system they like.

I will add that.

I'm using Graphic2D a lot myself lately. I guess when I do these
essays I am thinking only about the newbie, and tend to forget about
more advanced stuff.

--
Canadian Mind Products, Roedy Green.
Coaching, problem solving, economical contract programming.
See http://mindprod.com/jgloss/jgloss.html for The Java Glossary.

Back to top
Roedy Green
Guest





PostPosted: Thu May 20, 2004 5:34 pm    Post subject: Re: points vs pixels. Reply with quote

On Thu, 20 May 2004 16:36:37 GMT, Roedy Green
<look-on (AT) mindprod (DOT) com.invalid> wrote or quoted :

Quote:
default device coordinate space is 72 units per inch which does
not necessarily correspond to pixels. The user can then add an
affine transform to create whatever coordinate system they like.

I will add that.

This is now done. The material was there before, it is just now I put
more emphasis on it.

--
Canadian Mind Products, Roedy Green.
Coaching, problem solving, economical contract programming.
See http://mindprod.com/jgloss/jgloss.html for The Java Glossary.

Back to top
Dale King
Guest





PostPosted: Tue May 25, 2004 3:12 pm    Post subject: Re: points vs pixels. Reply with quote

"Roedy Green" <look-on (AT) mindprod (DOT) com.invalid> wrote

Quote:
On Thu, 20 May 2004 16:36:37 GMT, Roedy Green
[email]look-on (AT) mindprod (DOT) com.inva[/email]lid> wrote or quoted :

default device coordinate space is 72 units per inch which does
not necessarily correspond to pixels. The user can then add an
affine transform to create whatever coordinate system they like.

I will add that.

This is now done. The material was there before, it is just now I put
more emphasis on it.

You added very little emphasis on it. You add it as an afterthought as
though it were extraneous information. I'm sorry to be so nit-picky and this
is an advanced topic that requires a paradigm shift in your way of thinking.
But I don't think it is best to teach newbies the flawed concept of thinking
in pixels only to then have to have them unlearn it later. It is best to
start them down the right path from the beginning.

Issues:

"The origin 0,0 is in the top left corner...not the bottom left where
Descartes put it": Technically Descartes put it in the center. The notion of
top and bottom corresponding to a particular direction for y is an arbitrary
convention.

"For Java units are integer pixels": That was true for Java 1.1 but not for
Java2D, where they are neither integer nor pixels.

"For mouse events, drawing geometric shapes, and placing Components with
absolute co-ordinates in the null layout, the origin 0,0 is the upper left
corner.": The issue is the upper left corner of what? The answer depends on
the situation, but is usually the container of the component.

"When you place an object on the screen, you specify the location of its
upper left corner.": Not necessarily true in user coordinate space.

"For GridBagLayouts the origin 0,0 is the upper left corner of the enclosing
container": This is not a function of the layout but of the container.

"drawRectangle and brothers deliberately draw rectangles one pixel taller
and wider than requested": That is true, but in Java2D you use drawShape and
have much greater control. You specify where the border of the shape is and
the stroke that is drawn on top of that line such that typically you are
specifying the center of the drawn outline.

"Because co-ordinates are measured in hardware-dependent pixels, images
generated by Java programs will be smaller when they are displayed on high
resolution displays": Not in Java2D

I could go on but, I think that is a representative sample.

--
Dale King
My Blog: http://nobleware.homedns.org/Blog



Back to top
Roedy Green
Guest





PostPosted: Tue May 25, 2004 5:04 pm    Post subject: Re: points vs pixels. Reply with quote

On Tue, 25 May 2004 10:12:53 -0500, "Dale King" <KingD (AT) tmicha (DOT) net>
wrote or quoted :

Quote:
You added very little emphasis on it. You add it as an afterthought as
though it were extraneous information

It is for newbies. They start with AWT which uses integer addressing.

--
Canadian Mind Products, Roedy Green.
Coaching, problem solving, economical contract programming.
See http://mindprod.com/jgloss/jgloss.html for The Java Glossary.

Back to top
Roedy Green
Guest





PostPosted: Tue May 25, 2004 5:21 pm    Post subject: Re: points vs pixels. Reply with quote

On Tue, 25 May 2004 17:04:12 GMT, Roedy Green
<look-on (AT) mindprod (DOT) com.invalid> wrote or quoted :

Quote:
You added very little emphasis on it. You add it as an afterthought as
though it were extraneous information

It is for newbies. They start with AWT which uses integer addressing.

All the textbooks talk about integer addressing. Integer addressing is
what happens eventually after all the Graphic2D methods have done
their thing. If you want fine control to the pixel, you need integer
addressing.

Throwing in AffineTransforms is too much complication for the newbie.
I think he should start with integer pixels.

It is roughly the same argument as to whether you should teach an
assembler language before or after Java.



--
Canadian Mind Products, Roedy Green.
Coaching, problem solving, economical contract programming.
See http://mindprod.com/jgloss/jgloss.html for The Java Glossary.

Back to top
Roedy Green
Guest





PostPosted: Tue Jun 01, 2004 5:03 pm    Post subject: Re: points vs pixels. Reply with quote

On Tue, 1 Jun 2004 07:59:54 GMT-5, [email]DaleKing (AT) newsrvr (DOT) tce.com[/email] (Dale
King) wrote or quoted :

Quote:

So instead we should throw in false information to trip him up
later whenhe finds that information wasn't true?

I presented no false information. I simply presented in it an
different order.



The reasons I presented pixel level graphics first include:

1. You can't even draw a line with AffineTransform.

2. You don't need to understand the mathematically daunting transform
matrices. Many people are terrified of trig.

3. You don't need to pick a co-ordinate system.

4. Every pixel rendered can be explained. With AffineTransform, things
are only roughly accurate, and all falls apart if you start drawing
detail on the pixel level.

5. It is faster.

6. Historically it is what came first.

7. It is what the beginner text books teach.


8. It is what underpin AffineTransforms. I think strange Affine
rounding behaviours will make much more sense after you have fooled
around at the pixel level.


Now cut this calumny out. We simply disagree. Stop accusing me of
spreading false information.

--
Canadian Mind Products, Roedy Green.
Coaching, problem solving, economical contract programming.
See http://mindprod.com/jgloss/jgloss.html for The Java Glossary.

Back to top
Roedy Green
Guest





PostPosted: Mon Jun 07, 2004 8:18 pm    Post subject: Re: points vs pixels. Reply with quote

On Sun, 6 Jun 2004 10:35:45 GMT-5, [email]DaleKing (AT) newsrvr (DOT) tce.com[/email] (Dale
King) wrote or quoted :

Quote:
They won't make any sense atall based on your entry, because you
have not given any basis to understand anything about it.
Whentheyencounter something like that they will be confused and
your stated purpose at the beginning of this thread was to
eliminate confusion.

It is pretty obvious what happens when you work at the pixel level and
see the rounding problem, the hanging extra line of pixels etc.

All of this is muddied when you use a transform.

It comes down to this, pixels are conceptually simpler.
AffineTransforms are more generic.

I think it is easier to start with pixels.

They are more abstract. Abstract is what you want when you know what
you are doing. When you are just figuring things out, abstractions
just get in the way. You can at least draw lines without having to
think of them as rectangles of sufficient thickness to actually
appear.

The other thing ironically some newbie COULD start with the
AffineTransform entry rather than co-ordinate entry and do it your way
anyway.

You want something with as few bells and whistles as possible when you
are getting started. AffineTransform has a ton of them.

I was trained as a mathematician, so AffineTransform is not that
daunting. I have done for pay coaching on it, and it really does seem
to scare the hell out of people without a math background.

The wording I use now in talking about co-ordinate systems is more
waffly. Perhaps is won't grate you so much.

I think we have both stated our opinions clearly and it is time to
agree to disagree.

--
Canadian Mind Products, Roedy Green.
Coaching, problem solving, economical contract programming.
See http://mindprod.com/jgloss/jgloss.html for The Java Glossary.

Back to top
Dale King
Guest





PostPosted: Sun Feb 05, 2006 5:29 pm    Post subject: Re: points vs pixels. Reply with quote

Hello, Roedy Green !
You wrote:

Quote:
If you were ever confused about points vs pixels and font
sizes, there
are two new pages in the Java glossary to help you.

Except that you are spreading the confusion. Your information
there is sadly out of date. The idea that user coordinates are
integer and correspond to pixels was true back in the days of
JDK1.1, but with the advent of Java2D that is no longer true. The
default device coordinate space is 72 units per inch which does
not necessarily correspond to pixels. The user can then add an
affine transform to create whatever coordinate system they like.

--
Dale King
My Blog: http://daleking.homedns.org/Blog

Back to top
Dale King
Guest





PostPosted: Sun Feb 05, 2006 5:35 pm    Post subject: Re: points vs pixels. Reply with quote

Hello, Roedy Green !
You wrote:

Quote:
On Tue, 25 May 2004 10:12:53 -0500, "Dale King"
[email]KingD (AT) tmicha (DOT) net[/email]
wrote or quoted :

You added very little emphasis on it. You add it as an
afterthought as
though it were extraneous information

It is for newbies.

I see nothing limiting the article to newbies. And I don't see
how you are doing them any favors by teaching them erroneous
information that they will have to unlearn later.

Quote:
They start with AWT which uses integer addressing.

AWT can use affine transforms and Swing also uses integer
coordinates. The issue isnot so much whether the coordinates are
integers, but the notion that coordinate units are pixels.
--
Dale King
My Blog: http://daleking.homedns.org/Blog

Back to top
Dale King
Guest





PostPosted: Sun Feb 05, 2006 5:35 pm    Post subject: Re: points vs pixels. Reply with quote

Hello, Roedy Green !
You wrote:

Quote:
On Tue, 25 May 2004 17:04:12 GMT, Roedy Green
[email]look-on (AT) mindprod (DOT) com.inva[/email]lid> wrote or quoted :

You added very little emphasis on it. You add it as an
afterthought as
though it were extraneous information

It is for newbies. They start with AWT which uses integer
addressing.

All the textbooks talk about integer addressing. Integer
addressing is
what happens eventually after all the Graphic2D methods have
done
their thing. If you want fine control to the pixel, you need
integer
addressing.

Unless you understand the rendering process you will not get
rendering to the pixel. Coordinate units are not necessarily
pixels.

And in reality you should not be designing to the pixel, because
it is inherently unportable. Devices have different resolutions.
I see no reason to start a newbie down that flawed path.

Quote:
Throwing in AffineTransforms is too much complication for the
newbie.


So instead we should throw in false information to trip him up
later whenhe finds that information wasn't true?

I'm not saying that there needs to be great detail on
AffineTransform but there at least should not be false
information and there should probably be a general overview of
the rendering process. At least if there is going to be gross
oversimplifications then it should be qualified as such with
pointers to the true information.

Quote:
I think he should start with integer pixels.

Why shouldthe newbie be lied to?

Quote:
It is roughly the same argument as to whether you should teach
an
assembler language before or after Java.

Not a valid comparison. Assembler is additonal information. Here
we are talking about replacement of factual information with
oversimplified falsehoods.
--
Dale King
My Blog: http://daleking.homedns.org/Blog

Back to top
Dale King
Guest





PostPosted: Sun Feb 05, 2006 5:39 pm    Post subject: Re: points vs pixels. Reply with quote

Hello, Roedy Green !
You wrote:

Quote:
On Tue, 1 Jun 2004 07:59:54 GMT-5, [email]DaleKing (AT) newsrvr (DOT) tce.com[/email]
(Dale
King) wrote or quoted :


So instead we should throw in false information to trip him up
later whenhe finds that information wasn't true?

I presented no false information. I simply presented in it an
different order.

You said that coordinate units are pixels, which is not
necessarily true and is generally not true for rendering for
printing.

Quote:
The reasons I presented pixel level graphics first include:

1. You can't even draw a line with AffineTransform.

You can draw a Shape where the shape consists of one or more line
segments. You have so much more control over rendering and it is
much nicer than drawing lines because you can declare the shape
in relative coordinates and draw it anywhere easily. Once you are
familiar with it you would never go back to the lousy pre-Java2D
system.

Quote:
2. You don't need to understand the mathematically daunting
transform
matrices. Many people are terrified of trig.

I wasn't recommending you go to that level of detail and you
really don't need to understand trig to know what an
AffineTransform does for you and to understand the rendering
pipeline.

Quote:
3. You don't need to pick a co-ordinate system.

But itis nice to know that you can.

Quote:
4. Every pixel rendered can be explained. With AffineTransform,
things
are only roughly accurate, and all falls apart if you start
drawing
detail on the pixel level.

And that is part of my point, you really shouldn't be drawing on
the pixel level it isn't portable.

Quote:
5. It is faster.

There is no difference in speed. The rendering pipeline is used
in either case.

Quote:
6. Historically it is what came first.

Vector and Hashtable came before the collections API, but I don't
recommend teaching them in place of the collections API. Instead
you teach the collections API and they are a footnote in that
discussion.

Quote:
7. It is what the beginner text books teach.

That's a pretty low standard

Quote:
8. It is what underpin AffineTransforms. I think strange
Affine
rounding behaviours will make much more sense after you have
fooled
around at the pixel level.

They won't make any sense atall based on your entry, because you
have not given any basis to understand anything about it.
Whentheyencounter something like that they will be confused and
your stated purpose at the beginning of this thread was to
eliminate confusion.

Quote:
Now cut this calumny out. We simply disagree. Stop accusing
me of
spreading false information.

Coordinate units are not necessarily pixels. It is false
information to say that they are.
--
Dale King
My Blog: http://daleking.homedns.org/Blog

Back to top
Display posts from previous:   
Post new topic   Reply to topic    AppletTalk.com Forum Index -> Java Help All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2006 phpBB Group
SEO toolkit © 2004-2006 webmedic.