Scaling Image on PtLabel

scaling Image on PtLabel during runtime

Hello folks,
im trying to scale an Image on a PtLabel, using Pt_TEXT_IMAGE as Label-type.
The trouble is it just SIGSEGV´s.

PhImage_t *myImage;

myImage = (PhImage_t *) myLabel->data;
myImage->xscale = 10;
myImage->yscale = 1;

Thats all i do and it just SIGSEGV´s all the time. The thing i wonder about is, is in myLabel->data really an PhImage Structure?? its said to have 256 height and 0 width, but should be 23 height and 1 width …

Thx for help

So, i took some time into debugging,
as far as i can tell now:

The void *data structure in PtLabelWidget_t does NOT contain a full PhImage_t structure.
Hence there will be no scaling at all i think (what would be really bad for me :>)

Anybody know of a possibility to scale an Image on an PtLabel depending on the stringlength?
Planned is a 1px wide image to be scaled to myLabel->area->size.w ==> Image is scaled over full Label


I’m out of town so I can’t check this, but my recollection is that PtLabel Widgets have two sources of display, a graphic image, which probably is scalable, and text data. The text data you can probably only scale by adjusting the font size. I don’t ever recall trying to read the graphic image, but that should be possible. Of course since you should have the original image somewhere, you should be able to go back to it, scale it, and then apply it to the label.

since there is in QNX4.25 no real way to scale or redraw in Memory and flush to Image (works with Bitmaps, but images are crapped after) i just made the image by myself scaling :stuck_out_tongue_winking_eye:

just copy the complete PhImage_t into the new image-structure, allocate a new Palette and Image buffer (image->palette image->image)
Allocation with PgShmemCreate for having PhRealeaseImage() work.
Check for colors and copy the palette: memcpy(newpal, oldpal, image->colors * sizeof(PgColor_t));
use PgSetPalette to activate your new created palette.
Then start playing on your allocated image buffer til you suceed :slight_smile:

For my needs, it was enough to just draw the image label->area->size.w times into the buffer, since my Image was just 1 px width :slight_smile:

Have fun