Leftmost_X_coord:word [relative to (x1,y1)]
Topmost_Y_coord:word [relative to (x1,y1)]
Rightmost_X_coord:word [relative to (x1,y1)]
Bottommost_Y_coord:word [relative to (x1,y1)]
OffsetTable:array[0..(y2-y1)] of word
For y1 to y2
LineCount:byte
if LineCount<>0 then
for 0 to LineCount-1
Offset:word
PixelCount:word
rundata:array[0..PixelCount-1] of byte
end for
end if
end for
|

lds si,BlitPtr ; {Load the pointer into DS:SI}
add si,8 ; {go past the bounding coords}
mov dx,ds:[si] ; {Get address of the first line}
add si,dx ; {Go past table to the start of the first line}
shr dx,1 ; {Divide DX by 2 which is the TotalYCount}
;{DS:SI now points to right after the OffsetTable; DX is now the number}
;{of scanlines in blit}
|
shr dx,1 then there are no lines in the
blit and the blit routine should exit. The first word ends up being how
big the table is multipled by 2 (since words are two bytes). So, by
taking this number and dividing it by two you will get how many scanlines
the blit takes up.
function ImageSize(x1, y1, x2, y2: Integer): Word; begin ImageSize:=((abs(x2-x1)+1)*(abs(y2-y1)+1)+4); end; |
function BlitSize(const x1,y1,x2,y2:word):word;
var x,y,tmploc:word;
zerocount:byte;
InZeros:boolean;
xlcount:word;
height:word;
begin
height:=(y2-y1)+1;
tmploc:=0;
for y:=y1 to y2 do
begin
zerocount:=0;
inc(tmploc); {Save room for linecount}
x:=x1;
inzeros:=(getpixel(x,y)=0); {Should we start in zeros?}
while x<=x2 do {Continue until we are done with the line}
case inzeros of
true:begin
zerocount:=0; {How many zeros?}
while (x<=x2) and (getpixel(x,y)=0) do
begin
inc(x);
inc(zerocount)
end;
inzeros:=FALSE {we are no longer in zeros}
end;
false:begin
inc(tmploc,4); {zerocount (offset):word; xlcount:word}
repeat
inc(x);
inc(tmploc);
until (x>=x2) or (getpixel(x,y)=0);
inzeros:=True
end
end
end;
Blitsize:=tmploc+Height*2+8;
end;
|

