NetSurf
|
#include <stdio.h>
#include <stdbool.h>
#include <stdlib.h>
#include <string.h>
#include <libnsfb.h>
#include <libnsfb_plot.h>
#include <libnsfb_event.h>
#include <libnsfb_cursor.h>
#include "utils/utils.h"
#include "utils/log.h"
#include "utils/utf8.h"
#include "netsurf/browser_window.h"
#include "netsurf/plotters.h"
#include "netsurf/bitmap.h"
#include "framebuffer/gui.h"
#include "framebuffer/fbtk.h"
#include "framebuffer/framebuffer.h"
#include "framebuffer/font.h"
#include "framebuffer/bitmap.h"
Go to the source code of this file.
Functions | |
static nserror | framebuffer_plot_clip (const struct redraw_context *ctx, const struct rect *clip) |
Sets a clip rectangle for subsequent plot operations. More... | |
static nserror | framebuffer_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 | framebuffer_plot_disc (const struct redraw_context *ctx, const plot_style_t *style, int x, int y, int radius) |
Plots a circle. More... | |
static nserror | framebuffer_plot_line (const struct redraw_context *ctx, const plot_style_t *style, const struct rect *line) |
Plots a line. More... | |
static nserror | framebuffer_plot_rectangle (const struct redraw_context *ctx, const plot_style_t *style, const struct rect *nsrect) |
Plots a rectangle. More... | |
static nserror | framebuffer_plot_polygon (const struct redraw_context *ctx, const plot_style_t *style, const int *p, unsigned int n) |
Plot a polygon. More... | |
static nserror | framebuffer_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 | framebuffer_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 | framebuffer_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... | |
static bool | framebuffer_format_from_bpp (int bpp, enum nsfb_format_e *fmt) |
nsfb_t * | framebuffer_initialise (const char *fename, int width, int height, int bpp) |
bool | framebuffer_resize (nsfb_t *nsfb, int width, int height, int bpp) |
void | framebuffer_finalise (void) |
bool | framebuffer_set_cursor (struct fbtk_bitmap *bm) |
nsfb_t * | framebuffer_set_surface (nsfb_t *new_nsfb) |
Set framebuffer surface to render into. More... | |
Variables | |
static nsfb_t * | nsfb |
const struct plotter_table | fb_plotters |
framebuffer plot operation table More... | |
void framebuffer_finalise | ( | void | ) |
Definition at line 638 of file framebuffer.c.
References nsfb.
Referenced by gui_quit().
|
static |
Definition at line 539 of file framebuffer.c.
References NSLOG.
Referenced by framebuffer_initialise(), and framebuffer_resize().
nsfb_t * framebuffer_initialise | ( | const char * | fename, |
int | width, | ||
int | height, | ||
int | bpp | ||
) |
Definition at line 577 of file framebuffer.c.
References fename, framebuffer_format_from_bpp(), height, nsfb, NSLOG, and width.
Referenced by main().
|
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 89 of file framebuffer.c.
References plot_style_s::fill_colour, NSERROR_INVALID, NSERROR_OK, and nsfb.
|
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 |
TODO: Currently using top left pixel. Maybe centre pixel or average value would be better.
Definition at line 304 of file framebuffer.c.
References BITMAPF_REPEAT_X, BITMAPF_REPEAT_Y, framebuffer_bitmap_get_opaque(), height, NSERROR_INVALID, NSERROR_OK, nsfb, and width.
|
static |
Sets a clip rectangle for subsequent plot operations.
ctx | The current redraw context. |
clip | The rectangle to limit all subsequent plot operations within. |
Definition at line 57 of file framebuffer.c.
References clip(), NSERROR_INVALID, NSERROR_OK, and nsfb.
|
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 113 of file framebuffer.c.
References plot_style_s::fill_colour, plot_style_s::fill_type, NSERROR_OK, nsfb, PLOT_OP_TYPE_NONE, plot_style_s::stroke_colour, and plot_style_s::stroke_type.
|
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 |
Definition at line 146 of file framebuffer.c.
References line(), NSERROR_OK, nsfb, PLOT_OP_TYPE_DASH, PLOT_OP_TYPE_DOT, PLOT_OP_TYPE_NONE, plot_style_fixed_to_int, plot_style_s::stroke_colour, plot_style_s::stroke_type, plot_style_s::stroke_width, rect::x0, rect::x1, rect::y0, and rect::y1.
|
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 268 of file framebuffer.c.
References NSERROR_OK, and NSLOG.
|
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 242 of file framebuffer.c.
References plot_style_s::fill_colour, NSERROR_INVALID, NSERROR_OK, and nsfb.
|
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 |
Definition at line 193 of file framebuffer.c.
References plot_style_s::fill_colour, plot_style_s::fill_type, NSERROR_OK, nsfb, PLOT_OP_TYPE_DASH, PLOT_OP_TYPE_DOT, PLOT_OP_TYPE_NONE, plot_style_fixed_to_int, plot_style_s::stroke_colour, plot_style_s::stroke_type, plot_style_s::stroke_width, 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 478 of file framebuffer.c.
References codepoint_displayable, FB_FONT_HEIGHT, FB_FONT_PITCH, FB_FONT_WIDTH, fb_get_font_size(), fb_get_font_style(), fb_get_glyph(), plot_font_style::foreground, NSERROR_OK, nsfb, text(), utf8_next(), and utf8_to_ucs4().
bool framebuffer_resize | ( | nsfb_t * | nsfb, |
int | width, | ||
int | height, | ||
int | bpp | ||
) |
Definition at line 619 of file framebuffer.c.
References framebuffer_format_from_bpp(), height, nsfb, NSLOG, and width.
Referenced by gui_resize().
bool framebuffer_set_cursor | ( | struct fbtk_bitmap * | bm | ) |
Definition at line 644 of file framebuffer.c.
References fbtk_bitmap::height, fbtk_bitmap::hot_x, fbtk_bitmap::hot_y, nsfb, fbtk_bitmap::pixdata, and fbtk_bitmap::width.
Referenced by fb_url_move(), gui_window_set_pointer(), main(), and set_ptr_default_move().
nsfb_t * framebuffer_set_surface | ( | nsfb_t * | new_nsfb | ) |
Set framebuffer surface to render into.
Definition at line 649 of file framebuffer.c.
References nsfb.
Referenced by bitmap_render().
const struct plotter_table fb_plotters |
framebuffer plot operation table
Definition at line 525 of file framebuffer.c.
Referenced by bitmap_render(), fb_local_history_draw(), fb_redraw(), fb_redraw_text(), and fb_redraw_text_button().
|
static |
Definition at line 45 of file framebuffer.c.
Referenced by do_redraw(), fb_pan(), fb_redraw(), fb_redraw_bitmap(), fb_redraw_fill(), fb_redraw_text(), fb_redraw_window(), framebuffer_finalise(), framebuffer_initialise(), framebuffer_plot_arc(), framebuffer_plot_bitmap(), framebuffer_plot_clip(), framebuffer_plot_disc(), framebuffer_plot_line(), framebuffer_plot_polygon(), framebuffer_plot_rectangle(), framebuffer_plot_text(), framebuffer_resize(), framebuffer_set_cursor(), framebuffer_set_surface(), gui_resize(), and main().