Allegro.cc - Online Community

Allegro.cc Forums » Programming Questions » stretch_blit

This thread is locked; no one can reply to it. rss feed Print
stretch_blit
julian_boolean
Member #8,201
January 2007

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
Member #2,030
March 2002
avatar

*_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)"

--
Move to the Democratic People's Republic of Vivendi Universal (formerly known as Sweden) - officially democracy- and privacy-free since 2008-06-18!

Milan Mimica
Member #3,877
September 2003
avatar

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.

Dustin Dettmer
Member #3,935
October 2003
avatar

{"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
Member #8,201
January 2007

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
Member #7,275
May 2006
avatar

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.

Go to: