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]);
422 const float transform[6])
425 cairo_matrix_t old_ctm, n_ctm;
431 NSLOG(netsurf, INFO,
"Path does not start with move");
443 n_ctm.xx = transform[0];
444 n_ctm.yx = transform[1];
445 n_ctm.xy = transform[2];
446 n_ctm.yy = transform[3];
447 n_ctm.x0 = transform[4] + old_ctm.x0;
448 n_ctm.y0 = transform[5] + old_ctm.y0;
453 for (i = 0; i < n; ) {
469 NSLOG(netsurf, INFO,
"bad path command %f", p[i]);
537 GdkRectangle cliprect_bitmap;
538 cairo_surface_t *img_surface;
539 int img_width, img_height;
552 if (cliprect_bitmap.width >
width) {
553 cliprect_bitmap.width =
width;
555 if (cliprect_bitmap.x < x) {
556 cliprect_bitmap.x = x;
557 cliprect_bitmap.width -= x - cliprect_bitmap.x;
561 if (cliprect_bitmap.height >
height) {
562 cliprect_bitmap.height =
height;
564 if (cliprect_bitmap.y < y) {
565 cliprect_bitmap.y = y;
566 cliprect_bitmap.height -= y - cliprect_bitmap.y;
571 if (cliprect_bitmap.width <= 0 || cliprect_bitmap.height <= 0) {
578 img_width = cairo_image_surface_get_width(img_surface);
579 img_height = cairo_image_surface_get_height(img_surface);
582 if ((img_width ==
width) && (img_height ==
height)) {
584 cairo_set_source_surface(
current_cr, img_surface, x, y);
587 if (repeat_x || repeat_y) {
588 cairo_pattern_set_extend(
590 CAIRO_EXTEND_REPEAT);
597 cliprect_bitmap.width,
598 cliprect_bitmap.height);
602 double scale_x = (double)
width / img_width;
603 double scale_y = (double)
height / img_height;
609 cairo_set_source_surface(
current_cr, img_surface,
610 x / scale_x, y / scale_y);
613 if (repeat_x || repeat_y) {
614 cairo_pattern_set_extend(
616 CAIRO_EXTEND_REPEAT);
621 cliprect_bitmap.x / scale_x,
622 cliprect_bitmap.y / scale_y,
623 cliprect_bitmap.width / scale_x,
624 cliprect_bitmap.height / scale_y);
669 .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.