Re : Re : Clip Rect

Hi,

Sorry, I didn’t want to say “above” but “beyond”.

Why is it that clipping
doesn’t affect the source surface too ?

Before a blit I set up my src and dst rectangles, so what’s the point
of clipping ? I mean, are there good example of usage ?

Cheers,

Julien

----- Message d’origine ----De : Pierre Phaneuf
? : A list for developers using the SDL library. (includes SDL-announce)
Envoy? le : Vendredi, 4 Juillet 2008, 17h35mn 58s
Objet : Re: [SDL] Re : Clip Rect

On Fri, Jul 4, 2008 at 11:29 AM, julien CLEMENT <@Julien_Clement1> wrote:

Can a clipping rectangle be used to blit on the screen and ensure that you
don’t blit above the screen’s boundaries ?

Above? In any case, the destination surface is implicitly clipped to,
so setting a clipping rectangle that’s equal to the size of the
surface (with a 0, 0 origin) is equivalent to not having a clipping
rectangle.


http://pphaneuf.livejournal.com/


SDL mailing list
SDL at lists.libsdl.org
http://lists.libsdl.org/listinfo.cgi/sdl-libsdl.org

  _____________________________________________________________________________ 

Envoyez avec Yahoo! Mail. Une boite mail plus intelligente http://mail.yahoo.fr

Ooh, I love cliprects! You want a good example of usage? In my game, I have splitscreen multiplayer. I set the cliprect on the screen for player one, then loop through all the junk I need to draw. I just blit them willy-nilly to the screen and they’re automatically kept within the player’s screen. Then I do the same, looped through the rest of the players with cliprect offsets. Now, the advantage should be obvious, but if I didn’t have this option, then I would have to personally clip out of bounds sprites and mangle the destrects of each sprite that is partially visible when I blit them, then change them back. Eww.

Jonny DDate: Sat, 5 Jul 2008 08:53:33 +0000
From: clementj2005@yahoo.fr
To: sdl at lists.libsdl.org
Subject: [SDL] Re : Re : Clip Rect

Hi,
Sorry, I didn’t want to say “above” but “beyond”.
Why is it that clippingdoesn’t affect the source surface too ?
Before a blit I set up my src and dst rectangles, so what’s the
pointof clipping ? I mean, are there good example of usage ?

Cheers,
Julien

----- Message d’origine ----
De : Pierre Phaneuf
? : A list for
developers using the SDL library. (includes SDL-announce)
Envoy? le : Vendredi, 4 Juillet 2008, 17h35mn 58s
Objet : Re: [SDL] Re : Clip Rect

On Fri, Jul 4, 2008 at 11:29 AM, julien CLEMENT wrote:

Can a clipping rectangle be used to blit on the screen and ensure that you
don’t blit above the screen’s boundaries ?

Above? In any case, the destination surface is implicitly clipped to,
so setting a clipping rectangle that’s equal to the size of the
surface (with a 0, 0 origin) is equivalent to not having a clipping
rectangle.


http://pphaneuf.livejournal.com/


SDL mailing list
SDL at lists.libsdl.org
http://lists.libsdl.org/listinfo.cgi/sdl-libsdl.org

Envoy? avec Yahoo! Mail.
Une boite mail plus intelligente.

What I use it for is setting up a specific area with a graphic “tiled” onto it. Set a ClipRect to define the boundaries, then just use a double while loop to blit your tile over and over until you’re beyond the bounds, and the ClipRect takes care of the right and bottom edges for you.>----- Original Message ----

From: julien CLEMENT
Subject: [SDL] Re : Re : Clip Rect

Hi,

Before a blit I set up my src and dst rectangles, so what’s the point
of clipping ? I mean, are there good example of usage ?

Cheers,

Julien

Why is it that clipping
doesn’t affect the source surface too ?

I see what you mean, but it seems that the way it works it that it
only limits the drawing. If you want to take less of the source
surface, you’ll have to setup the first SDL_Rect parameter of
SDL_BlitSurface appropriately.

Before a blit I set up my src and dst rectangles, so what’s the point
of clipping ? I mean, are there good example of usage ?

Note that in the SDL_Rect for the destination in the parameters of
SDL_BlitSurface, the width and height are ignored. But it’s true
that by setting the first SDL_Rect appropriately, you can avoid the
need for the clipping rectangle, it’s just a helper, it doesn’t give
you anything you can’t do yourself in other ways.

A clip rectangle would be useful if there was certain drawing
primitives, such as a line. It’s possible to do without a clipping
rectangle when drawing a diagonal line, but it’s more of a pain, and
possibly slightly different results, for example.On Sat, Jul 5, 2008 at 4:53 AM, julien CLEMENT wrote:


http://pphaneuf.livejournal.com/