Chapter 26
Shading Internals

As described in section 10.11 Shadings, fz_shade is an encapsulation of the information required to define a PDF shading. This is essentially a superset of all the shading types provided by our supported document handlers. If we ever meet a format that requires features not provided in PDF, then fz_shade will be extended to cope.

typedef struct fz_shade_s 
{ 
   fz_storable storable; 
 
   fz_rect bbox;  /* can be fz_infinite_rect */ 
   fz_colorspace *colorspace; 
 
   fz_matrix matrix;/* matrix from pattern dict */ 
   int use_background;/* background color for fills but not sh */ 
   float background[FZ_MAX_COLORS]; 
 
   int use_function; 
   float function[256][FZ_MAX_COLORS + 1]; 
 
   int type; /* function, linear, radial, mesh */ 
   union 
   { 
      struct 
      { 
         int extend[2]; 
         float coords[2][3]; /* (x,y,r) twice */ 
      } l_or_r; 
      struct 
      { 
         int vprow; 
         int bpflag; 
         int bpcoord; 
         int bpcomp; 
         float x0, x1; 
         float y0, y1; 
         float c0[FZ_MAX_COLORS]; 
         float c1[FZ_MAX_COLORS]; 
      } m; 
      struct[] 
      { 
         fz_matrix matrix; 
         int xdivs; 
         int ydivs; 
         float domain[2][2]; 
         float *fn_vals; 
      } f; 
   } u; 
 
   fz_compressed_buffer *buffer; 
} fz_shade;
 26.1 Creation
 26.2 Bounding
 26.3 Painting
 26.4 Decomposition