mirror of
https://github.com/netsurf-browser/netsurf
synced 2025-01-17 08:09:20 +03:00
Add bitmap_save() handler for nsgtk bitmaps. Saves in PNG format.
svn path=/trunk/netsurf/; revision=3437
This commit is contained in:
parent
c42e0bf350
commit
3e3a9efd00
@ -46,6 +46,7 @@ struct bitmap {
|
|||||||
struct bitmap *bitmap_create(int width, int height, unsigned int state)
|
struct bitmap *bitmap_create(int width, int height, unsigned int state)
|
||||||
{
|
{
|
||||||
struct bitmap *bmp = malloc(sizeof(struct bitmap));
|
struct bitmap *bmp = malloc(sizeof(struct bitmap));
|
||||||
|
|
||||||
bmp->primary = gdk_pixbuf_new(GDK_COLORSPACE_RGB, true, 8,
|
bmp->primary = gdk_pixbuf_new(GDK_COLORSPACE_RGB, true, 8,
|
||||||
width, height);
|
width, height);
|
||||||
bmp->pretile_x = bmp->pretile_y = bmp->pretile_xy = NULL;
|
bmp->pretile_x = bmp->pretile_y = bmp->pretile_xy = NULL;
|
||||||
@ -159,6 +160,14 @@ void bitmap_destroy(struct bitmap *bitmap)
|
|||||||
|
|
||||||
bool bitmap_save(struct bitmap *bitmap, const char *path)
|
bool bitmap_save(struct bitmap *bitmap, const char *path)
|
||||||
{
|
{
|
||||||
|
GError *err = NULL;
|
||||||
|
|
||||||
|
gdk_pixbuf_save(bitmap->primary, path, "png", &err, NULL);
|
||||||
|
|
||||||
|
if (err == NULL)
|
||||||
|
/* TODO: report an error here */
|
||||||
|
return false;
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user