simplify function specifications in CTABLES
[pspp] / src / output / render.h
index 7375d1a2a81b66d78dcda280c110ccfc161ebe21..437c5a0049b169d4bae5e17f52abaee9facdd57e 100644 (file)
@@ -47,15 +47,45 @@ enum render_line_style
    corner at (0,0) in device coordinates.  This is usually not the case from
    the driver's perspective, so the driver should expect to apply its own
    offset to coordinates passed to callback functions.
+*/
+struct render_params
+  {
+    /* Functional parameters and auxiliary data to pass to them. */
+    const struct render_ops *ops;
+    void *aux;
 
+    /* Page size to try to fit the rendering into.  Some tables will, of
+       course, overflow this size. */
+    int size[TABLE_N_AXES];
 
-   Callback functions
-   ==================
+    /* Nominal size of a character in the most common font:
+       font_size[TABLE_HORZ]: Em width.
+       font_size[TABLE_VERT]: Line spacing. */
+    int font_size[TABLE_N_AXES];
 
-   For each of the callback functions, AUX is passed as the 'aux' member of the
-   render_params structure.
-*/
-struct render_params
+    /* Width of different kinds of lines. */
+    const int *line_widths;           /* RENDER_N_LINES members. */
+
+    /* Minimum cell width or height before allowing the cell to be broken
+       across two pages.  (Joined cells may always be broken at join
+       points.) */
+    int min_break[TABLE_N_AXES];
+
+    /* True if the driver supports cell margins.  (If false, the rendering
+       engine will insert a small space betweeen adjacent cells that don't have
+       an intervening rule.)  */
+    bool supports_margins;
+
+    /* True if the local language has a right-to-left direction, otherwise
+       false.  (Use render_direction_rtl() to find out.) */
+    bool rtl;
+
+    /* True if the table is being rendered for printing (as opposed to
+       on-screen display). */
+    bool printing;
+  };
+
+struct render_ops
   {
     /* Measures CELL's width.  Stores in *MIN_WIDTH the minimum width required
        to avoid splitting a single word across multiple lines (normally, this
@@ -112,39 +142,18 @@ struct render_params
                        int spill[TABLE_N_AXES][2],
                        int clip[TABLE_N_AXES][2]);
 
-    /* Auxiliary data passed to each of the above functions. */
-    void *aux;
-
-    /* Page size to try to fit the rendering into.  Some tables will, of
-       course, overflow this size. */
-    int size[TABLE_N_AXES];
-
-    /* Nominal size of a character in the most common font:
-       font_size[TABLE_HORZ]: Em width.
-       font_size[TABLE_VERT]: Line spacing. */
-    int font_size[TABLE_N_AXES];
-
-    /* Width of different kinds of lines. */
-    int line_widths[TABLE_N_AXES][RENDER_N_LINES];
-
-    /* Minimum cell width or height before allowing the cell to be broken
-       across two pages.  (Joined cells may always be broken at join
-       points.) */
-    int min_break[TABLE_N_AXES];
-
-    /* True if the driver supports cell margins.  (If false, the rendering
-       engine will insert a small space betweeen adjacent cells that don't have
-       an intervening rule.)  */
-    bool supports_margins;
+    /* Scales all output by FACTOR, e.g. a FACTOR of 0.5 would cause everything
+       subsequent to be drawn half-size.  FACTOR will be greater than 0 and
+       less than or equal to 1.
 
-    /* True if the local language has a right-to-left direction, otherwise
-       false.  (Use render_direction_rtl() to find out.) */
-    bool rtl;
+       Optional.  If NULL, the rendering engine won't try to scale output. */
+    void (*scale) (void *aux, double factor);
   };
 
 /* An iterator for breaking render_pages into smaller chunks. */
 struct render_pager *render_pager_create (const struct render_params *,
-                                          const struct table_item *);
+                                          const struct pivot_table *,
+                                          const size_t *layer_indexes);
 void render_pager_destroy (struct render_pager *);
 
 bool render_pager_has_next (const struct render_pager *);