55 ((c & 0xff00) >> 8) / 255.0,
56 ((c & 0xff0000) >> 16) / 255.0,
76 double cdashes[] = { 1.0, 2.0 };
86 double cdashes[] = { 8.0, 2.0 };
149 int x,
int y,
int radius,
int angle1,
int angle2)
156 (angle1 + 90) * (
M_PI / 180),
157 (angle2 + 90) * (
M_PI / 180));
179 int x,
int y,
int radius)
287 cairo_line_to(
current_cr, x + 0.5, y + h - 1);
382 for (i = 1; i != n; i++) {
383 cairo_line_to(
current_cr, p[i * 2], p[i * 2 + 1]);
410 const float transform[6])
413 cairo_matrix_t old_ctm, n_ctm;
419 NSLOG(netsurf, INFO,
"Path does not start with move");
431 n_ctm.xx = transform[0];
432 n_ctm.yx = transform[1];
433 n_ctm.xy = transform[2];
434 n_ctm.yy = transform[3];
435 n_ctm.x0 = transform[4] + old_ctm.x0;
436 n_ctm.y0 = transform[5] + old_ctm.y0;
441 for (i = 0; i < n; ) {
457 NSLOG(netsurf, INFO,
"bad path command %f", p[i]);
525 GdkRectangle cliprect_bitmap;
526 cairo_surface_t *img_surface;
527 int img_width, img_height;
540 if (cliprect_bitmap.width >
width) {
541 cliprect_bitmap.width =
width;
543 if (cliprect_bitmap.x < x) {
544 cliprect_bitmap.x = x;
545 cliprect_bitmap.width -= x - cliprect_bitmap.x;
549 if (cliprect_bitmap.height >
height) {
550 cliprect_bitmap.height =
height;
552 if (cliprect_bitmap.y < y) {
553 cliprect_bitmap.y = y;
554 cliprect_bitmap.height -= y - cliprect_bitmap.y;
559 if (cliprect_bitmap.width <= 0 || cliprect_bitmap.height <= 0) {
566 img_width = cairo_image_surface_get_width(img_surface);
567 img_height = cairo_image_surface_get_height(img_surface);
570 if ((img_width ==
width) && (img_height ==
height)) {
572 cairo_set_source_surface(
current_cr, img_surface, x, y);
575 if (repeat_x || repeat_y) {
576 cairo_pattern_set_extend(
578 CAIRO_EXTEND_REPEAT);
585 cliprect_bitmap.width,
586 cliprect_bitmap.height);
590 double scale_x = (double)
width / img_width;
591 double scale_y = (double)
height / img_height;
597 cairo_set_source_surface(
current_cr, img_surface,
598 x / scale_x, y / scale_y);
601 if (repeat_x || repeat_y) {
602 cairo_pattern_set_extend(
604 CAIRO_EXTEND_REPEAT);
609 cliprect_bitmap.x / scale_x,
610 cliprect_bitmap.y / scale_y,
611 cliprect_bitmap.width / scale_x,
612 cliprect_bitmap.height / scale_y);
657 .option_knockout =
true
nserror
Enumeration of error codes.
@ NSERROR_INVALID
Invalid data.
bool nsfont_paint(const plot_font_style_t *fstyle, const char *string, size_t length, int x, int y)
Render a string.
Target independent plotting GTK+ interface.
static GdkRectangle cliprect
static nserror nsgtk_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.
const struct plotter_table nsgtk_plotters
GTK plotter table.
void nsgtk_plot_caret(int x, int y, int h)
Plot a caret.
static nserror nsgtk_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.
void nsgtk_set_colour(colour c)
Set cairo context colour to nsgtk colour.
static nserror nsgtk_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.
static nserror nsgtk_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.
static void nsgtk_set_dotted(void)
Set cairo context to dotted plot operation.
static nserror nsgtk_plot_line(const struct redraw_context *ctx, const plot_style_t *style, const struct rect *line)
Plots a line.
static nserror nsgtk_plot_polygon(const struct redraw_context *ctx, const plot_style_t *style, const int *p, unsigned int n)
Plot a polygon.
static nserror nsgtk_plot_disc(const struct redraw_context *ctx, const plot_style_t *style, int x, int y, int radius)
Plots a circle.
static nserror nsgtk_plot_rectangle(const struct redraw_context *ctx, const plot_style_t *style, const struct rect *rect)
Plots a rectangle.
static void nsgtk_set_solid(void)
Set cairo context to solid plot operation.
static nserror nsgtk_plot_clip(const struct redraw_context *ctx, const struct rect *clip)
Sets a clip rectangle for subsequent plot operations.
static void nsgtk_set_dashed(void)
Set cairo context to dashed plot operation.
static void nsgtk_set_line_width(plot_style_fixed width)
Set cairo context line width.
Target independent plotting interface.
unsigned long bitmap_flags_t
Interface to GTK layout handling using pango.
#define NSLOG(catname, level, logmsg, args...)
#define plot_style_fixed_to_double(v)
@ PLOT_OP_TYPE_NONE
No operation.
@ PLOT_OP_TYPE_DASH
Dashed plot.
@ PLOT_OP_TYPE_DOT
Dotted plot.
@ PLOT_OP_TYPE_SOLID
Solid colour.
#define NS_TRANSPARENT
Transparent colour value.
RISC OS wimp toolkit bitmap.
cairo_surface_t * surface
Plot style for stroke/fill plotters.
colour fill_colour
Colour of fill.
plot_style_fixed stroke_width
Width of stroke, in pixels.
plot_operation_type_t fill_type
Fill plot type.
colour stroke_colour
Colour of stroke.
plot_operation_type_t stroke_type
Stroke plot type.
Plotter operations table.
nserror(* clip)(const struct redraw_context *ctx, const struct rect *clip)
Sets a clip rectangle for subsequent plot operations.
uint32_t colour
Colour type: XBGR.
Option reading and saving interface.
static nserror line(const struct redraw_context *ctx, const plot_style_t *style, const struct rect *line)
Plots a line.
static nserror text(const struct redraw_context *ctx, const struct plot_font_style *fstyle, int x, int y, const char *text, size_t length)
Text plotting.
static nserror clip(const struct redraw_context *ctx, const struct rect *clip)
Sets a clip rectangle for subsequent plot operations.