1. JPEG Resolution

Hi,

Can anyone help me by providing a function to tell me the resolution of a JPEG
File?

I'm using GD at the moment.

Thanks,

Alex

new topic     » topic index » view message » categorize

2. Re: JPEG Resolution

Alex Chamberlain wrote:
> 
> Hi,
> 
> Can anyone help me by providing a function to tell me the resolution of a JPEG
> File?
> 
> I'm using GD at the moment.
> 
> Thanks,
> 
> Alex

Hi there,


Are you talking about the DPI (dots per inch) ?


Take care,
Al

And, good luck with your Euphoria programming!

My bumper sticker: "I brake for LED's"

new topic     » goto parent     » topic index » view message » categorize

3. Re: JPEG Resolution

Al Getz wrote:
> 
> Alex Chamberlain wrote:
> > 
> > Hi,
> > 
> > Can anyone help me by providing a function to tell me the resolution of a
> > JPEG
> > File?
> > 
> > I'm using GD at the moment.
> > 
> > Thanks,
> > 
> > Alex
> 
> Hi there,
> 
> 
> Are you talking about the DPI (dots per inch) ?
> 
> 
> Al

Yeah!

new topic     » goto parent     » topic index » view message » categorize

4. Re: JPEG Resolution

Alex Chamberlain wrote:
> 
> Al Getz wrote:
> > 
> > Alex Chamberlain wrote:
> > > 
> > > Hi,
> > > 
> > > Can anyone help me by providing a function to tell me the resolution of a
> > > JPEG
> > > File?
> > > 
> > > I'm using GD at the moment.
> > > 
> > > Thanks,
> > > 
> > > Alex
> > 
> > Hi there,
> > 
> > 
> > Are you talking about the DPI (dots per inch) ?
> > 
> > 
> > Al
> 
> Yeah!


Hi again Alex,


Sorry, i have an inch thick stack of notes on the jpg file format
and i cant seem to find anything on the dpi of the file.  It's 
been so long now since i've worked with this i dont remember how
to find or calculate this.  Maybe ask again or on another
forum?


Take care,
Al

And, good luck with your Euphoria programming!

My bumper sticker: "I brake for LED's"

new topic     » goto parent     » topic index » view message » categorize

5. Re: JPEG Resolution

Al Getz wrote:
> 
> Alex Chamberlain wrote:
> > 
> > Al Getz wrote:
> > > 
> > > Alex Chamberlain wrote:
> > > > 
> > > > Hi,
> > > > 
> > > > Can anyone help me by providing a function to tell me the resolution of
> > > > a JPEG
> > > > File?
> > > > 
> > > > I'm using GD at the moment.
> > > > 
> > > > Thanks,
> > > > 
> > > > Alex
> > > 
> > > Hi there,
> > > 
> > > 
> > > Are you talking about the DPI (dots per inch) ?
> > > 
> > > 
> > > Al
> > 
> > Yeah!
> 
> 
> Hi again Alex,
> 
> 
> Sorry, i have an inch thick stack of notes on the jpg file format
> and i cant seem to find anything on the dpi of the file.  It's 
> been so long now since i've worked with this i dont remember how
> to find or calculate this.  Maybe ask again or on another
> forum?
> 
> 
> Al
> 
> 
> My bumper sticker: "I brake for LED's"

Correct me if I'm wrong but isn't DPI a measurement of an output device?

How big is a pixel?
http://heim.ifi.uio.no/~gisle/photo/pixels.html

-- Brian

new topic     » goto parent     » topic index » view message » categorize

6. Re: JPEG Resolution

