stretch_blit
julian_boolean

Could someone explain what each of the parameters are suppose to represent? Or maybe use it in an example that's a bit easier for me to understand. ;) Is X and Y suppose to be left and top, while width and height is right and bottom? Or am I way off. :P

void stretch_blit(BITMAP *source, BITMAP *dest, int source_x, source_y, source_width, source_height, int dest_x, dest_y, dest_width, dest_height);

gnolam

*_x and *_y are the top left coordinates. width and height are... the width and height.

Quote:

void stretch_blit(BITMAP *source, BITMAP *dest, int source_x, source_y, source_width, source_height, int dest_x, dest_y, dest_width, dest_height);

=> ~"copy (source_width,source_height) pixels starting from (source_x,source_y) of bitmap source to bitmap dest, at (dest_x,dest_y) with a new width and height (dest_width,dest_height)"

Milan Mimica

examples and everything is listed at:
http://www.allegro.cc/manual/api/blitting-and-sprites/stretch_blit

Width and height is width and height, not right and bottom, notice the difference. Width and height are relative to the x and y.

ImLeftFooted

{"name":"591096","src":"\/\/djungxnpq2nug.cloudfront.net\/image\/cache\/8\/e\/8ec39f7c710203c52492453b8b189c0d.png","w":500,"h":240,"tn":"\/\/djungxnpq2nug.cloudfront.net\/image\/cache\/8\/e\/8ec39f7c710203c52492453b8b189c0d"}591096

julian_boolean

Thanks!.. Trying to make a function to stretch bitmaps.. Which isn't working that well. All it's really doing is making little squares on the screen and shifting the original graphic (which is just a simple rectangle.) All I want it to do is be stretched horizontally if needed.. Please don't hurt me I'm still a newbie. :P

void textfield::box_stretch(int x, int y)
{
  xstretch = x;
  ystretch = y;
}


draw_sprite(dbuffer, pic, xbox + xstretch, ybox + ystretch);
stretch_sprite(dbuffer, pic, xstretch, ystretch, 0, 0);

James Stanley

Don't use draw_sprite AS WELL if you want it to be scaled. stretch_sprite scales and draws onto destination. Also, you haven't put enough parameters in stretch_sprite. I also think your stretch_sprite call should be in a function. You also haven't specified a new size anywhere in your function.

Thread #589790. Printed from Allegro.cc