Borland C++ reference

getdefaultpalette

raw OCR

Returns the palette definition structure.

Defined in header <graphics.h>

Syntax

#include <graphics.h>
struct palettetype *far getdefaultpalette(void);

Portability

DOSUNIXWindowsANSI CC++ only
■

Remarks

getdefaultpalette finds the palettetype structure that contains the palette initialized by the driver during initgraph.

Return value

getdefaultpalette returns a pointer to the default palette set up by the current driver when that driver was initialized.

See also

Example

#include <graphics.h>
#include <stdlib.h>
#include <stdio.h>
#include <conio.h>
int main(void)
{
   /* request autodetection */
   int gdriver = DETECT, gmode, errorcode;

   /* far pointer to palette structure  */
   struct palettetype far *pal = NULL;
   int i;

   /* initialize graphics and local variables  */
   initgraph(&gdriver, &gmode,  "");

   /* read result of initialization  */
   errorcode = graphresult ();
   if (errorcode != grOk)  ( /* an error occurred  */
      printf("Graphics error: %s\n", grapherrormsg (errorcode));
      printf("Press any key to halt:");
      getch();
      exit(l);               /* terminate with  an error code */
   }
   /* return a pointer to the default palette  */
   pal = getdefaultpalette 0;
   for (i=0; i<pal->size; i++)  {
      printf("colors [%d] = %d\n", i, pal->colors[i]);
      getch 0;
   }

   /* clean up */                                   ■
   getch0 ;
  . closegraphO ;
   return 0;

Differences from modern implementations

Nothing recorded yet.

Modern references

These are search links, not yet checked by hand.