Brian Broker wrote:
> 
> Al Getz wrote:
> > 
> > Alex Chamberlain wrote:
> > > 
> > > Al Getz wrote:
> > > > 
> > > > Alex Chamberlain wrote:
> > > > > 
> > > > > Hi,
> > > > > 
> > > > > Can anyone help me by providing a function to tell me the resolution
> > > > > of
> a JPEG</font></i>
> > > > > File?
> > > > > 
> > > > > I'm using GD at the moment.
> > > > > 
> > > > > Thanks,
> > > > > 
> > > > > Alex
> > > > 
> > > > Hi there,
> > > > 
> > > > 
> > > > Are you talking about the DPI (dots per inch) ?
> > > > 
> > > > 
> > > > Al
> > > 
> > > Yeah!
> > 
> > 
> > Hi again Alex,
> > 
> > 
> > Sorry, i have an inch thick stack of notes on the jpg file format
> > and i cant seem to find anything on the dpi of the file.  It's 
> > been so long now since i've worked with this i dont remember how
> > to find or calculate this.  Maybe ask again or on another
> > forum?
> > 
> > 
> > Al
> > 
> > 
> > My bumper sticker: "I brake for LED's"
> 
> Correct me if I'm wrong but isn't DPI a measurement of an output device?
> 
> How big is a pixel?
> <a
> href="http://heim.ifi.uio.no/~gisle/photo/pixels.html">http://heim.ifi.uio.no/~gisle/photo/pixels.html</a>
> 
> -- Brian

Hi Brian,


What i was assuming was that he was after something like the bitmap
file header contains: PelsPerMeter for Vertical and Horizontal,
but couldnt find anything that had a unit of length in it.
It's possible to calculate (for jpg) but i cant seem to find the doc's on it.
I think it's because when i was doing my jpg decoder i had no use
for the resolution data because most of the time there's only one picture
to choose from and one monitor to choose from.
I think the last time i worked on my .jpg decoder (in the archives) was
around 1999 or so.


Take care,
Al

And, good luck with your Euphoria programming!

My bumper sticker: "I brake for LED's"

new topic     » goto parent     » topic index » view message » categorize

7. Re: JPEG Resolution

Al Getz wrote:
> 
> Brian Broker wrote:
> > 
> > Al Getz wrote:
> > > 
> > > Alex Chamberlain wrote:
> > > > 
> > > > Al Getz wrote:
> > > > > 
> > > > > Alex Chamberlain wrote:
> > > > > > 
> > > > > > Hi,
> > > > > > 
> > > > > > Can anyone help me by providing a function to tell me the resolution
> > > > > > of
> > a JPEG</font></i>
> > > > > > File?
> > > > > > 
> > > > > > I'm using GD at the moment.
> > > > > > 
> > > > > > Thanks,
> > > > > > 
> > > > > > Alex
> > > > > 
> > > > > Hi there,
> > > > > 
> > > > > 
> > > > > Are you talking about the DPI (dots per inch) ?
> > > > > 
> > > > > 
> > > > > Al
> > > > 
> > > > Yeah!
> > > 
> > > 
> > > Hi again Alex,
> > > 
> > > 
> > > Sorry, i have an inch thick stack of notes on the jpg file format
> > > and i cant seem to find anything on the dpi of the file.  It's 
> > > been so long now since i've worked with this i dont remember how
> > > to find or calculate this.  Maybe ask again or on another
> > > forum?
> > > 
> > > 
> > > Al
> > > 
> > > 
> > > My bumper sticker: "I brake for LED's"
> > 
> > Correct me if I'm wrong but isn't DPI a measurement of an output device?
> > 
> > How big is a pixel?
> > <a
> > href="http://heim.ifi.uio.no/~gisle/photo/pixels.html">http://heim.ifi.uio.no/~gisle/photo/pixels.html</a>
> > 
> > -- Brian
> 
> Hi Brian,
> 
> 
> What i was assuming was that he was after something like the bitmap
> file header contains: PelsPerMeter for Vertical and Horizontal,
> but couldnt find anything that had a unit of length in it.
> It's possible to calculate (for jpg) but i cant seem to find the doc's on it.
> I think it's because when i was doing my jpg decoder i had no use
> for the resolution data because most of the time there's only one picture
> to choose from and one monitor to choose from.
> I think the last time i worked on my .jpg decoder (in the archives) was
> around 1999 or so.
> 
> 
> Al
> 
> 
> My bumper sticker: "I brake for LED's"

