Borland C++ reference

getpalettesize

raw OCR

Returns size of palette color lookup table.

Defined in header <graphics.h>

Syntax

#include <graphics.h>
int far getpalettesize(void);

Portability

DOSUNIXWindowsANSI CC++ only
■

Remarks

getpalettesize is used to determine how many palette entries can be set for the current graphics mode. For example, the EGA in color mode returns 16.

Return value

getpalettesize returns the number of palette entries in the current palette.

See also

Example

#include <graphics.h>
#include <stdlib.h>
#include <stdio.h>
#include <conio.h>

int mainO
{
   /* request autodetection  */
   int gdriver = DETECT, gmode,  errorcode;
   int midx, midy;
   char psize[80];
   /* 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:");
      getchO;
      exit(l);                /* terminate with an error code */

   midx = getmaxxO  / 2;
   midy = getmaxyO  / 2;
/* convert palette  size info into string */
sprintf (psize, "The palette has %d modifiable entries.", getpalettesize I

/* display the information  */
settext]UStify(CENTER_TEXT,  CENTER_TEXT);
outtextxy (midx, midy, psize);

/* clean up */
getchO ;
closegraphO  ;
return 0;

Differences from modern implementations

Nothing recorded yet.

Modern references

These are search links, not yet checked by hand.