Ecere SDK/eC Forums http://ecere.org/community/ Print view |
|
Scaling Sprites http://ecere.org/community/viewtopic.php?f=5&t=240 |
Page 1 of 1 |
Author: | mothdragon [ Fri Jul 27, 2012 9:42 am ] |
Post subject: | Scaling Sprites |
I thought I remembered at one time having come across some kind of scaling function for Bitmap Objects, but I can't seem to find it now... Is there a scaling function (either up or down) that can be used when displaying a Bitmap, or a portion of the Bitmap(ie sprite)? What I want to do is to take a sprite from my spritesheet and make it smaller at various points. |
Author: | mothdragon [ Fri Jul 27, 2012 10:17 am ] |
Post subject: | Re: Scaling Sprites |
Oh I found it. Its the Stretch() method in the Surface Object. Guess I was looking in the wrong spot, I had been looking at the Bitmap Object... |
Author: | jerome [ Fri Jul 27, 2012 10:20 am ] |
Post subject: | Re: Scaling Sprites |
Good morning Charlie Yes, there is Surface::Stretch. It works just like Surface::Blit, except it takes 2 sets of coordinates. Code: Select all
Source x, y Destination w, h Source w, h So you tell the function which portion (a rectangle) of your source bitmap should be used to stretch over a rectangular area of your destination surface. There is also Filter() which takes the exact same parameters as Stretch, but will do bilinear filtering so the result will generally look nicer (at a performance cost in a non-accelerated driver). Stretch() will pixelize. Regards, Jerome |
All times are UTC-05:00 | Page 1 of 1 |
Powered by phpBB® Forum Software © phpBB Limited |