But I wonder how many apps actually use "PelsPerMeter"?  There seem to be few
explanations of what this info is for.  I did find this:

"The PelsPerMeter fields doesn't seem to be particularly important, is often
just set to zero, and is supposed to describe how many pixels are to be displayed
in one meter of space (in case anyone has a monitor a meter wide). This seems to
relate to how the bitmap was intended to be displayed and viewed."

To me, that seems to imply that a viewer app using this information would have
to stretch and/or compress an image to make it fit an intended area.  But still I
wonder how many image viewers or printer drivers actually do this?

-- Brian

new topic     » goto parent     » topic index » view message » categorize

8. Re: JPEG Resolution

Hi

Doesn't a graphic file, any graphic, just have a dimension, eg 320 * 240 pixels,
loaded into memory from whatever format, manipulated, then output to whatever
format?

Chris

http://members.aol.com/chriscrylex/euphoria.htm
http://uboard.proboards32.com/
http://members.aol.com/chriscrylex/EUSQLite/eusql.html

new topic     » goto parent     » topic index » view message » categorize

9. Re: JPEG Resolution

Chris Burch wrote:
> 
> Hi
> 
> Doesn't a graphic file, any graphic, just have a dimension, eg 320 * 240
> pixels,
> loaded into memory from whatever format, manipulated, then output to whatever
> format?
> 
> Chris
> 
> <a
> href="http://members.aol.com/chriscrylex/euphoria.htm">http://members.aol.com/chriscrylex/euphoria.htm</a>
> <a href="http://uboard.proboards32.com/">http://uboard.proboards32.com/</a>
> <a
> href="http://members.aol.com/chriscrylex/EUSQLite/eusql.html">http://members.aol.com/chriscrylex/EUSQLite/eusql.html</a>

Well, that's what I thought but here's some more info that I found interesting. 
Apparently the jpeg format does have a DPI setting that apps might use.

http://www.rdpslides.com/pptfaq/FAQ00075.htm

-- Brian

new topic     » goto parent     » topic index » view message » categorize

10. Re: JPEG Resolution

Hello Chris and Brian,

None of my apps ever used PelsPerMeter because as i was saying before
i usually only have one pic to display and one monitor.
The PPM could be used to convert to DPI and that would allow you
to select between a two of pictures which are both the same but 
with different dpi...you could select the picture that was closest
to the dpi of the monitor (i guess).
For example, say you have these two pics:
  pic1A.bmp
  pic1B.bmp

and pic1A had 96 dpi and pic1B and 180 dpi, and the display was
96 dpi, i guess you would select the 96 dpi one.  I myself have
never had the need to do this so i never use the dpi, and whenever
i create a new bitmap file i load the pelspermeter params both with zero.
I guess if you load with some dpi value you might control how the
picture is supposed to be displayed if the viewer uses this data.

The viewer that comes with WinXP seems to get and display the dpi of
a jpg file when you look at the properties, but i dont see how it 
actually uses this info to display the picture itself because the
picture comes up in whatever size window you have set for the viewer
anyway if the pic is larger and smaller than the viewer area if the
pic is smaller.
I noticed also that when creating bitmaps the dpi values (i guess
pelspermeter is calculated from the dpi of the current display and
the number of dots up and down) are set in some painting programs
so the file properties shows a dpi value for both H and V.



Take care,
Al

And, good luck with your Euphoria programming!

My bumper sticker: "I brake for LED's"

new topic     » goto parent     » topic index » view message » categorize

11. Re: JPEG Resolution

Brian Broker wrote:
> Correct me if I'm wrong but isn't DPI a measurement of an output device?
> 
> How big is a pixel?
> <a
> href="http://heim.ifi.uio.no/~gisle/photo/pixels.html">http://heim.ifi.uio.no/~gisle/photo/pixels.html</a>
> 
> -- Brian

