SuperRect: draw a rounded corner rectangle   [ 60 ]

Description

Draws a rounded corners rectangle with current draw and fill colors and current line width which ought to have been previously specified by respectively SetDrawColor(), SetFillColor() and SetLineWidth(). Radius of each one of the four corners ought to be specified.  It takes 9 parameters described below:
  1. X  ⇒  Float number which specifies abscissa of top left corner
  2. Y  ⇒  Float number which specifies ordinate of top left corner
  3. W  ⇒  Float number which specifies Rectangle width
  4. H  ⇒  Float number which specifies Rectangle Height
  5. String which specifies rendering mode: may be
    • "D" for Draw,
    • "F" for Fill,
    • "DF" or "FD" for  Draw and Fill
  6. RTL ⇒  Float number which specifies radius of top left corner
  7. RTR ⇒  Float number which specifies radius of top right corner
  8. RBR ⇒  Float number which specifies radius of bottom right corner
  9. RBL ⇒  Float number which specifies radius of bottom left corner

C calling syntax
void SuperRect (float x, float y, float w, float h, char *style, float rtl, float rtr, float rbr, float rbl);
Cobol calling syntax
Call "SuperRect" using by value X,Y,W,H,M,RTL,RTR,RBR,RBL.
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