Board index » delphi » Clipping and masking??

Clipping and masking??

Put a sprite on screen console style (clipping, and masking)

I saw this phrase above in a procedure, but i don't know what is
clipping and masking, can anyone explain to me, the procedure was in
assembly :(.

Rui Martinho
Faculdade de Cincias de Lisboa -- Informtica
i24...@caravela.di.fc.ul.pt

 

Re:Clipping and masking??


Quote
RAC wrote in message <347c499c.2516...@news.telepac.pt>...
>Put a sprite on screen console style (clipping, and masking)

>I saw this phrase above in a procedure, but i don't know what is
>clipping and masking, can anyone explain to me, the procedure was in
>assembly :(.

>Rui Martinho
>Faculdade de Cincias de Lisboa -- Informtica
>i24...@caravela.di.fc.ul.pt

I don't know if u want the code explication but anyway...

'Masking' is when a put_sprite procedure (or anything for that matter) dont
put a specified color or teint to screen to make it transparent.
Ex : If they see color 0 they dont put it on screen...
You can see that everywhere on the net with 'transparent' gif.

'Clipping' occur if you put a sprite on the screen and they go outside some
user-define boundary. The data outside will not be draw to the screen.
Ex:
-Lets say u have a proc that define such boundary:
procedure set_clip(top_x, top_y, bottom_x, bottom_y : integer);
begin
    {do some code here to create a 'box' in which the sprite can be draw
inside using a structrure variable called clip}
end;
-Now a procedure to put the clipped sprite:
THIS IS NOT PASCAL CODE ONLY AN EXAMPLE:
procedure put_clipped_sprite( x, y : integer; var sprite);
var i,,j : integer;
begin
    for i = 0 to sprite.size_x do
        for j = 0 to sprite.size_y do
           if (x + i > clip.top_x) and (x + i < clip.bottom_x) then
{check if in x boundary}
                if (y + j > clip.top_y) and (y + j < clip.bottom_y) then
{check if in y boundary}
 {if yes put the pixel}
                    putpixel(x + i, y + j, sprite.data[x,y]);
end;

I hope this help u...

Other Threads