DPI means dots per inch, and just measures how many pixels there are in one
cubic inch of the screen.  So when it's 64 by 64 DPI, that means that an inch of
the picture is 64 pixels long and 64 pixels wide.

Jeremy

Edmund Burke: "All that is necessary for evil to triumph is for good men to do
nothing."

new topic     » goto parent     » topic index » view message » categorize

12. Re: JPEG Resolution

Jeremy Peterson wrote:
> 
> Brian Broker wrote:
> > Correct me if I'm wrong but isn't DPI a measurement of an output device?
> > 
> > How big is a pixel?
> > <a
> > href="http://heim.ifi.uio.no/~gisle/photo/pixels.html">http://heim.ifi.uio.no/~gisle/photo/pixels.html</a>
> > 
> > -- Brian
> 
> DPI means dots per inch, and just measures how many pixels there are in one
> cubic inch of the screen.  So when it's 64 by 64 DPI, that means that an inch
> of the picture is 64 pixels long and 64 pixels wide.
> 
> Jeremy
> 
> Edmund Burke: "All that is necessary for evil to triumph is for good men to
> do nothing."


Does that mean an image on a 21" monitor has a larger DPI than a 14" monitor,
or are the pixels 1.5 times larger on a 21" monitor?

new topic     » goto parent     » topic index » view message » categorize

13. Re: JPEG Resolution

It depends on what resolution you set it at.  If they both have the same
resolution, it would be the latter.

Jeremy

new topic     » goto parent     » topic index » view message » categorize

14. Re: JPEG Resolution

Jeremy Peterson wrote:
> 
> DPI means dots per inch, and just measures how many pixels there are in one
> cubic inch of the screen.
.....
> It depends on what resolution you set it at.  If they both have the same
> resolution,
> it would be the latter.
> 
> Jeremy



If you have a 64x64 DPI image and a 14" monitor set to 800x600 and a 21" 
monitor set to 800x600, then by your first post, both monitors show the image
with identical dimensions (1 *square* inch), but how can that be if the pixels
are larger on the 21" monitor?

new topic     » goto parent     » topic index » view message » categorize

15. Re: JPEG Resolution

On 3/15/06, Evan Marshall <guest at rapideuphoria.com> wrote:
> If you have a 64x64 DPI image and a 14" monitor set to 800x600 and a 21"
> monitor set to 800x600, then by your first post, both monitors show the i=
mage
> with identical dimensions (1 *square* inch), but how can that be if the p=
ixels
> are larger on the 21" monitor?

monitor dimensions * DPI = resolution

Thus, a 64x64 DPI image of a given resolution will take up a certain
amount of screen real-estate... often DPI is ignored for a monitor's
display, as DPI is fixed to the screen's resolution.

--
MrTrick
----------

new topic     » goto parent     » topic index » view message » categorize

16. Re: JPEG Resolution

Evan Marshall wrote:
> 
> Jeremy Peterson wrote:
> > 
> > DPI means dots per inch, and just measures how many pixels there are in one
> > cubic inch of the screen.
> .....
> > It depends on what resolution you set it at.  If they both have the same
> > resolution,
> > it would be the latter.
> > 
> > Jeremy
> 
> 
> If you have a 64x64 DPI image and a 14" monitor set to 800x600 and a 21" 
> monitor set to 800x600, then by your first post, both monitors show the image
> with identical dimensions (1 *square* inch), but how can that be if the pixels
> are larger on the 21" monitor?

Hi there,


By knowing the dpi of the pic and the dpi of the monitors i think
it's possible to display the picture making it appear the same size
(approximately) on both monitors...thus a pic that was originally
sized at 1 inch by 1 inch would show up on BOTH monitors as
1 inch by inch...but who does this?  Most viewers try to display
the pic as large as possible i think so that they map each sample
of the pic to each pixel of the display.
Examples of where the dpi would be more important would probably
be in medical or industrial applications, where you may want each
(dentistry, say) tooth to show up as real size regardless of what
size monitor the Dr. (dentist) is using.

