From 667605869fba31c48e61736f89efe4126d27db0c Mon Sep 17 00:00:00 2001 From: Vincent Sanders Date: Mon, 30 May 2016 21:05:57 +0100 Subject: move plotters header into public API --- desktop/browser.c | 2 +- desktop/browser_history.c | 2 +- desktop/knockout.c | 2 +- desktop/knockout.h | 2 +- desktop/plot_style.c | 2 +- desktop/plotters.h | 160 ---------------------------------------------- desktop/print.c | 2 +- desktop/save_pdf.c | 2 +- desktop/scrollbar.c | 2 +- desktop/selection.c | 2 +- desktop/textarea.c | 2 +- desktop/treeview.c | 2 +- 12 files changed, 11 insertions(+), 171 deletions(-) delete mode 100644 desktop/plotters.h (limited to 'desktop') diff --git a/desktop/browser.c b/desktop/browser.c index 6b3746f4a..c0db76abc 100644 --- a/desktop/browser.c +++ b/desktop/browser.c @@ -68,7 +68,7 @@ #include "desktop/knockout.h" #include "desktop/scrollbar.h" #include "desktop/selection.h" -#include "desktop/plotters.h" +#include "netsurf/plotters.h" #include "desktop/theme.h" #include "netsurf/misc.h" #include "netsurf/window.h" diff --git a/desktop/browser_history.c b/desktop/browser_history.c index 79a921ad1..a8c8ee041 100644 --- a/desktop/browser_history.c +++ b/desktop/browser_history.c @@ -40,7 +40,7 @@ #include "desktop/gui_internal.h" #include "desktop/browser_history.h" #include "desktop/browser_private.h" -#include "desktop/plotters.h" +#include "netsurf/plotters.h" #define WIDTH 100 #define HEIGHT 86 diff --git a/desktop/knockout.c b/desktop/knockout.c index a20ec28b7..b930ef673 100644 --- a/desktop/knockout.c +++ b/desktop/knockout.c @@ -74,7 +74,7 @@ #include "desktop/gui_internal.h" #include "desktop/knockout.h" -#include "desktop/plotters.h" +#include "netsurf/plotters.h" /* Define to enable knockout debug */ #undef KNOCKOUT_DEBUG diff --git a/desktop/knockout.h b/desktop/knockout.h index a6b61d836..c4f1245fc 100644 --- a/desktop/knockout.h +++ b/desktop/knockout.h @@ -23,7 +23,7 @@ #ifndef _NETSURF_DESKTOP_KNOCKOUT_H_ #define _NETSURF_DESKTOP_KNOCKOUT_H_ -#include "desktop/plotters.h" +#include "netsurf/plotters.h" bool knockout_plot_start(const struct redraw_context *ctx, diff --git a/desktop/plot_style.c b/desktop/plot_style.c index 05e42baad..f9ba4bcbf 100644 --- a/desktop/plot_style.c +++ b/desktop/plot_style.c @@ -23,7 +23,7 @@ * These plot styles are globaly available and used in many places. */ -#include "desktop/plotters.h" +#include "netsurf/plotters.h" static plot_style_t plot_style_fill_white_static = { .fill_type = PLOT_OP_TYPE_SOLID, diff --git a/desktop/plotters.h b/desktop/plotters.h deleted file mode 100644 index d764de2d2..000000000 --- a/desktop/plotters.h +++ /dev/null @@ -1,160 +0,0 @@ -/* - * Copyright 2004 James Bursa - * - * This file is part of NetSurf, http://www.netsurf-browser.org/ - * - * NetSurf is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; version 2 of the License. - * - * NetSurf is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - */ - -/** \file - * Target independent plotting (interface). - */ - -#ifndef _NETSURF_DESKTOP_PLOTTERS_H_ -#define _NETSURF_DESKTOP_PLOTTERS_H_ - -#include -#include - -#include "desktop/plot_style.h" - -struct bitmap; -struct rect; - -typedef unsigned long bitmap_flags_t; -#define BITMAPF_NONE 0 -#define BITMAPF_REPEAT_X 1 -#define BITMAPF_REPEAT_Y 2 - -enum path_command { - PLOTTER_PATH_MOVE, - PLOTTER_PATH_CLOSE, - PLOTTER_PATH_LINE, - PLOTTER_PATH_BEZIER, -}; - -/** Set of target specific plotting functions. - * - * The functions are: - * arc - Plots an arc, around (x,y), from anticlockwise from angle1 to - * angle2. Angles are measured anticlockwise from horizontal, in - * degrees. - * disc - Plots a circle, centered on (x,y), which is optionally filled. - * line - Plots a line from (x0,y0) to (x1,y1). Coordinates are at - * centre of line width/thickness. - * path - Plots a path consisting of cubic Bezier curves. Line colour is - * given by c and fill colour is given by fill. - * polygon - Plots a filled polygon with straight lines between points. - * The lines around the edge of the ploygon are not plotted. The - * polygon is filled with the non-zero winding rule. - * rectangle - Plots a rectangle outline. The line can be solid, dotted or - * dashed. Top left corner at (x0,y0) and rectangle has given - * width and height. - * fill - Plots a filled rectangle. Top left corner at (x0,y0), bottom - * right corner at (x1,y1). Note: (x0,y0) is inside filled area, - * but (x1,y1) is below and to the right. See diagram below. - * clip - Sets a clip rectangle for subsequent plots. - * text - Plots text. (x,y) is the coordinate of the left hand side of - * the text's baseline. The text is UTF-8 encoded. The colour, c, - * is the colour of the text. Background colour, bg, may be used - * optionally to attempt to provide anti-aliased text without - * screen reads. Font information is provided in the style. - * bitmap - Tiled plot of a bitmap image. (x,y) gives the top left - * coordinate of an explicitly placed tile. From this tile the - * image can repeat in all four directions -- up, down, left and - * right -- to the extents given by the current clip rectangle. - * The bitmap_flags say whether to tile in the x and y - * directions. If not tiling in x or y directions, the single - * image is plotted. The width and height give the dimensions - * the image is to be scaled to. - * group_start - Start of a group of objects. Used when plotter implements - * export to a vector graphics file format. (Optional.) - * group_end - End of the most recently started group. (Optional.) - * flush - Only used internally by the knockout code. Should be NULL in - * any front end display plotters or export plotters. - * - * Plotter options: - * option_knockout - Optimisation particularly for unaccelerated screen - * redraw. It tries to avoid plotting to the same area - * more than once. See desktop/knockout.c - * - * Coordinates are from top left of canvas and (0,0) is the top left grid - * denomination. If a "fill" is drawn from (0,0) to (4,3), the result is: - * - * 0 1 2 3 4 5 - * +-+-+-+-+-+- - * 0 |#|#|#|#| | - * +-+-+-+-+-+- - * 1 |#|#|#|#| | - * +-+-+-+-+-+- - * 2 |#|#|#|#| | - * +-+-+-+-+-+- - * 3 | | | | | | - */ -struct plotter_table { - /* clipping operations */ - bool (*clip)(const struct rect *clip); - - /* shape primatives */ - bool (*arc)(int x, int y, int radius, int angle1, int angle2, const plot_style_t *pstyle); - bool (*disc)(int x, int y, int radius, const plot_style_t *pstyle); - bool (*line)(int x0, int y0, int x1, int y1, const plot_style_t *pstyle); - bool (*rectangle)(int x0, int y0, int x1, int y1, const plot_style_t *pstyle); - bool (*polygon)(const int *p, unsigned int n, const plot_style_t *pstyle); - - /* complex path (for SVG) */ - bool (*path)(const float *p, unsigned int n, colour fill, float width, - colour c, const float transform[6]); - - /* Image */ - bool (*bitmap)(int x, int y, int width, int height, - struct bitmap *bitmap, colour bg, - bitmap_flags_t flags); - - /** - * Text. - * - * \param x x coordinate - * \param y y coordinate - * \param text UTF-8 string to plot - * \param length length of string, in bytes - * \param fstyle plot style for this text - * \return true on success, false on error and error reported - */ - bool (*text)(int x, int y, const char *text, size_t length, - const plot_font_style_t *fstyle); - - /* optional callbacks */ - bool (*group_start)(const char *name); /**< optional, may be NULL */ - bool (*group_end)(void); /**< optional, may be NULL */ - bool (*flush)(void); /**< optional, may be NULL */ - - /* flags */ - bool option_knockout; /**< set if knockout rendering is required */ -}; - - -/* Redraw context */ -struct redraw_context { - /** Redraw to show interactive features, such as active selections - * etc. Should be off for printing. */ - bool interactive; - - /** Render background images. May want it off for printing. */ - bool background_images; - - /** Current plotters, must be assigned before use. */ - const struct plotter_table *plot; -}; - -#endif diff --git a/desktop/print.c b/desktop/print.c index c3cfefc0b..8daec887c 100644 --- a/desktop/print.c +++ b/desktop/print.c @@ -35,7 +35,7 @@ #include "content/handlers/css/utils.h" #include "render/box.h" -#include "desktop/plotters.h" +#include "netsurf/plotters.h" #include "desktop/print.h" #include "desktop/printer.h" diff --git a/desktop/save_pdf.c b/desktop/save_pdf.c index 0c870b464..d303eca7c 100644 --- a/desktop/save_pdf.c +++ b/desktop/save_pdf.c @@ -62,7 +62,7 @@ #include "utils/nsoption.h" #include "netsurf/bitmap.h" -#include "desktop/plotters.h" +#include "netsurf/plotters.h" #include "desktop/print.h" #include "desktop/printer.h" diff --git a/desktop/scrollbar.c b/desktop/scrollbar.c index 740fd33ae..b9e963a26 100644 --- a/desktop/scrollbar.c +++ b/desktop/scrollbar.c @@ -34,7 +34,7 @@ #include "desktop/system_colour.h" #include "netsurf/mouse.h" #include "desktop/scrollbar.h" -#include "desktop/plotters.h" +#include "netsurf/plotters.h" #include "desktop/plot_style.h" diff --git a/desktop/selection.c b/desktop/selection.c index 7c1d15caa..b2c7837c5 100644 --- a/desktop/selection.c +++ b/desktop/selection.c @@ -39,7 +39,7 @@ #include "netsurf/mouse.h" #include "desktop/browser_private.h" -#include "desktop/plotters.h" +#include "netsurf/plotters.h" #include "desktop/save_text.h" #include "desktop/selection.h" #include "netsurf/clipboard.h" diff --git a/desktop/textarea.c b/desktop/textarea.c index 8c9efe14d..5d187091d 100644 --- a/desktop/textarea.c +++ b/desktop/textarea.c @@ -35,7 +35,7 @@ #include "netsurf/mouse.h" #include "desktop/textarea.h" #include "desktop/textinput.h" -#include "desktop/plotters.h" +#include "netsurf/plotters.h" #include "desktop/scrollbar.h" #include "netsurf/clipboard.h" #include "netsurf/layout.h" diff --git a/desktop/treeview.c b/desktop/treeview.c index ead0510b8..4fa0544c5 100644 --- a/desktop/treeview.c +++ b/desktop/treeview.c @@ -29,7 +29,7 @@ #include "desktop/system_colour.h" #include "desktop/knockout.h" -#include "desktop/plotters.h" +#include "netsurf/plotters.h" #include "desktop/textarea.h" #include "desktop/treeview.h" #include "netsurf/clipboard.h" -- cgit v1.2.3