Sign in to follow this  

How to user SDL_BlitSurface to blit a stretched surface

This topic is 2489 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.

[code]
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);
}
}
[/code]

Share this post


Link to post
Share on other sites
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

This topic is 2489 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.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this