If you want buttons to display the same size on different monitors
you may wish to draw them using the dpi of the display as one of
the params too.  If you want the button 1 inch wide on a 96 dpi
monitor i guess you'd need 96 pixels across, while on a 180 dpi
monitor you'd need 180 pixels across, so the width param in these
two cases would be either 96 or 180.

I did some calculations just for the heck of it but im in a hurry
right now...i'll try to post later today.


Take care,
Al

And, good luck with your Euphoria programming!

My bumper sticker: "I brake for LED's"

new topic     » goto parent     » topic index » view message » categorize

17. Re: JPEG Resolution

Hi,

I was only really interested in DPI, as for a decent photo print you need at
least 300dpi.

Alex

new topic     » goto parent     » topic index » view message » categorize

18. Re: JPEG Resolution

Al Getz wrote:
> 
> By knowing the dpi of the pic and the dpi of the monitors i think
> it's possible to display the picture making it appear the same size
> (approximately) on both monitors...thus a pic that was originally
> sized at 1 inch by 1 inch would show up on BOTH monitors as
> 1 inch by inch...but who does this?  Most viewers try to display
> the pic as large as possible i think so that they map each sample
> of the pic to each pixel of the display.
> Examples of where the dpi would be more important would probably
> be in medical or industrial applications, where you may want each
> (dentistry, say) tooth to show up as real size regardless of what
> size monitor the Dr. (dentist) is using.
> 
> If you want buttons to display the same size on different monitors
> you may wish to draw them using the dpi of the display as one of
> the params too.  If you want the button 1 inch wide on a 96 dpi
> monitor i guess you'd need 96 pixels across, while on a 180 dpi
> monitor you'd need 180 pixels across, so the width param in these
> two cases would be either 96 or 180.
> 
> I did some calculations just for the heck of it but im in a hurry
> right now...i'll try to post later today.
 
 
Al:

   There is another thing you have to take into account.

   Two montors can be 19 inch montors which is the physical distance
   measured diagonally across the corners.

   But these monitors can have different dots per inch which is
   the physical distance between the three dot (RGB) clusters that
   which represent one pixel. So how could a program be written
   to be sure that a picture would be always the exact same size.
   The only answer would be to have a program that could be calibrated
   by the end user with a ruler.
 

Bernie

My files in archive:
WMOTOR, XMOTOR, W32ENGIN, MIXEDLIB, EU_ENGIN, WIN32ERU, WIN32API 

Can be downloaded here:
http://www.rapideuphoria.com/cgi-bin/asearch.exu?dos=on&win=on&lnx=on&gen=on&keywords=bernie+ryan

new topic     » goto parent     » topic index » view message » categorize

19. Re: JPEG Resolution

Al Getz wrote:
> 
> If you want buttons to display the same size on different monitors
> you may wish to draw them using the dpi of the display as one of
> the params too.  If you want the button 1 inch wide on a 96 dpi
> monitor i guess you'd need 96 pixels across, while on a 180 dpi
> monitor you'd need 180 pixels across, so the width param in these
> two cases would be either 96 or 180.

On the subject of correcly sizing for different resolutions, its not so much
wanting buttons to be the same size its more that the same font will be larger at
higher resolutions. This can mean that any text may be too large for its control.
As I wanted my apps to look good regardless of the users resolution setting I
came up with the following code.

without warning
without trace
include win32lib.ew

global constant
  -- for correct window centering on screen (UK spelling of 'centre'!)
 Centre   = "Centre"  
 
constant 
    xPARAMS = 1,
    yPARAMS = 2,
    cxPARAMS = 3,
    cyPARAMS = 4,
    X = 1,
    Y = 2

atom dc
atom cxDpi, cyDpi

dc = getDC ( Screen )
cxDpi=(w32Func(xGetDeviceCaps,{dc,LOGPIXELSX})/96)
cyDpi=(w32Func(xGetDeviceCaps,{dc,LOGPIXELSY})/96)
releaseDC(Screen)

