[SDL] A couple questions on SDL
Lilith Calbridge
lilith at dcccd.edu
Wed Jul 12 20:55:44 PDT 2006
>>> On 7/12/2006 at 8:56 PM, in message <44B5A845.4090209 at freeuk.com>,
darkmatter at freeuk.com wrote:
> Lilith Calbridge wrote:
>
>> I'm getting my feet wet with SDL and, in a great sense, video
graphics
>> in general. In looking for functions or combination of functions to
do
>> what I need I've come across some things that it would help me to
>> understand better.
>>
>> First, what is YUV? More explicitly what is the purpose of a YUV
>> overlay?
>
> YUV is a colour space format, as is RGB, but instead of storing the
> amounts of red, green and blue per pixel, it stores the brightness
and
> then the blue and red amounts in relation to the brightness. It more
> accurately models the human perception of colour and is mostly used
in
> realtime video, for example in MPEG.
>
> http://en.wikipedia.org/wiki/YUV
>
> A YUV overlay is a hardware method of displaying this data. Typically
> conversion from YUV->RGB is handled in hardware, although SDL can if
> neccesary do this in software.
>> I've tried to find information through Google but pretty much
>> anything that discussed it did so from the view point that the
reader
>> knew what it was.
> In all honesty, YUV is only really used for motion video compression
> such as MPEG, DIVX, etc. If you're not playing back movies then it's
not
> really of any relevance.
That's good to know. Less I need to spend time on. :-)
>> Second, does SDL provide a function that I'm overlooking that will
copy
>> the pixels of a small rectangle of a large surface into the pixels
of a
>> smaller storage surface. My purpose is to restore the background
under
>> a blitted surface to it's original content before redrawing the
object
>> at a displaced position. I don't mind doing the coding myself but
if
>> SDL supports this functionality it's probably more efficient than
what
>> I'd come up with.
>
> Yes, SDL_Blit() will do this given the appropriate rect's.
That'll teach me to leave my thinking cap back at the office. I was
thrown by the statement in the documentation that only the x and y
values of the source rectangle are used. I should have figured that the
blit would use the w and h values of the destination rectangle to define
what to transfer from the source surface.
One more question if I could. The SDL_CreateRGBSurfaceFrom
documenation says "The pixel data is not copied into the SDL_Surface
structure so it should not be freed until the surface has been freed
with a call to SDL_FreeSurface." Does this mean that the surface
structure is set to point to the pixel data presented in the function
argument and doesn't create a pixel array of its own?
Thanks again.
Lilith
More information about the SDL
mailing list