60 gbitmap = calloc(1,
sizeof(
struct bitmap));
61 if (gbitmap != NULL) {
67 if (cairo_surface_status(gbitmap->
surface) != CAIRO_STATUS_SUCCESS) {
68 cairo_surface_destroy(gbitmap->
surface);
121 cairo_surface_flush(gbitmap->
surface);
122 pixels = cairo_image_surface_get_data(gbitmap->
surface);
124 return (
unsigned char *) pixels;
139 return cairo_image_surface_get_stride(gbitmap->
surface);
153 if (gbitmap->
surface != NULL) {
154 cairo_surface_destroy(gbitmap->
surface);
157 cairo_surface_destroy(gbitmap->
scsurface);
174 cairo_surface_mark_dirty(gbitmap->
surface);
183 return cairo_image_surface_get_width(gbitmap->
surface);
192 return cairo_image_surface_get_height(gbitmap->
surface);
208 gint dwidth, dheight;
212 .background_images =
true,
219 dwidth = cairo_image_surface_get_width(dsurface);
220 dheight = cairo_image_surface_get_height(dsurface);
232 cheight = ((cwidth * dheight) + (dwidth / 2)) / dwidth;
239 surface = cairo_surface_create_similar(dsurface, CAIRO_CONTENT_COLOR_ALPHA, cwidth, cheight);
241 if (cairo_surface_status(surface) != CAIRO_STATUS_SUCCESS) {
242 cairo_surface_destroy(surface);
255 cairo_t *cr = cairo_create(dsurface);
258 cairo_scale (cr, (
double)dwidth / cwidth, (
double)dheight / cheight);
259 cairo_set_source_surface (cr, surface, 0, 0);
265 cairo_pattern_set_extend(cairo_get_source(cr), CAIRO_EXTEND_REFLECT);
268 cairo_set_operator(cr, CAIRO_OPERATOR_SOURCE);
275 cairo_surface_destroy(surface);
nserror
Enumeration of error codes.
static void bitmap_set_opaque(void *vbitmap, bool opaque)
Sets whether a bitmap should be plotted opaque.
static struct gui_bitmap_table bitmap_table
static void bitmap_modified(void *vbitmap)
The bitmap image has changed, so flush any persistant cache.
static bool bitmap_get_opaque(void *vbitmap)
Gets whether a bitmap should be plotted opaque.
static nserror bitmap_render(struct bitmap *bitmap, struct hlcache_handle *content)
Render content into a bitmap.
struct gui_bitmap_table * nsgtk_bitmap_table
int nsgtk_bitmap_get_height(void *vbitmap)
static unsigned char * bitmap_get_buffer(void *vbitmap)
Return a pointer to the pixel data in a bitmap.
static size_t bitmap_get_rowstride(void *vbitmap)
Find the width of a pixel row in bytes.
static void * bitmap_create(int width, int height, enum gui_bitmap_flags flags)
Create a bitmap.
int nsgtk_bitmap_get_width(void *vbitmap)
static void bitmap_destroy(void *vbitmap)
Free a bitmap.
Target independent plotting GTK+ interface.
const struct plotter_table nsgtk_plotters
GTK plotter table.
Generic bitmap handling interface.
gui_bitmap_flags
Bitmap creation flags.
@ BITMAP_OPAQUE
image is opaque
Public content interface.
int content_get_width(struct hlcache_handle *h)
Retrieve width of content.
bool content_scaled_redraw(struct hlcache_handle *h, int width, int height, const struct redraw_context *ctx)
Redraw a content with scale set for horizontal fit.
Target independent plotting interface.
Interface to utility string handling.
RISC OS wimp toolkit bitmap.
cairo_surface_t * surface
cairo_surface_t * scsurface
bool opaque
Whether the bitmap is opaque.
Content which corresponds to a single URL.
void *(* create)(int width, int height, enum gui_bitmap_flags flags)
Create a new bitmap.
bool interactive
Redraw to show interactive features.
Interface to a number of general purpose functionality.