integer centerScreenX, centerScreenY
sequence ScreenSize
ScreenSize = getRect(Screen)
centerScreenX = floor( ScreenSize[3]/2 )
centerScreenY = floor( ScreenSize[4]/2 )

function DI(integer Orientation, object pixels)
    if Orientation = X then
        return floor(pixels * cxDpi)
    elsif Orientation = Y then
        return floor(pixels * cyDpi)
    end if
    end function

global function dpiCreateEx(integer pControl, sequence caption, atom pOwner,
object x, object y, object cx, object cy, object styleFlags, object
            exFlags )
sequence params
sequence IgnoreControls -- controls not needing DPI change
params = {x, y, cx, cy}

IgnoreControls = {Menu, MenuItem}

    if not find(pControl, IgnoreControls) then 
-- if control is a Window then leave position stuff alone
        if pControl != Window then  
       -- chk for relational positioning i.e. ix X < 1 then 
       -- x position must be a 0.x (%) value so leave alone
          if integer(x) and x > 1 then 
            params[xPARAMS] = DI(X, x)
-- also handle w32lib constant calls like 'Center' and {w32AltEdge. -20} 
          elsif sequence(x) and atom(x[2]) and length(x) = 2 then
            params[xPARAMS] = x
            params[xPARAMS][2] = DI(X, x[2])
          end if  
          if integer(y) and y > 1 then 
            params[yPARAMS] = DI(Y, y) 
          elsif sequence(y) and atom(y[2]) and length(y) = 2 then
            params[yPARAMS] = y
            params[yPARAMS][2] = DI(Y, y[2])
          end if
        end if

        if integer(cx) and cx > 1 then 
            params[cxPARAMS] = DI(X, cx) 
        elsif sequence(cx) and atom(cx[2]) and length(cx) = 2 then
            params[cxPARAMS] = cx
            params[cxPARAMS][2] = DI(X, cx[2])
        end if
        if pControl != SortedCombo then         
          if integer(cy) and cy > 1 then 
            params[cyPARAMS] = DI(Y, cy) 
          elsif sequence(cy) and atom(cy[2]) and length(cy) = 2 then
            params[cyPARAMS] = cy
            params[cyPARAMS][2] = DI(Y, cy[2])      
          end if
        else
          params[cyPARAMS] = cy 
        end if
    end if
    
    if pControl = Window then   
-- if control is a 'centered' Window then correctly center it!
if equal(x, Centre) then params[xPARAMS] = centerScreenX - floor(
      params[cxPARAMS]/2 )
       end if
if equal(y, Centre) then params[yPARAMS] = centerScreenY - floor(
      params[cyPARAMS]/2 )
      end if
    end if
        
return createEx( pControl, caption, pOwner, params[xPARAMS],  
   params[yPARAMS],params[cxPARAMS], params[cyPARAMS], styleFlags, exFlags)

    end function

global function dpiCreate(integer pControl, sequence caption, atom pOwner,
            object x, object y, object cx, object cy, object styleFlags )
        
 return dpiCreateEx( pControl, caption, pOwner, x, y, cx, cy, styleFlags, 0)
         
  end function


As you may notice its had a few tweaks to fix issues like Win32lib not centering
a 'sub' window correctly to the screen etc..
Since I do all my programing on a 96dpi screen I code it as normal but call
dpiCreate instead of the normal win32lib 'create', if I then check on a screen
set to 120dpi it still looks good (I even tried a custom setting of 150dpi and it
still looked good).
Once I'm certain that I cope correctly with most types of controls then I'll add
it to the archive.

PeteS

new topic     » goto parent     » topic index » view message » categorize

20. Re: JPEG Resolution

