• Advertisement
Sign in to follow this  

How to user SDL_BlitSurface to blit a stretched surface

This topic is 2563 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

How do I use the SDL_BlitSurface( to scale the destination surface?
I had defined the enlarged destination surface in the function of SDL_BlitSurface . But it don't work. The result is still the original surface size.


void CGraphic::Draw( int x, int y , int with, int height)
{
if(m_pSurface!=NULL && m_pScreenSurface!=NULL )
{
//cout<<"draw picture"<<endl;
//SDL_SetColorKey( m_pSurface, SDL_SRCCOLORKEY, 0xff00ff );
SDL_Rect DestRect;
DestRect.x=x;
DestRect.y=y;
DestRect.w=with;
DestRect.h=height;

SDL_BlitSurface( m_pSurface, NULL, m_pScreenSurface, &DestRect);
}
}

Share this post


Link to post
Share on other sites
Advertisement
SDL 1.2 doesn't support scaling during blits. Read the documentation. You must either do this yourself, or use a library to handle this (SDL_gfx supports this IIRC). SDL 1.3 supports this I believe, but I wouldn't recommend that unless you are comfortable working on the bleeding edge; building SDL frequently for updates and bugfixes.

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement