![]() |
![]() |
![]() |
| 4.51.2.4.10. ogCopyLineTo() | Table of Contents | 4.51.2.4.12. ogCopyPal() |
procedure ogCopyBuf(dX1, dY1:int32;
var srcObject:ogSurface;
sX1, sY1, sX2, sY2:int32);
Remarks:
Copies the region (sX1,sY1),(sX2,sY2) from srcObject to (dX1,dY1) of the destination object. This function is useful for copying a specific region of another ogSurface object.
If the source and dest have different bit-depths or pixel formats this function will automatically convert to the destination's pixel format.
Clips to the destination surface if necessary.
Restrictions:
If any of the source region is outside the bounds of srcObject this
function will copy nothing.
See also:
{ogCopyBuf.pas}
uses
ObjGfx40, CRT;
var
buf:^ogSurface;
xx, yy:uInt32;
colour:uInt8;
begin
new(buf, ogInit);
{Create an 8BPP buffer}
if not buf^.ogCreate(32, 32, OG_PIXFMT_8BPP) then
begin
writeln('Error alloctating memory for buffer');
halt
end;
{Set the video mode to true colour}
if not screen^.ogCreate(640, 480, OG_PIXFMT_32BPP) then
begin
writeln('Error setting video mode');
halt
end;
colour:=0; {used for ogFillCircle()}
repeat
{Draw circles in the 8bpp buffer}
with buf^ do
for xx:=ogGetMaxX-1 downto 0 do
ogFillCircle((ogGetMaxX+1) div 2, (ogGetMaxY+1) div 2, xx,colour+xx);
{Now tile the smaller buffer onto the screen. The ogCopyBuf() method
handles the pixel conversion from 8bpp to true colour}
for yy:=0 to ((screen^.ogGetMaxY+1) div (buf^.ogGetMaxY+1))-1 do
for xx:=0 to ((screen^.ogGetMaxX+1) div (buf^.ogGetMaxX+1))-1 do
screen^.ogCopyBuf(xx*(buf^.ogGetMaxX+1), yy*(buf^.ogGetMaxY+1),
buf^,
0, 0, buf^.ogGetMaxX, buf^.ogGetMaxY);
inc(colour);
until keyPressed;
while keyPressed do readkey;
dispose(buf, ogDone);
end.
![]() |
![]() |
![]() |
| 4.51.2.4.10. ogCopyLineTo() | Table of Contents | 4.51.2.4.12. ogCopyPal() |