Results 1 to 7 of 7

Thread: Sizing an Image

  1. #1
    Legendary Member cairnswm's Avatar
    Join Date
    Nov 2002
    Location
    Randburg, South Africa
    Posts
    1,537

    Sizing an Image

    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)
    William Cairns
    My Games: http://www.cairnsgames.co.za (Currently very inactive)
    MyOnline Games: http://TheGameDeveloper.co.za (Currently very inactive)

  2. #2

    Sizing an Image

    I believe SDL_BlitSurface lets you specify destination dimentions

  3. #3
    Legendary Member cairnswm's Avatar
    Join Date
    Nov 2002
    Location
    Randburg, South Africa
    Posts
    1,537

    Sizing an Image

    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.
    William Cairns
    My Games: http://www.cairnsgames.co.za (Currently very inactive)
    MyOnline Games: http://TheGameDeveloper.co.za (Currently very inactive)

  4. #4

    Sizing an Image

    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.

  5. #5
    Co-Founder / PGD Elder WILL's Avatar
    Join Date
    Apr 2003
    Location
    Canada
    Posts
    6,107
    Blog Entries
    25

    Sizing an Image

    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...
    Jason McMillen
    Pascal Game Development
    Co-Founder





  6. #6

    Sizing an Image

    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?
    Peregrinus, expectavi pedes meos in cymbalis
    Nullus norvegicorum sole urinat

  7. #7
    Legendary Member cairnswm's Avatar
    Join Date
    Nov 2002
    Location
    Randburg, South Africa
    Posts
    1,537

    Sizing an Image

    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)
    William Cairns
    My Games: http://www.cairnsgames.co.za (Currently very inactive)
    MyOnline Games: http://TheGameDeveloper.co.za (Currently very inactive)

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •