how do i work in Points and not Pixels for my graphics?

Got a LiveCode personal license? Are you a beginner, hobbyist or educator that's new to LiveCode? This forum is the place to go for help getting started. Welcome!

Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller

Post Reply
d.m.holdawayGA2553
Posts: 81
Joined: Mon Jan 09, 2012 4:48 pm

how do i work in Points and not Pixels for my graphics?

Post by d.m.holdawayGA2553 » Mon May 14, 2012 10:14 pm

Hello,

i noted in the apple developer hand book documentation they seem to use points instead of pixels.

is there a way of using points instead of pixels within livecode?

dunbarx
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 10320
Joined: Wed May 06, 2009 2:28 pm

Re: how do i work in Points and not Pixels for my graphics?

Post by dunbarx » Tue May 15, 2012 12:02 am

Hi.

Do you mean when using graphic objects? Or just in general? Do you mean the ability to specify an x/y coordinate for objects and their properties? When you say "pixels" do you mean the dot drawn on screen at a specific point?

That last is just a bit tongue in cheek. I am trying to discern the difference in your own mind.

One can set the "points" of a graphic object, and this is a powerful tool. One can set the color of various types of "pixels", like "bottomPixel", and these refer to specific areas of an object. One can set the coordinates of just about anything, in x/y form.

The answer is most likely to be "yes". Please write back.

Craig Newman

d.m.holdawayGA2553
Posts: 81
Joined: Mon Jan 09, 2012 4:48 pm

Re: how do i work in Points and not Pixels for my graphics?

Post by d.m.holdawayGA2553 » Tue May 15, 2012 11:58 am

graphic objects, such as backgrounds buttons for example

on the iphone 4 the graphics look blocky, but if i use a different set they look rubbish on the 3G.

i know that 1 Point is a pixel on an old iPhone and 2 pixels on Retina.

mmmhhhhh

bn
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 4172
Joined: Sun Jan 07, 2007 9:12 pm

Re: how do i work in Points and not Pixels for my graphics?

Post by bn » Tue May 15, 2012 12:55 pm

Hi d.m.holdawayGA2553,

look in the iOS Release Notes -> Resolution handling.
you might also search the release notes for "retina"

from the Release Notes:
Resolution handling
The new iPhone 4 has a display with double the resolution in both horizontal and vertical directions. By default, iOS handles this by mapping one logical 'point' to two physical 'pixels' with applications (rev included) interpreting everything in terms of logical points. This means that apps targetted for older devices will run identically on the newer iPhone 4 devices.
As the screenRect and associated properties all deal in logical points, they do not reflect the actual device resolution at which the app is being displayed. To fetch the device screen's resolution in pixels use the iphoneDeviceResolution() function. This will return a string in the form width, height – with the values being given in pixels.
To use the full resolution of such high-resolution devices, use the command: iphoneUseDeviceResolution usePixels, [ nativeControlsUsePixels ]
If usePixels is true, LiveCode will ensure that co-ordinates and sizes specified in LiveCode objects are treated as being in pixels, rather than logical points. In particular, when changed, a resizeStack message will be sent notifying in the size change of the current main-stack, and functions and properties (such as the screenRect) will reflect co-ordinates in pixels.
If nativeControlsUsePixels is true and usePixels is true, any co-ordinates and sizes passed to the iOS native controls (i.e. those managed through the iphoneControl collection of handlers) will also use pixels rather than points. If not specified, or usePixels is false, native controls will assume co- ordinates and sizes are in points.
Note: The notion of pixel and logical point remains valid on older devices, its just that it is always 1-1 thus using this command will have no effect there.
The scale of the devices screen (relative to a non-Retina display) can be queried using iphoneDeviceScale(). This function will return 2 if the display is a Retina display, or 1 otherwise.
kind regards
Bernd

Post Reply