PDA

View Full Version : Sizing an Image



cairnswm
22-03-2005, 07:31 PM
If I have an image surface - How do I draw it in a different size? (ie taking a 100x100 surface and drawing it 64x64 on the screen)

Paulius
22-03-2005, 08:02 PM
I believe SDL_BlitSurface lets you specify destination dimentions

cairnswm
22-03-2005, 08:14 PM
From comment before SDL_BlitSurface


This performs a fast blit from the source surface to the destination
surface. It assumes that the source and destination rectangles are
the same size. If either 'srcrect' or 'dstrect' are NULL, the entire
surface (src or dst) is copied. The final blit rectangles are saved
in 'srcrect' and 'dstrect' after all clipping is performed.

And if a different sized Rect is passed only the top,left parameters are used. And the whole image is drawn.

Paulius
22-03-2005, 08:46 PM
Took a look through SDL unit and found no other function for blitting, guess you?¢_Tll stuck with locking surfaces and doing scaling be hand.

WILL
22-03-2005, 08:55 PM
Not so much... I am not 100% sure, but there should be a function in sdlutils.pas check it out before you give up on this. I'm sure there is something there...

JSoftware
22-03-2005, 10:55 PM
i tried to stretchsurfaces in sdl once only to find out that you had to use some weirdo library somewhere.. i never got i working i remember

you can't use stretchblt on sdl surfaces?

cairnswm
23-03-2005, 05:46 AM
I have found the following functions in SDLUtils:

SDL_ScaleSurfaceRect
SDL_Stretch8
SDL_ZoomSurface

The ScaleSurface uses Stretch8.

ZoomSurface does Pixel level gets and puts. The Stretch seems to do row by row manipulation.

I'll try get a StretchDraw function working in S2DL for doing this. (May be more efficient to size the entire image surface and then use when/if needed)