Pete Stoner wrote:
> 
> Al Getz wrote:
> > 
> > If you want buttons to display the same size on different monitors
> > you may wish to draw them using the dpi of the display as one of
> > the params too.  If you want the button 1 inch wide on a 96 dpi
> > monitor i guess you'd need 96 pixels across, while on a 180 dpi
> > monitor you'd need 180 pixels across, so the width param in these
> > two cases would be either 96 or 180.
> 
> On the subject of correcly sizing for different resolutions, its not so much
> wanting buttons to be the same size its more that the same font will be larger
> at higher resolutions. This can mean that any text may be too large for its
> control. As I wanted my apps to look good regardless of the users resolution
> setting I came up with the following code.
> 
> }}}
<eucode>
> without warning
> without trace
> include win32lib.ew
> 
> global constant
>   -- for correct window centering on screen (UK spelling of 'centre'!)
>  Centre   = "Centre"  
>  
> constant 
>     xPARAMS = 1,
>     yPARAMS = 2,
>     cxPARAMS = 3,
>     cyPARAMS = 4,
>     X = 1,
>     Y = 2
> 
> atom dc
> atom cxDpi, cyDpi
> 
> dc = getDC ( Screen )
> cxDpi=(w32Func(xGetDeviceCaps,{dc,LOGPIXELSX})/96)
> cyDpi=(w32Func(xGetDeviceCaps,{dc,LOGPIXELSY})/96)
> releaseDC(Screen)
> 
> integer centerScreenX, centerScreenY
> sequence ScreenSize
> ScreenSize = getRect(Screen)
> centerScreenX = floor( ScreenSize[3]/2 )
> centerScreenY = floor( ScreenSize[4]/2 )
> 
> function DI(integer Orientation, object pixels)
>     if Orientation = X then
>         return floor(pixels * cxDpi)
>     elsif Orientation = Y then
>         return floor(pixels * cyDpi)
>     end if
>     end function
> 
> global function dpiCreateEx(integer pControl, sequence caption, atom pOwner,
>             object x, object y, object cx, object cy, object styleFlags,
>             object exFlags
> )           
> sequence params
> sequence IgnoreControls -- controls not needing DPI change
> params = {x, y, cx, cy}
> 
> IgnoreControls = {Menu, MenuItem}
> 
>     if not find(pControl, IgnoreControls) then 
>        -- if control is a Window then leave position stuff alone              
>
>         if pControl != Window then  
>        -- chk for relational positioning i.e. ix X < 1 then 
>        -- x position must be a 0.x (%) value so leave alone
>           if integer(x) and x > 1 then 
>             params[xPARAMS] = DI(X, x)
> -- also handle w32lib constant calls like 'Center' and {w32AltEdge. -20} 
>           elsif sequence(x) and atom(x[2]) and length(x) = 2 then
>             params[xPARAMS] = x
>             params[xPARAMS][2] = DI(X, x[2])
>           end if  
>           if integer(y) and y > 1 then 
>             params[yPARAMS] = DI(Y, y) 
>           elsif sequence(y) and atom(y[2]) and length(y) = 2 then
>             params[yPARAMS] = y
>             params[yPARAMS][2] = DI(Y, y[2])
>           end if
>         end if
> 
>         if integer(cx) and cx > 1 then 
>             params[cxPARAMS] = DI(X, cx) 
>         elsif sequence(cx) and atom(cx[2]) and length(cx) = 2 then
>             params[cxPARAMS] = cx
>             params[cxPARAMS][2] = DI(X, cx[2])
>         end if
>         if pControl != SortedCombo then         
>           if integer(cy) and cy > 1 then 
>             params[cyPARAMS] = DI(Y, cy) 
>           elsif sequence(cy) and atom(cy[2]) and length(cy) = 2 then
>             params[cyPARAMS] = cy
>             params[cyPARAMS][2] = DI(Y, cy[2])      
>           end if
>         else
>           params[cyPARAMS] = cy 
>         end if
>     end if
>     
>     if pControl = Window then   
> -- if control is a 'centered' Window then correctly center it!
>       if equal(x, Centre) then params[xPARAMS] = centerScreenX - floor(
>       params[cxPARAMS]/2
> ) 
>        end if
>       if equal(y, Centre) then params[yPARAMS] = centerScreenY - floor(
>       params[cyPARAMS]/2
> ) 
>       end if
>     end if
>         
>    return createEx( pControl, caption, pOwner, params[xPARAMS],  
>    params[yPARAMS],params[cxPARAMS],
> params[cyPARAMS], styleFlags, exFlags)
> 
>     end function
> 
> global function dpiCreate(integer pControl, sequence caption, atom pOwner,
>             object x, object y, object cx, object cy, object styleFlags )
>         
<snip>

