NetSurf
bitmap.h
Go to the documentation of this file.
1/*
2 * Copyright 2004 James Bursa <bursa@users.sourceforge.net>
3 *
4 * This file is part of NetSurf, http://www.netsurf-browser.org/
5 *
6 * NetSurf is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License as published by
8 * the Free Software Foundation; version 2 of the License.
9 *
10 * NetSurf is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU General Public License for more details.
14 *
15 * You should have received a copy of the GNU General Public License
16 * along with this program. If not, see <http://www.gnu.org/licenses/>.
17 */
18
19#ifndef _NETSURF_RISCOS_BITMAP_H_
20#define _NETSURF_RISCOS_BITMAP_H_
21
22#include "netsurf/bitmap.h"
23
24struct osspriteop_area;
25struct osspriteop_header;
26struct hlcache_handle;
27struct bitmap;
28
29/** bitmap operations table */
31
32/** save with full alpha channel (if not opaque) */
33#define BITMAP_SAVE_FULL_ALPHA (1 << 0)
34
35/**
36 * RISC OS wimp toolkit bitmap.
37 */
38struct bitmap {
39 int width; /**< width of bitmap */
40 int height; /**< height of bitmap */
41
42 bool opaque; /**< Whether the bitmap is opaque. */
43 bool clear; /**< Whether the bitmap should be initialised to zeros. */
44
45 struct osspriteop_area *sprite_area; /**< Uncompressed data, or NULL */
46};
47
48/**
49 * Convert bitmap to 8bpp sprite.
50 *
51 * \param bitmap the bitmap to convert.
52 * \return The converted sprite.
53 */
54struct osspriteop_area *riscos_bitmap_convert_8bpp(struct bitmap *bitmap);
55
56/**
57 * Render content into bitmap.
58 *
59 * \param bitmap the bitmap to draw to
60 * \param content content structure to render
61 * \return true on success and bitmap updated else false
62 */
64
65/**
66 * Overlay a sprite onto the given bitmap
67 *
68 * \param bitmap bitmap object
69 * \param s 8bpp sprite to be overlayed onto bitmap
70 */
71void riscos_bitmap_overlay_sprite(struct bitmap *bitmap, const struct osspriteop_header *s);
72
73/**
74 * Create a bitmap.
75 *
76 * \param width width of image in pixels
77 * \param height height of image in pixels
78 * \param flags flags for bitmap creation.
79 * \return an opaque struct bitmap, or NULL on memory exhaustion
80 */
81void *riscos_bitmap_create(int width, int height, enum gui_bitmap_flags flags);
82
83/**
84 * Free a bitmap.
85 *
86 * \param vbitmap a bitmap, as returned by bitmap_create()
87 */
88void riscos_bitmap_destroy(void *vbitmap);
89
90/**
91 * Return a pointer to the pixel data in a bitmap.
92 *
93 * The pixel data is packed as BITMAP_FORMAT, possibly with padding at
94 * the end of rows. The width of a row in bytes is given by
95 * riscos_bitmap_get_rowstride().
96 *
97 * \param vbitmap A bitmap as returned by riscos_bitmap_create()
98 * \return pointer to the pixel buffer
99 */
100unsigned char *riscos_bitmap_get_buffer(void *vbitmap);
101
102/**
103 * Gets whether a bitmap should be plotted opaque
104 *
105 * \param vbitmap A bitmap, as returned by riscos_bitmap_create()
106 */
107bool riscos_bitmap_get_opaque(void *vbitmap);
108
109/**
110 * Save a bitmap in the platform's native format.
111 *
112 * \param vbitmap a bitmap, as returned by bitmap_create()
113 * \param path pathname for file
114 * \param flags modify the behaviour of the save
115 * \return true on success, false on error and error reported
116 */
117bool riscos_bitmap_save(void *vbitmap, const char *path, unsigned flags);
118
119#endif
nserror
Enumeration of error codes.
Definition: errors.h:29
void riscos_bitmap_destroy(void *vbitmap)
Free a bitmap.
Definition: bitmap.c:202
unsigned char * riscos_bitmap_get_buffer(void *vbitmap)
Return a pointer to the pixel data in a bitmap.
Definition: bitmap.c:145
struct gui_bitmap_table * riscos_bitmap_table
bitmap operations table
Definition: bitmap.c:818
bool riscos_bitmap_save(void *vbitmap, const char *path, unsigned flags)
Save a bitmap in the platform's native format.
Definition: bitmap.c:218
bool riscos_bitmap_get_opaque(void *vbitmap)
Gets whether a bitmap should be plotted opaque.
Definition: bitmap.c:193
void * riscos_bitmap_create(int width, int height, enum gui_bitmap_flags flags)
Create a bitmap.
Definition: bitmap.c:125
nserror riscos_bitmap_render(struct bitmap *bitmap, struct hlcache_handle *content)
Render content into bitmap.
Definition: bitmap.c:724
struct osspriteop_area * riscos_bitmap_convert_8bpp(struct bitmap *bitmap)
Convert bitmap to 8bpp sprite.
Definition: bitmap.c:633
void riscos_bitmap_overlay_sprite(struct bitmap *bitmap, const struct osspriteop_header *s)
Overlay a sprite onto the given bitmap.
Generic bitmap handling interface.
gui_bitmap_flags
Bitmap creation flags.
Definition: bitmap.h:36
int width
Definition: gui.c:159
int height
Definition: gui.c:160
RISC OS wimp toolkit bitmap.
Definition: bitmap.c:68
bool clear
Whether the bitmap should be initialised to zeros.
Definition: bitmap.h:43
struct osspriteop_area * sprite_area
Uncompressed data, or NULL.
Definition: bitmap.h:45
int width
width of bitmap
Definition: bitmap.c:69
int height
height of bitmap
Definition: bitmap.c:70
bool opaque
Whether the bitmap is opaque.
Definition: bitmap.c:74
Content which corresponds to a single URL.
Bitmap operations.
Definition: bitmap.h:125
High-level cache handle.
Definition: hlcache.c:66
static nserror path(const struct redraw_context *ctx, const plot_style_t *pstyle, const float *p, unsigned int n, const float transform[6])
Plots a path.
Definition: plot.c:821