26#define __STDBOOL_H__ 1
30#include <GraphicsDefs.h>
46#warning MAKE ME static
54#warning make patterns nicer
56 0x55, 0xaa, 0x55, 0xaa, 0x55, 0xaa, 0x55, 0xaa
59 0xcc, 0xcc, 0x33, 0x33, 0xcc, 0xcc, 0x33, 0x33
119 drawing_mode oldmode =
view->DrawingMode();
122 view->GetBlendingMode(&alpha, &func);
124 view->SetDrawingMode(B_OP_ALPHA);
125 view->SetBlendingMode(B_PIXEL_ALPHA, B_ALPHA_OVERLAY);
142 view->SetBlendingMode(alpha, func);
143 view->SetDrawingMode(oldmode);
156 pt.x = x * transform[0] + y * transform[1] + transform[4];
157 pt.y = x * transform[2] + y * transform[3] + transform[5];
173 return B_TRANSPARENT_32_BIT;
174 color.red = c & 0x0000ff;
175 color.green = (c & 0x00ff00) >> 8;
176 color.blue = (c & 0xff0000) >> 16;
185 view->SetHighColor(color);
204 BPoint end(x, y + h - 1);
205#if defined(__HAIKU__) || defined(B_BEOS_VERSION_DANO)
210 view->StrokeLine(start, end);
236 BRect
rect(ns_clip->
x0, ns_clip->
y0, ns_clip->
x1 - 1, ns_clip->
y1 - 1);
238 view->ConstrainClippingRegion(NULL);
240 view->ConstrainClippingRegion(&
clip);
268 int x,
int y,
int radius,
int angle1,
int angle2)
281 float angle = angle1;
282 float span = angle2 - angle1;
283 view->StrokeArc(center, radius, radius, angle, span);
306 int x,
int y,
int radius)
320 view->FillEllipse(center, radius, radius);
322 view->StrokeEllipse(center, radius, radius);
372 float pensize =
view->PenSize();
377 view->StrokeLine(start, end, pat);
379 view->SetPenSize(pensize);
403 const struct rect *nsrect)
416 BRect
rect(nsrect->
x0, nsrect->
y0, nsrect->
x1 - 1, nsrect->
y1 - 1);
449 float pensize =
view->PenSize();
452 BRect
rect(nsrect->
x0, nsrect->
y0, nsrect->
x1, nsrect->
y1);
455 view->SetPenSize(pensize);
497 for (i = 0; i < n; i++) {
498 points[i] = BPoint(p[2 * i] - 0.5, p[2 * i + 1] - 0.5);
529 const float transform[6])
539 NSLOG(netsurf, INFO,
"path doesn't start with a move");
543 for (i = 0; i < n; ) {
564 NSLOG(netsurf, INFO,
"bad path command %f", p[i]);
577 rgb_color old_high =
view->HighColor();
578 float old_pen =
view->PenSize();
580 view->MovePenTo(0, 0);
583 view->FillShape(&shape);
587 view->StrokeShape(&shape);
590 view->SetPenSize(old_pen);
591 view->SetHighColor(old_high);
632 int doneheight = 0, donewidth = 0;
638 if (!(repeat_x || repeat_y)) {
644 if (repeat_x && !repeat_y)
646 if (repeat_x && repeat_y)
648 if (!repeat_x && repeat_y)
653 width *= pretiled->Bounds().Width() + 1;
654 width /= primary->Bounds().Width() + 1;
655 height *= pretiled->Bounds().Height() + 1;
656 height /= primary->Bounds().Height() + 1;
671 view->GetClippingRegion(&clipreg);
682 while (doneheight < ((
int)
cliprect.bottom)) {
689 while (donewidth < (
cliprect.right)) {
758static void test_plotters(
void)
769 plot.line(
x0,
y0,
x1,
y1, 1, 0x0000ff00,
false,
false);
771 plot.line(
x0,
y0,
x1,
y1, 1, 0x0000ff00,
true,
false);
773 plot.line(
x0,
y0,
x1,
y1, 1, 0x0000ff00,
false,
true);
775 plot.line(
x0,
y0,
x1,
y1, 1, 0x0000ff00,
true,
true);
778 plot.fill(
x0,
y0,
x1,
y1, 0x00ff0000);
779 plot.rectangle(
x0+10,
y0+10,
x1-
x0+1,
y1-
y0+1, 2, 0x00ffff00,
true,
false);
788 plot.fill(
x0,
y0,
x1,
y1, 0x00000000);
789 plot.disc(
x1,
y1, 8, 0x000000ff,
false);
801#include <Application.h>
804class PTView :
public BView {
806 PTView(BRect frame) : BView(frame,
"view", B_FOLLOW_NONE, B_WILL_DRAW) {};
807 virtual ~PTView() {};
808 virtual void Draw(BRect update)
815extern "C" void test_plotters_main(
void);
816void test_plotters_main(
void)
818 BApplication app(
"application/x-vnd.NetSurf");
820 BRect frame(0,0,300,300);
821 PTView *
view =
new PTView(frame);
822 frame.OffsetBySelf(100,100);
823 BWindow *win =
new BWindow(frame,
"NetSurfPlotterTest", B_TITLED_WINDOW, B_QUIT_ON_WINDOW_CLOSE);
static struct s_view view
BBitmap * nsbeos_bitmap_get_pretile_xy(struct bitmap *bitmap)
The XY-pretiled image associated with this bitmap object.
BBitmap * nsbeos_bitmap_get_primary(struct bitmap *bitmap)
The primary image associated with this bitmap object.
BBitmap * nsbeos_bitmap_get_pretile_x(struct bitmap *bitmap)
The X-pretiled image associated with this bitmap object.
BBitmap * nsbeos_bitmap_get_pretile_y(struct bitmap *bitmap)
The Y-pretiled image associated with this bitmap object.
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.
Beos font layout handling interface.
Target independent plotting (BeOS interface).
static GdkRectangle cliprect
#define B_DOCUMENT_TEXT_COLOR
nserror beos_warn_user(const char *warning, const char *detail)
Display a warning for a serious problem (eg memory exhaustion).
Target independent plotting interface.
unsigned long bitmap_flags_t
#define NSLOG(catname, level, logmsg, args...)
NetSurf URL handling (interface).
#define plot_style_fixed_to_float(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.
BView * nsbeos_current_gc_lock(void)
static nserror nsbeos_plot_clip(const struct redraw_context *ctx, const struct rect *ns_clip)
Sets a clip rectangle for subsequent plot operations.
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.
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.
const struct plotter_table nsbeos_plotters
beos plotter operation table
rgb_color nsbeos_rgb_colour(colour c)
static const pattern kDashedPattern
void nsbeos_current_gc_set(BView *view)
static nserror nsbeos_plot_line(const struct redraw_context *ctx, const plot_style_t *style, const struct rect *line)
Plots a line.
static const pattern kDottedPattern
static nserror nsbeos_plot_disc(const struct redraw_context *ctx, const plot_style_t *style, int x, int y, int radius)
Plots a circle.
static const rgb_color kBlackColor
void nsbeos_plot_caret(int x, int y, int h)
Plot a caret.
static BPoint transform_pt(float x, float y, const float transform[6])
static nserror nsbeos_plot_polygon(const struct redraw_context *ctx, const plot_style_t *style, const int *p, unsigned int n)
Plot a polygon.
void nsbeos_set_colour(colour c)
void nsbeos_current_gc_unlock(void)
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.
static nserror nsbeos_plot_rectangle(const struct redraw_context *ctx, const plot_style_t *style, const struct rect *nsrect)
Plots a rectangle.
static nserror nsbeos_plot_bbitmap(int x, int y, int width, int height, BBitmap *b, colour bg)
BView * nsbeos_current_gc(void)
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.
RISC OS wimp toolkit bitmap.
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.
uint32_t colour
Colour type: XBGR.
struct rect rect
Rectangle coordinates.
Option reading and saving interface.
Interface to a number of general purpose functionality.
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.