Length/Angle/Color Wiki Pages

12 views
Skip to first unread message

Stephen Chin

unread,
Oct 16, 2011, 11:04:56 PM10/16/11
to visag...@googlegroups.com, visage...@googlegroups.com
I added a few new wiki pages documenting the Length, Angle, and Color classes (based on details from earlier forum posts).

Hopefully they are useful to others:

For folks working on wrapping APIs, the Length literal is one that we should be making liberal use of wherever pixels or other similar measures are used in the JavaFX and Android APIs.  This applies to window size/position, layouts, borders, etc.

Cheers,
--
--Steve
blog: http://steveonjava.com/

Alain Béarez

unread,
Oct 17, 2011, 9:52:44 AM10/17/11
to visag...@googlegroups.com, visage...@googlegroups.com
Steve,

Does your "liberal use" mean that we should prune every method using "float" as parameters and substitute them with "Length" parameters?

Best regards,
-- 
Alain

Stephen Chin

unread,
Oct 18, 2011, 2:14:22 AM10/18/11
to visag...@googlegroups.com
Substituting all floats might be going a bit far. :)

Basically, anywhere you think it would be helpful/useful. I am looking
forward to being able to use it in layouts myself (rather than
specifying fixed pixel values). Also, anything that is a size or
position is be a good candidate. For example, it would be cool to be
able to specify the center and radius of a circle with millimeters
rather than pixels. I guess the question to ask yourself is if the api
is expecting a pixel coordinate or value. If the answer is yes, it
should probably be a length instead.

Also, when converting a length back to pixels (which will probably be
the common case), we need to have a standard set of conversion factors
to pass in to the toPixels function. Probably need a new singleton for
this so it can be reused through all the JavaFX APIs, and set once with
the screen dpi and scale factors.

Cheers,
--Steve

Alain Béarez

unread,
Oct 20, 2011, 5:29:53 PM10/20/11
to visag...@googlegroups.com
Sorry for not being quite clear with my phrasing. You made it much clearer than I could.

Would it be clean to have the conversion factors set at the Stage level for the density and scale factors?
I understand that the further two factors are component dependent, i.e. to be defined by the parent node.

Regards,
Alain

Stephen Chin

unread,
Oct 20, 2011, 11:22:00 PM10/20/11
to visag...@googlegroups.com, Alain Béarez
Yeah, the stage is the right level for that... Ideally we can pick it
up from the environment automatically so the user doesn't have to set
anything.
Reply all
Reply to author
Forward
0 new messages