Previous: 4.51.2.4.6. ogClear() To the Table of Contents Next: 4.51.2.4.8. ogCopy()
4.51.2.4.6. ogClear() Table of Contents 4.51.2.4.8. ogCopy()

- 4.51.2.4.7. -
Table of Contents
4. Standard Units
4.51. ObjGfx40 - ObjectGraphics 4.0 Unit
4.51.2. ObjGfx40 Unit Object Types
4.51.2.4. ogSurface object
4.51.2.4.7. ogClone()


4.51.2.4.7. ogClone()

Targets: MS-DOS, Win32 console


ObjGfx40 Unit

Synchronize one surface to another surface.

Declaration:
  function ogClone(var srcObject:ogSurface):boolean; virtual;
Remarks:

Clones one surface to be identical to another surface by making the dest 's resolution, palette, bit-depth, and pixel format identical to the source's. Also calls ogCopy() to copy the contents of the source surface. This is different than aliasing, since both surfaces are independant from one another.

Returns:

TRUE if successful, FALSE if failure

Restrictions:

screen^.ogClone() will always return FALSE

See also: Sample code:
{ogClone.pas}

uses
  ObjGfx40, CRT;

var 
  buf1, buf2:^ogSurface;

begin
  new(buf1, ogInit);
  new(buf2, ogInit);

  {First set up the screen to 640x480 in true colour.  Some video cards
   do not support 32bpp.  In the case that a 24bpp mode is available
   it will choose that instead.}

  if not screen^.ogCreate(640, 480, OG_PIXFMT_32BPP) then
    begin
      writeln('Error setting video mode');
      halt
    end;

  {Clone all the attributes of another object}
  buf1^.ogClone(screen^);
  {buf1 now has memory in the same dimensions of the screen object.
   It also has the same pixel format (bits per pixel and RGB ordering)
   as the screen. }

  {Clone the attributes of buf1}
  buf2^.ogClone(buf1^);

  {At this point buf1, buf2, and the screen should all be identical (but
   separate) in size and pixel format}

  dispose(buf2, ogDone);
  dispose(buf1, ogDone);
end.



Previous: 4.51.2.4.6. ogClear() To the Table of Contents Next: 4.51.2.4.8. ogCopy()
4.51.2.4.6. ogClear() Table of Contents 4.51.2.4.8. ogCopy()

- 4.51.2.4.7. -