Hi PeteS,


I was thinking that i would want my apps to have buttons (maybe other 
stuff too) the same size on any monitor, as well as the text size.
The reason is, what good is larger text if it doesnt fit inside
the button?
Any ideas?

How about a trick to get the actual size (in inches) of the monitor
H and V ?


Take care,
Al

And, good luck with your Euphoria programming!

My bumper sticker: "I brake for LED's"

 From "Black Knight":
"I can live with fighting the good fight,
 but i can not live without fighting it".

new topic     » goto parent     » topic index » view message » categorize

21. Re: JPEG Resolution

Al Getz wrote:
> 
> Pete Stoner wrote:
> > 
> > Al Getz wrote:
> > > 
> > > If you want buttons to display the same size on different monitors
> > > you may wish to draw them using the dpi of the display as one of
> > > the params too.  If you want the button 1 inch wide on a 96 dpi
> > > monitor i guess you'd need 96 pixels across, while on a 180 dpi
> > > monitor you'd need 180 pixels across, so the width param in these
> > > two cases would be either 96 or 180.
> > 
> > On the subject of correcly sizing for different resolutions, its not so much
> > wanting buttons to be the same size its more that the same font will be
> > larger
> > at higher resolutions. This can mean that any text may be too large for its
> > control. As I wanted my apps to look good regardless of the users resolution
> > setting I came up with the following code.
<snip>
> 
> Hi PeteS,
> 
> 
> I was thinking that i would want my apps to have buttons (maybe other 
> stuff too) the same size on any monitor, as well as the text size.
> The reason is, what good is larger text if it doesnt fit inside
> the button?
> Any ideas?
> 
> How about a trick to get the actual size (in inches) of the monitor
> H and V ?
> 
> 
> Al
> 

Hi Al, 
I'm not sure you can have the button always the exact same size and if you did
there seems to be no way to avoid the font being increased in size. Just to
further complicate things I did see somewhere a mention that the 'pixels per
inch' stuff was sometimes talking about a *virtual* inch!!
As the fonts are larger at a higher res what the code I posted does (or best
attempt at!) is resize/reposition all the controls to match that increase
including the window size itself, otherwise your buttons get bigger and may
overlap an adjacent one or be clipped by their window.

I did lots of googling on this and it generally seems to be a mess and could not
find any one recommended way to handle it.. It seemed using Dialog units in place
of pixels was the way to go at one stage, but then I found that doesn't work very
well. My current method seems the best so far..

PeteS

new topic     » goto parent     » topic index » view message » categorize

22. Re: JPEG Resolution

Evan Marshall wrote:
> 
> Jeremy Peterson wrote:
> > 
> > DPI means dots per inch, and just measures how many pixels there are in one
> > cubic inch of the screen.
> .....
> > It depends on what resolution you set it at.  If they both have the same
> > resolution,
> > it would be the latter.
> > 
> > Jeremy
> 
> 
> If you have a 64x64 DPI image and a 14" monitor set to 800x600 and a 21" 
> monitor set to 800x600, then by your first post, both monitors show the image
> with identical dimensions (1 *square* inch), but how can that be if the pixels
> are larger on the 21" monitor?
The pixels do not get bigger.  That previous post was a mistake.  It would show
the image the same size on both monitors, but there would be more room on the 21"
to display something else.

Jeremy

new topic     » goto parent     » topic index » view message » categorize

Search



Quick Links

User menu

Not signed in.

Misc Menu