PNG cursor and x,y hotspot

View: New views
5 Messages — Rating Filter:   Alert me  

PNG cursor and x,y hotspot

by Eljay Love-Jensen :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Hi everyone,

I am using PNG to hold images to be used as cursors.

Is there an appropriate public chunk or extension chunk wherein the
x,y hotspot of the cursor is specified?

It appears that 'oFFs' could be used/misused/abused that way -- but
the semantics of 'oFFs' isn't quite right (hence the misused/abused).

In the interim, I'm storing the x,y hotspot information in a sidecar
XML file.  The interim solution is acceptable to me as the production
solution.

Thanks,
--Eljay

-------------------------------------------------------------------------
This SF.Net email is sponsored by the Moblin Your Move Developer's challenge
Build the coolest Linux based applications with Moblin SDK & win great prizes
Grand prize is a trip for two to an Open Source event anywhere in the world
http://moblin-contest.org/redirect.php?banner_id=100&url=/
_______________________________________________
png-mng-misc mailing list
png-mng-misc@...
https://lists.sourceforge.net/lists/listinfo/png-mng-misc

Re: PNG cursor and x,y hotspot

by Glenn Randers-Pehrson :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

On Tue, Dec 2, 2008 at 12:49 PM, Eljay Love-Jensen <eljay451@...> wrote:

> Hi everyone,
>
> I am using PNG to hold images to be used as cursors.
>
> Is there an appropriate public chunk or extension chunk wherein the
> x,y hotspot of the cursor is specified?
>
> It appears that 'oFFs' could be used/misused/abused that way -- but
> the semantics of 'oFFs' isn't quite right (hence the misused/abused).
>
> In the interim, I'm storing the x,y hotspot information in a sidecar
> XML file.  The interim solution is acceptable to me as the production
> solution.

I would not recommend using oFFs for this purpose.

We proposed a chunk, maybe 10 or 11 years ago, in which a
baseline could be defined.  Either that or some revision of it
could be used.

What is the nature of "hotspot information"?  I'm guessing

     number of hotspots
     unit
     x[0]
     y[0]
     radius[0]
     action number[0]
     x[1]
     etc

Glenn

-------------------------------------------------------------------------
This SF.Net email is sponsored by the Moblin Your Move Developer's challenge
Build the coolest Linux based applications with Moblin SDK & win great prizes
Grand prize is a trip for two to an Open Source event anywhere in the world
http://moblin-contest.org/redirect.php?banner_id=100&url=/
_______________________________________________
png-mng-misc mailing list
png-mng-misc@...
https://lists.sourceforge.net/lists/listinfo/png-mng-misc

Re: PNG cursor and x,y hotspot

by John Bowler :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

From: Eljay Love-Jensen [mailto:eljay451@...]
>Is there an appropriate public chunk or extension chunk wherein the
>x,y hotspot of the cursor is specified?
>
>It appears that 'oFFs' could be used/misused/abused that way -- but
>the semantics of 'oFFs' isn't quite right (hence the misused/abused).

IMO the definition of oFFs is weird - back to front (it's a coordinate
within an underspecified container, not a coordinate within the image) and
ill defined (the definition of the coordinate space is basically absent as a
result of ambiguity.)

Still, you could use a negative x and y to indicate the anchor point of the
cursor offset from the image top left...

>In the interim, I'm storing the x,y hotspot information in a sidecar
>XML file.  The interim solution is acceptable to me as the production
>solution.

Much better IMO is to invent your own private chunk or (second best) use
tEXt keywords.  You can do either of these in whatever way you like, just so
long as you obey the chunk naming conventions by making the second letter of
your 4 character chunk name lower case or obey the keyword naming
conventions by not reusing an existing registered keyword (unlikely.)

Indeed, you could put the whole XML sidecar in a keyword - perhaps not the
best solution, but certainly permitted.

To use a private chunk (e.g. cuRS) it is safest, though not an absolute
requirement, to include some identifiable signature at the start of the
chunk.  After that simply define the values you require in some appropriate
way - e.g:

        4 bytes: 16 Length
        4 bytes: cuRS Chunk type (name)
        8 bytes: cursor00 signature
        4 bytes: [x] 32 bit integer x hotspot within
image
                                        Offset from left column
        4 bytes: [y] 32 bit integer y hotspot within
image
                                        Offset from top row
        4 bytes: [CRC] 32 bit CRC

Then write code for a private chunk handler that can be used from libpng.

This is an entirely appropriate use for a private chunk - it's probably a
rare thing to need in a PNG image and it's obviously very application
specific (i.e. even if an image contains a cuRS chunk very few apps will
need to read it.)

If you publish the spec and the chunk handler code then it may well gain
wide spread use among those applications that need it.

John Bowler <jbowler@...>



-------------------------------------------------------------------------
This SF.Net email is sponsored by the Moblin Your Move Developer's challenge
Build the coolest Linux based applications with Moblin SDK & win great prizes
Grand prize is a trip for two to an Open Source event anywhere in the world
http://moblin-contest.org/redirect.php?banner_id=100&url=/
_______________________________________________
png-mng-misc mailing list
png-mng-misc@...
https://lists.sourceforge.net/lists/listinfo/png-mng-misc

Parent Message unknown Re: PNG cursor and x,y hotspot

by glennrp-2 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message


 -------------- Original message ----------------------
From: "John Bowler" <jbowler@...>

>
> IMO the definition of oFFs is weird - back to front (it's a coordinate
> within an underspecified container, not a coordinate within the image) and
> ill defined (the definition of the coordinate space is basically absent as a
> result of ambiguity.)
>

oFFs works fine for us in ImageMagick.  We use it exactly the same as
the offsets in a GIF multi-image file, as offsets from the "main" window.

When decomposing an ani-GIF we store the individual offsets as
oFFs chunks, and then use those when we want to reassemble
the animation.

Glenn

-------------------------------------------------------------------------
This SF.Net email is sponsored by the Moblin Your Move Developer's challenge
Build the coolest Linux based applications with Moblin SDK & win great prizes
Grand prize is a trip for two to an Open Source event anywhere in the world
http://moblin-contest.org/redirect.php?banner_id=100&url=/
_______________________________________________
png-mng-misc mailing list
png-mng-misc@...
https://lists.sourceforge.net/lists/listinfo/png-mng-misc

Re: PNG cursor and x,y hotspot

by John Bowler :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

From: glennrp@... [mailto:glennrp@...]
>oFFs works fine for us in ImageMagick.  We use it exactly the same as
>the offsets in a GIF multi-image file, as offsets from the "main" window.

It works for a cursor too - the only sensible interpretation is that it is
the displacement of the PNG image to align the hot spot of the cursor.

The problem is that the interpretation is context sensitive and it only
works in precisely those cases enumerated in the spec.  For example, how
should it be interpreted when a PNG image containing oFFs is embedded in an
HTML/CSS page?

John Bowler <jbowler@...>



-------------------------------------------------------------------------
This SF.Net email is sponsored by the Moblin Your Move Developer's challenge
Build the coolest Linux based applications with Moblin SDK & win great prizes
Grand prize is a trip for two to an Open Source event anywhere in the world
http://moblin-contest.org/redirect.php?banner_id=100&url=/
_______________________________________________
png-mng-misc mailing list
png-mng-misc@...
https://lists.sourceforge.net/lists/listinfo/png-mng-misc