Previous: 4.51.2.4.37. ogInit() To the Table of Contents Next: 4.51.2.4.39. ogIsBlending()
4.51.2.4.37. ogInit() Table of Contents 4.51.2.4.39. ogIsBlending()

- 4.51.2.4.38. -
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.38. ogIsAntiAliasing()


4.51.2.4.38. ogIsAntiAliasing()

Targets: MS-DOS, Win32 console


ObjGfx40 Unit

Returns whether the surface is antialiasing primitives.

Declaration:
  function ogIsAntiAliasing:boolean;
Remarks:

Returns TRUE if antialiasing is turned on for the surface. FALSE otherwise. Currently, only line related methods use antialiasing.

Restrictions:

By default antialiasing will be turned off in 8BPP buffers due to speed considerations. Antialiasing does work in 8BPP modes, but is incredibly slow. This will be fixed in the next revision.

See also: Sample code:
{ogIsAntiAliasing.pas}

uses
  ObjGfx40, CRT;

var
  oldAntiAliasState:boolean;
  xx, yy:uInt32;
  
begin

  {set the video card to be 800x600 in true colour}
  if not (screen^.ogCreate(800, 600, OG_PIXFMT_32BPP)) then
    begin
      writeln('Error setting video mode');
      halt
    end;

  {Draw a line in white using the default anti alias state (TRUE for bit
   depths greater than 8bpp)}
  with screen^ do
    for xx:=0 to (ogGetMaxX+1) div 10 do
      ogLine(xx*10,0,(ogGetMaxX+1) div 2,(ogGetMaxY+1) div 2,
             ogRGB(255,255,255));

  {Get the old anti alias state}
  oldAntiAliasState := screen^.ogIsAntiAliasing;

  {set the new anti alias state to false}
  screen^.ogSetAntiAliasing(FALSE);

  {Draw lines in blue without anti aliasing}
  with screen^ do
    for yy:=0 to (ogGetMaxY+1) div 10 do
      ogLine(ogGetMaxX, yy*10,(ogGetMaxX+1) div 2,(ogGetMaxY+1) div 2,
             ogRGB(0,0,255));

  {Restore the previous anti alias state}
  screen^.ogSetAntiAliasing(oldAntiAliasState);

  {This is an alternative to using ogIsAntiAliasing}
  oldAntiAliasState := screen^.ogSetAntiAliasing(FALSE);

  {Draw a non anti-aliased line in green}
  with screen^ do
    for yy:=0 to (ogGetMaxY+1) div 10 do
      ogLine(0,yy*10,(ogGetMaxX+1) div 2,(ogGetMaxY+1) div 2,
             ogRGB(0,255,0));

  screen^.ogSetAntiAliasing(oldAntiAliasState);

  {Draw a anti-aliased line in red}
  with screen^ do
    for xx:=0 to (ogGetMaxX+1) div 10 do
      ogLine(xx*10,ogGetMaxY,(ogGetMaxX+1) div 2,ogGetMaxY div 2,
             ogRGB(255,0,0));
  readKey;
  while keyPressed do readKey;
end.



Previous: 4.51.2.4.37. ogInit() To the Table of Contents Next: 4.51.2.4.39. ogIsBlending()
4.51.2.4.37. ogInit() Table of Contents 4.51.2.4.39. ogIsBlending()

- 4.51.2.4.38. -