Page 1 of 1

Scaling and Loading Image with hpwImage Control

PostPosted: Sun Jul 29, 2012 12:34 pm
by LauraMarie
I am atempting to load and scale an image to a rectange object.
After attaching the picture I would like to zoom image from inside the rectange. No image seems to attach but no errors are occuring. :(

Code: Select all
hpwImageCreate "importFrame" "" "" "" "" "" "" ""
GetObjectHandle "importFrame" "[FrameHandle]"
hpwGetObjRect "[FrameHandle]" "[X1]" "[Y1]" "[X2]" "[Y2]"
hpwImageScaleFromFile "importFrame" "[selectedFile]" "[X1]" "[Y1]" "[X2]" "[Y2]" "0" ""

What am I doing wrong?

PostPosted: Sun Jul 29, 2012 1:42 pm
by HPW
hpwImageScaleFromFile "importFrame" "[selectedFile]" "[X1]" "[Y1]" "[X2]" "[Y2]" "0" ""

Not sure if I understand it right.
hpwImageScaleFromFiles coordinates are relative to the created image.
So x=0 and y=0 will load the image to the top left corner.
The both other coordinates are the bottom right corner of the target area.

hpwGetObjRect gets screen coordinates.
So I do not get the idea why it is used in this context.


PostPosted: Sun Jul 29, 2012 2:08 pm
by LauraMarie
I thought that the image must be loaded into a host object (rectangle)?
I was getting the X and Y position to resize the image to the size of the rectangle.

I am looking to just resize an image from X to a specifed size.

So how is that done with your plugin?

PostPosted: Sun Jul 29, 2012 10:02 pm
by HPW
Take a look at the sample pub.
The four coordinates set the target area and scaling happens during loading it into that area.