SetFillColor: Set color of areas to be filled   [ 20 ]

Description

Set color of lines to be filled with functions Cell(), Line(), Rect(), SuperRect(), Elipse(), Circle(), Polygon(), Sector().  This function takes 3 integer parameters:
  • Red    ⇒ a value between 0 and 255
  • Green  ⇒ a value between 0 and 255
  • Blue   ⇒ a value between 0 and 255
Developper Notes:
  • If an integer number is greater than 255, it is logically "ANDED" with 0xff.
  • There are 24 millions combinations which may be obtained from black (0,0,0) upto white (255,255,255).
  • If one of these 3 numbers is negative, it will be automatically replaced with its corresponding value set by means of function SetCustColors().

C calling syntax
void SetFIllColor (int r, int g, int b)
Cobol calling syntax
Call "SetFillColor" using by value R,G,B.
C sample code
#include   "fpdf.h"

static char   f_ini ??(??) = ??< "ini??/??/demofpdf.ini" ??>;
static char   f_out ??(??) = ??< "pdf??/??/demo_b.pdf" ??>;

/* ----------------------------------------------------------------- */

int  main (int argc, char *argv [])

??<
int   ii;

NewPdfy (f_ini, 1);
AddPage ("P");
SetLineWidth (0.2);
SetFillColor (240, 240, 240);
SuperRect (10, 10, 190, 275, "DF", 1, 1, 1, 1);
SetDrawColor (16, 64, 240);
for (ii = 0; ii < 180; ii ++) {
    Rotate (ii * 2, 105, 145);
    Ellipse (105, 145, 30, 90, "D");
    }
Output (f_out);
??>
Cobol sample code
       Procedure division.
           String   'DD:FINI' Low-Value delimited by size into T0.
           String   'DD:FINI' Low-Value delimited by size into T0.
           MOVE  NB_PAGES TO I.
           CALL "NewPdfy" USING BY value Pt0, NB_PAGES.
      *
           String 'P' Low-Value delimited by size into T0.
           Call "AddPage" Using by value Pt0.
      *
           MOVE 0.2 TO LW.
           Call "SetLineWidth" Using by value LW.
      *
           MOVE 16   TO R.
           MOVE 32   TO G.
           MOVE 240 TO B.
           Call "SetFillColor" Using by value R,G,B.
           MOVE 1   TO RADIUS.
           MOVE 10   TO X.
           MOVE 10   TO Y.
           MOVE 190   TO W.
           MOVE 275   TO H.
           String  'DF' Low-Value delimited by size into T0.
           Call "SuperRect" Using by value X,Y,W,H,Pt0,RADIUS,RADIUS,RADIUS,RADIUS.
      *
           MOVE 16   TO R.
           MOVE 32   TO G.
           MOVE 240 TO B.
           Call "SetDrawColor" Using by value R,G,B.
      *
           MOVE 105 TO X.
           MOVE 145 TO Y.
           MOVE 180 TO N.
           MOVE 0 TO I.
           PERFORM UNTIL N <= 0
               COMPUTE ANGLE = I * 2
               Call "Rotate" Using by value Angle,X,Y.
               Call "Ellipse" Using by value X,Y,RX,RY,T0.
               SUBTRACT 1 FROM N
           END-PERFORM.
      *
           String  'DD:FOUT' Low-Value delimited by size into T0.
           Call "Output" Using by value Pt0.
Description of sample code
This piece of code creates an elementary rosette within a rounded corners rectangle, illustrating the use of following functions.
- SetLineWidth()  -->  Set the width of lines to be drawn
- SetDrawColor()  -->  Set the color of lines to be drawn
- SetFillColor()  -->  Set the color of area to be filled
- SuperRect()     -->  Draw a rounded corner rectangle
- Ellipse()       -->  Draw an ellipse
- Rotate()        -->  Rotate the XY coordinates of a given angle around a point 
See sample source code in 'C' as well as PDF execution result  -  NB: For encrypted PDFs, user password is USER-PSWD