Legacy GM screen_save_part() Saving random width and heights

Zechevalier

Member
When using screen_save_part() the outcome has a smaller width and height than the size i wanted.

this is what my code looks like

Code:
var_x_save = (obj_Leo.x-view_xview)*global.var_screen_xscale+global.var_surface_x-(var_pic_w*0.3)
var_y_save = (obj_Leo.y-view_yview)*global.var_screen_yscale+global.var_surface_y-(var_pic_h/2.5)

var_pic_w = 936
var_pic_h = 594

screen_save_part(string(var_pic_name), var_x_save, var_y_save, var_pic_w, var_pic_h)
If I change my code to just take the screenshot from (0,0) then the size is consistent, but if I have it take the screenshot from the position i want, then the sizes come out inconsistent and seemingly random.


in this picture I set the coordinates to (0,0) and the image dimensions came out correct (936x594)

But as you can see:

As soon as i change the coordinates to take from where I want it, it shrinks the image to 560x352

I've been fiddling with this for almost 2 hours now, Does anyone know what's going on?
 

Zechevalier

Member
So after i got the chance to mess with it some more I discovered that screen_save_part() seems to be treating the (w,h) arguments as (x2,y2).

So while the documentation says "screen_save_part(fname, x, y, w, h)"

it's acting as if it said "screen_save_part(fname, x, y, x2, y2)"

Where as the 4th and 5th arguments are the coordinates for the bottom/right corner of the screen shot rather than the width and height of the screenshot.


now if I change my code from this:
Code:
screen_save_part(string(var_pic_name), var_x_save, var_y_save, var_pic_w, var_pic_h)
to this:
Code:
screen_save_part(string(var_pic_name), var_x_save, var_y_save, var_x_save+var_pic_w, var_y_save+var_pic_h)
then it seems to work the way i want it to, and the resulting screenshot has a width of var_pic_w and a height of var_pic_h. But i'll bet that if i leave my code like that, it is going to cause problems in the future.

Could someone at-least try and recreate this and see if it behaves the same for you?
 
Top