NetSurf
|
BeOS/Haiku implementation target independent plotting. More...
#include <math.h>
#include <BeBuild.h>
#include <Bitmap.h>
#include <GraphicsDefs.h>
#include <Region.h>
#include <View.h>
#include <Shape.h>
#include "utils/log.h"
#include "utils/utils.h"
#include "utils/nsoption.h"
#include "utils/nsurl.h"
#include "netsurf/plotters.h"
#include "beos/font.h"
#include "beos/gui.h"
#include "beos/plotters.h"
#include "beos/bitmap.h"
Go to the source code of this file.
Macros | |
#define | __STDBOOL_H__ 1 |
Functions | |
BView * | nsbeos_current_gc (void) |
BView * | nsbeos_current_gc_lock (void) |
void | nsbeos_current_gc_unlock (void) |
void | nsbeos_current_gc_set (BView *view) |
static nserror | nsbeos_plot_bbitmap (int x, int y, int width, int height, BBitmap *b, colour bg) |
static BPoint | transform_pt (float x, float y, const float transform[6]) |
rgb_color | nsbeos_rgb_colour (colour c) |
void | nsbeos_set_colour (colour c) |
void | nsbeos_plot_caret (int x, int y, int h) |
Plot a caret. More... | |
static nserror | nsbeos_plot_clip (const struct redraw_context *ctx, const struct rect *ns_clip) |
Sets a clip rectangle for subsequent plot operations. More... | |
static nserror | nsbeos_plot_arc (const struct redraw_context *ctx, const plot_style_t *style, int x, int y, int radius, int angle1, int angle2) |
Plots an arc. More... | |
static nserror | nsbeos_plot_disc (const struct redraw_context *ctx, const plot_style_t *style, int x, int y, int radius) |
Plots a circle. More... | |
static nserror | nsbeos_plot_line (const struct redraw_context *ctx, const plot_style_t *style, const struct rect *line) |
Plots a line. More... | |
static nserror | nsbeos_plot_rectangle (const struct redraw_context *ctx, const plot_style_t *style, const struct rect *nsrect) |
Plots a rectangle. More... | |
static nserror | nsbeos_plot_polygon (const struct redraw_context *ctx, const plot_style_t *style, const int *p, unsigned int n) |
Plot a polygon. More... | |
static nserror | nsbeos_plot_path (const struct redraw_context *ctx, const plot_style_t *pstyle, const float *p, unsigned int n, const float transform[6]) |
Plots a path. More... | |
static nserror | nsbeos_plot_bitmap (const struct redraw_context *ctx, struct bitmap *bitmap, int x, int y, int width, int height, colour bg, bitmap_flags_t flags) |
Plot a bitmap. More... | |
static nserror | nsbeos_plot_text (const struct redraw_context *ctx, const struct plot_font_style *fstyle, int x, int y, const char *text, size_t length) |
Text plotting. More... | |
Variables | |
BView * | current_view |
static const pattern | kDottedPattern |
static const pattern | kDashedPattern |
static const rgb_color | kBlackColor |
const struct plotter_table | nsbeos_plotters |
beos plotter operation table More... | |
BeOS/Haiku implementation target independent plotting.
Definition in file plotters.cpp.
#define __STDBOOL_H__ 1 |
Definition at line 26 of file plotters.cpp.
BView * nsbeos_current_gc | ( | void | ) |
Definition at line 70 of file plotters.cpp.
References current_view.
Referenced by bitmap_render(), nsbeos_plot_arc(), nsbeos_plot_bbitmap(), nsbeos_plot_bitmap(), nsbeos_plot_caret(), nsbeos_plot_clip(), nsbeos_plot_disc(), nsbeos_plot_line(), nsbeos_plot_path(), nsbeos_plot_polygon(), nsbeos_plot_rectangle(), nsbeos_set_colour(), and nsfont_paint().
BView * nsbeos_current_gc_lock | ( | void | ) |
Definition at line 76 of file plotters.cpp.
References current_view, and view.
void nsbeos_current_gc_set | ( | BView * | view | ) |
Definition at line 93 of file plotters.cpp.
References current_view, and view.
Referenced by bitmap_render(), gui_window_remove_caret(), nsbeos_redraw_caret(), and nsbeos_window_expose_event().
void nsbeos_current_gc_unlock | ( | void | ) |
Definition at line 85 of file plotters.cpp.
References current_view.
|
static |
Plots an arc.
plot an arc segment around (x,y), anticlockwise from angle1 to angle2. Angles are measured anticlockwise from horizontal, in degrees.
ctx | The current redraw context. |
style | Style controlling the arc plot. |
x | The x coordinate of the arc. |
y | The y coordinate of the arc. |
radius | The radius of the arc. |
angle1 | The start angle of the arc. |
angle2 | The finish angle of the arc. |
Definition at line 266 of file plotters.cpp.
References beos_warn_user(), plot_style_s::fill_colour, nsbeos_current_gc(), nsbeos_set_colour(), NSERROR_INVALID, NSERROR_OK, and view.
|
static |
Definition at line 101 of file plotters.cpp.
References beos_warn_user(), height, nsbeos_current_gc(), NSERROR_INVALID, NSERROR_OK, view, and width.
Referenced by nsbeos_plot_bitmap().
|
static |
Plot a 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.
ctx | The current redraw context. |
bitmap | The bitmap to plot |
x | The x coordinate to plot the bitmap |
y | The y coordiante to plot the bitmap |
width | The width of area to plot the bitmap into |
height | The height of area to plot the bitmap into |
bg | the background colour to alpha blend into |
flags | the flags controlling the type of plot operation |
Definition at line 624 of file plotters.cpp.
References beos_warn_user(), BITMAPF_REPEAT_X, BITMAPF_REPEAT_Y, cliprect, height, nsbeos_bitmap_get_pretile_x(), nsbeos_bitmap_get_pretile_xy(), nsbeos_bitmap_get_pretile_y(), nsbeos_bitmap_get_primary(), nsbeos_current_gc(), nsbeos_plot_bbitmap(), NSERROR_INVALID, NSERROR_OK, view, and width.
void nsbeos_plot_caret | ( | int | x, |
int | y, | ||
int | h | ||
) |
Plot a caret.
It is assumed that the plotters have been set up.
Definition at line 194 of file plotters.cpp.
References B_DOCUMENT_TEXT_COLOR, kBlackColor, nsbeos_current_gc(), and view.
Referenced by nsbeos_window_expose_event().
|
static |
Sets a clip rectangle for subsequent plot operations.
ctx | The current redraw context. |
ns_clip | The rectangle to limit all subsequent plot operations within. |
Definition at line 225 of file plotters.cpp.
References beos_warn_user(), clip(), nsbeos_current_gc(), NSERROR_INVALID, NSERROR_OK, view, rect::x0, rect::x1, rect::y0, and rect::y1.
|
static |
Plots a circle.
Plot a circle centered on (x,y), which is optionally filled.
ctx | The current redraw context. |
style | Style controlling the circle plot. |
x | x coordinate of circle centre. |
y | y coordinate of circle centre. |
radius | circle radius. |
Definition at line 304 of file plotters.cpp.
References beos_warn_user(), plot_style_s::fill_colour, plot_style_s::fill_type, nsbeos_current_gc(), nsbeos_set_colour(), NSERROR_INVALID, NSERROR_OK, PLOT_OP_TYPE_NONE, and view.
|
static |
Plots a line.
plot a line from (x0,y0) to (x1,y1). Coordinates are at centre of line width/thickness.
ctx | The current redraw context. |
style | Style controlling the line plot. |
line | A rectangle defining the line to be drawn |
< Solid colour
< Doted plot
< dashed plot
Definition at line 342 of file plotters.cpp.
References beos_warn_user(), kDashedPattern, kDottedPattern, line(), nsbeos_current_gc(), nsbeos_set_colour(), NSERROR_OK, PLOT_OP_TYPE_DASH, PLOT_OP_TYPE_DOT, PLOT_OP_TYPE_SOLID, plot_style_fixed_to_float, plot_style_s::stroke_colour, plot_style_s::stroke_type, plot_style_s::stroke_width, and view.
|
static |
Plots a path.
Path plot consisting of cubic Bezier curves. Line and fill colour is controlled by the plot style.
ctx | The current redraw context. |
pstyle | Style controlling the path plot. |
p | elements of path |
n | nunber of elements on path |
transform | A transform to apply to the path. |
Definition at line 525 of file plotters.cpp.
References plot_style_s::fill_colour, NS_TRANSPARENT, nsbeos_current_gc(), nsbeos_rgb_colour(), NSERROR_INVALID, NSERROR_OK, NSLOG, plot_style_fixed_to_float, PLOTTER_PATH_BEZIER, PLOTTER_PATH_CLOSE, PLOTTER_PATH_LINE, PLOTTER_PATH_MOVE, plot_style_s::stroke_colour, plot_style_s::stroke_width, transform_pt(), and view.
|
static |
Plot a 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.
ctx | The current redraw context. |
style | Style controlling the polygon plot. |
p | verticies of polygon |
n | number of verticies. |
Definition at line 479 of file plotters.cpp.
References beos_warn_user(), plot_style_s::fill_colour, NS_TRANSPARENT, nsbeos_current_gc(), nsbeos_set_colour(), NSERROR_INVALID, NSERROR_OK, and view.
|
static |
Plots a rectangle.
The rectangle can be filled an outline or both controlled by the plot style The line can be solid, dotted or dashed. Top left corner at (x0,y0) and rectangle has given width and height.
ctx | The current redraw context. |
style | Style controlling the rectangle plot. |
nsrect | A rectangle defining the line to be drawn |
< Solid colour
< Doted plot
< dashed plot
Definition at line 401 of file plotters.cpp.
References beos_warn_user(), plot_style_s::fill_colour, plot_style_s::fill_type, kDashedPattern, kDottedPattern, nsbeos_current_gc(), nsbeos_set_colour(), NSERROR_INVALID, NSERROR_OK, PLOT_OP_TYPE_DASH, PLOT_OP_TYPE_DOT, PLOT_OP_TYPE_NONE, PLOT_OP_TYPE_SOLID, plot_style_fixed_to_float, plot_style_s::stroke_colour, plot_style_s::stroke_type, plot_style_s::stroke_width, view, rect::x0, rect::x1, rect::y0, and rect::y1.
|
static |
Text plotting.
ctx | The current redraw context. |
fstyle | plot style for this text |
x | x coordinate |
y | y coordinate |
text | UTF-8 string to plot |
length | length of string, in bytes |
Definition at line 721 of file plotters.cpp.
References NSERROR_INVALID, NSERROR_OK, nsfont_paint(), and text().
rgb_color nsbeos_rgb_colour | ( | colour | c | ) |
Definition at line 169 of file plotters.cpp.
References NS_TRANSPARENT.
Referenced by gui_set_clipboard(), nsbeos_plot_path(), nsbeos_set_colour(), and nsfont_paint().
void nsbeos_set_colour | ( | colour | c | ) |
Definition at line 181 of file plotters.cpp.
References nsbeos_current_gc(), nsbeos_rgb_colour(), and view.
Referenced by nsbeos_plot_arc(), nsbeos_plot_disc(), nsbeos_plot_line(), nsbeos_plot_polygon(), and nsbeos_plot_rectangle().
|
static |
Definition at line 151 of file plotters.cpp.
Referenced by nsbeos_plot_path().
BView* current_view |
Definition at line 47 of file plotters.cpp.
Referenced by nsbeos_current_gc(), nsbeos_current_gc_lock(), nsbeos_current_gc_set(), and nsbeos_current_gc_unlock().
|
static |
Definition at line 62 of file plotters.cpp.
Referenced by nsbeos_plot_caret().
|
static |
Definition at line 58 of file plotters.cpp.
Referenced by nsbeos_plot_line(), and nsbeos_plot_rectangle().
|
static |
Definition at line 55 of file plotters.cpp.
Referenced by nsbeos_plot_line(), and nsbeos_plot_rectangle().
const struct plotter_table nsbeos_plotters |
beos plotter operation table
Definition at line 739 of file plotters.cpp.
Referenced by bitmap_render(), and nsbeos_window_expose_event().