Misc programming questions

Hello,
I’ve got a few misc questions…

  1. I’ve been applying some images to buttons, using the same image each
    time, but while destroying one button does not raise an error,
    destroying another causes a segfault. I guess the PtButton is freeing up
    parts of the image that are in use by other PtButtons, is it possible to
    tell a PtButton to leave the image on being destroyed or should I
    duplicate the image, and pass the copy to the PtButton?

  2. Image scaling, rather than use something like ImageMagick, whats the
    recommended way to scale images in a nice way in Photon, with
    anti-aliasing, and in a way which is safe to use with alpha-blended
    PNGs? I’d like to be able to do it a good fast way so it can be done
    ‘live’ on a PtButton if possible.

  3. Callbacks, am I missing something or are there not callbacks for
    using the right or middle mouse button, double click, etc? If not, how
    does one make callbacks for this kind of thing?

Any help much appreciated.

Garry

  1. In the struct PhImage_t, if you set its member “flags” to 0 (default
    value), a call to PhReleaseImage() doesn’t free the image.



    Garry wrote:

Hello,
I’ve got a few misc questions…

  1. I’ve been applying some images to buttons, using the same image each
    time, but while destroying one button does not raise an error,
    destroying another causes a segfault. I guess the PtButton is freeing up
    parts of the image that are in use by other PtButtons, is it possible to
    tell a PtButton to leave the image on being destroyed or should I
    duplicate the image, and pass the copy to the PtButton?

  2. Image scaling, rather than use something like ImageMagick, whats the
    recommended way to scale images in a nice way in Photon, with
    anti-aliasing, and in a way which is safe to use with alpha-blended
    PNGs? I’d like to be able to do it a good fast way so it can be done
    ‘live’ on a PtButton if possible.

  3. Callbacks, am I missing something or are there not callbacks for
    using the right or middle mouse button, double click, etc? If not, how
    does one make callbacks for this kind of thing?

Any help much appreciated.

Garry