Index: uspace/lib/gfx/include/gfx/bitmap.h
===================================================================
--- uspace/lib/gfx/include/gfx/bitmap.h	(revision 78a71936030962dcd5ed19c056644d59e3c7d9d1)
+++ uspace/lib/gfx/include/gfx/bitmap.h	(revision 78a71936030962dcd5ed19c056644d59e3c7d9d1)
@@ -0,0 +1,53 @@
+/*
+ * Copyright (c) 2019 Jiri Svoboda
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * - Redistributions of source code must retain the above copyright
+ *   notice, this list of conditions and the following disclaimer.
+ * - Redistributions in binary form must reproduce the above copyright
+ *   notice, this list of conditions and the following disclaimer in the
+ *   documentation and/or other materials provided with the distribution.
+ * - The name of the author may not be used to endorse or promote products
+ *   derived from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
+ * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+ * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
+ * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
+ * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
+ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+/** @addtogroup libgfx
+ * @{
+ */
+/**
+ * @file Bitmap
+ */
+
+#ifndef _GFX_BITMAP_H
+#define _GFX_BITMAP_H
+
+#include <errno.h>
+#include <types/gfx/context.h>
+#include <types/gfx/coord.h>
+#include <types/gfx/bitmap.h>
+
+extern errno_t gfx_bitmap_create(gfx_context_t *, gfx_bitmap_params_t *,
+     gfx_bitmap_alloc_t *, gfx_bitmap_t **);
+extern errno_t gfx_bitmap_delete(gfx_bitmap_t *);
+extern errno_t gfx_bitmap_render(gfx_bitmap_t *, gfx_rect_t *, gfx_coord2_t *);
+extern errno_t gfx_bitmap_get_alloc(gfx_bitmap_t *, gfx_bitmap_alloc_t *);
+
+#endif
+
+/** @}
+ */
Index: uspace/lib/gfx/include/types/gfx/bitmap.h
===================================================================
--- uspace/lib/gfx/include/types/gfx/bitmap.h	(revision 78a71936030962dcd5ed19c056644d59e3c7d9d1)
+++ uspace/lib/gfx/include/types/gfx/bitmap.h	(revision 78a71936030962dcd5ed19c056644d59e3c7d9d1)
@@ -0,0 +1,65 @@
+/*
+ * Copyright (c) 2019 Jiri Svoboda
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * - Redistributions of source code must retain the above copyright
+ *   notice, this list of conditions and the following disclaimer.
+ * - Redistributions in binary form must reproduce the above copyright
+ *   notice, this list of conditions and the following disclaimer in the
+ *   documentation and/or other materials provided with the distribution.
+ * - The name of the author may not be used to endorse or promote products
+ *   derived from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
+ * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+ * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
+ * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
+ * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
+ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+/** @addtogroup libgfx
+ * @{
+ */
+/**
+ * @file Color types
+ */
+
+#ifndef _GFX_TYPES_BITMAP_H
+#define _GFX_TYPES_BITMAP_H
+
+#include <errno.h>
+#include <stddef.h>
+#include <types/gfx/coord.h>
+
+struct gfx_bitmap;
+typedef struct gfx_bitmap gfx_bitmap_t;
+
+/** Bitmap parameters */
+typedef struct {
+	/** Rectangle represented in pixel array */
+	gfx_rect_t rect;
+} gfx_bitmap_params_t;
+
+/** Bitmap allocation info */
+typedef struct {
+	/** Byte offset from one successive line to the next */
+	int pitch;
+	/** Byte offset of first pixel */
+	size_t off0;
+	/** Pixel array */
+	void *pixels;
+} gfx_bitmap_alloc_t;
+
+#endif
+
+/** @}
+ */
Index: uspace/lib/gfx/include/types/gfx/ops/context.h
===================================================================
--- uspace/lib/gfx/include/types/gfx/ops/context.h	(revision a3f63ac154a8851b99a2cdc01fb73050f4b9ca43)
+++ uspace/lib/gfx/include/types/gfx/ops/context.h	(revision 78a71936030962dcd5ed19c056644d59e3c7d9d1)
@@ -40,4 +40,5 @@
 
 #include <errno.h>
+#include <types/gfx/bitmap.h>
 #include <types/gfx/color.h>
 #include <types/gfx/coord.h>
@@ -50,4 +51,15 @@
 	/** Fill rectangle using the current drawing color */
 	errno_t (*fill_rect)(void *, gfx_rect_t *);
+	/** Create bitmap */
+	errno_t (*bitmap_create)(void *, gfx_bitmap_params_t *, void *,
+	    gfx_bitmap_t **);
+	/** Delete bitmap */
+	errno_t (*bitmap_delete)(void *, gfx_bitmap_t *);
+	/** Render bitmap */
+	errno_t (*bitmap_render)(void *, gfx_bitmap_t *, gfx_rect_t *,
+	    gfx_coord2_t *);
+	/** Get bitmap allocation info */
+	errno_t (*bitmap_get_alloc)(void *, gfx_bitmap_t *,
+	    gfx_bitmap_alloc_t *);
 } gfx_context_ops_t;
 
Index: uspace/lib/gfx/meson.build
===================================================================
--- uspace/lib/gfx/meson.build	(revision a3f63ac154a8851b99a2cdc01fb73050f4b9ca43)
+++ uspace/lib/gfx/meson.build	(revision 78a71936030962dcd5ed19c056644d59e3c7d9d1)
@@ -28,4 +28,5 @@
 
 src = files(
+	'src/bitmap.c',
 	'src/color.c',
 	'src/context.c',
Index: uspace/lib/gfx/private/bitmap.h
===================================================================
--- uspace/lib/gfx/private/bitmap.h	(revision 78a71936030962dcd5ed19c056644d59e3c7d9d1)
+++ uspace/lib/gfx/private/bitmap.h	(revision 78a71936030962dcd5ed19c056644d59e3c7d9d1)
@@ -0,0 +1,56 @@
+/*
+ * Copyright (c) 2019 Jiri Svoboda
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * - Redistributions of source code must retain the above copyright
+ *   notice, this list of conditions and the following disclaimer.
+ * - Redistributions in binary form must reproduce the above copyright
+ *   notice, this list of conditions and the following disclaimer in the
+ *   documentation and/or other materials provided with the distribution.
+ * - The name of the author may not be used to endorse or promote products
+ *   derived from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
+ * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+ * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
+ * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
+ * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
+ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+/** @addtogroup libgfx
+ * @{
+ */
+/**
+ * @file Bitmap structure
+ *
+ */
+
+#ifndef _GFX_PRIVATE_COLOR_H
+#define _GFX_PRIVATE_COLOR_H
+
+#include <types/gfx/context.h>
+
+/** Bitmap
+ *
+ * This is private to libgfx. It is not visible to clients nor backends.
+ */
+struct gfx_bitmap {
+	/** Graphics context of the bitmap */
+	gfx_context_t *gc;
+	/** GC-private data */
+	void *gc_priv;
+};
+
+#endif
+
+/** @}
+ */
Index: uspace/lib/gfx/private/color.h
===================================================================
--- uspace/lib/gfx/private/color.h	(revision a3f63ac154a8851b99a2cdc01fb73050f4b9ca43)
+++ uspace/lib/gfx/private/color.h	(revision 78a71936030962dcd5ed19c056644d59e3c7d9d1)
@@ -38,6 +38,4 @@
 #define _GFX_PRIVATE_COLOR_H
 
-#include <types/gfx/ops/context.h>
-
 /** Actual structure of graphics color.
  *
Index: uspace/lib/gfx/src/bitmap.c
===================================================================
--- uspace/lib/gfx/src/bitmap.c	(revision 78a71936030962dcd5ed19c056644d59e3c7d9d1)
+++ uspace/lib/gfx/src/bitmap.c	(revision 78a71936030962dcd5ed19c056644d59e3c7d9d1)
@@ -0,0 +1,100 @@
+/*
+ * Copyright (c) 2019 Jiri Svoboda
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * - Redistributions of source code must retain the above copyright
+ *   notice, this list of conditions and the following disclaimer.
+ * - Redistributions in binary form must reproduce the above copyright
+ *   notice, this list of conditions and the following disclaimer in the
+ *   documentation and/or other materials provided with the distribution.
+ * - The name of the author may not be used to endorse or promote products
+ *   derived from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
+ * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+ * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
+ * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
+ * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
+ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+/** @addtogroup libgfx
+ * @{
+ */
+/**
+ * @file Bitmap
+ */
+
+#include <gfx/bitmap.h>
+#include <stdint.h>
+#include <stdlib.h>
+#include "../private/bitmap.h"
+#include "../private/context.h"
+
+/** Allocate bitmap in a graphics context.
+ *
+ * @param gc Graphic context
+ * @param params Bitmap parameters
+ * @param alloc Bitmap allocation info or @c NULL to let GC allocate
+ *               pixel storage
+ * @param rbitmap Place to store pointer to new bitmap
+ *
+ * @return EOK on success, EINVAL if parameters are invald,
+ *         ENOMEM if insufficient resources, EIO if grahic device connection
+ *         was lost
+ */
+errno_t gfx_bitmap_create(gfx_context_t *gc, gfx_bitmap_params_t *params,
+    gfx_bitmap_alloc_t *alloc, gfx_bitmap_t **rbitmap)
+{
+	return gc->ops->bitmap_create(gc->arg, params, alloc, rbitmap);
+}
+
+/** Delete bitmap from graphics context.
+ *
+ * @param bitmap Bitmap
+ *
+ * @return EOK on success, EIO if grahic device connection was lost
+ */
+errno_t gfx_bitmap_delete(gfx_bitmap_t *bitmap)
+{
+	return bitmap->gc->ops->bitmap_delete(bitmap->gc->arg, bitmap);
+}
+
+/** Render bitmap in graphics context.
+ *
+ * @param bitmap Bitmap
+ * @param srect Source rectangle or @c NULL to render entire bitmap
+ * @param offs Bitmap offset or @c NULL for zero offset
+ *
+ * @return EOK on success, EIO if grahic device connection was lost
+ */
+errno_t gfx_bitmap_render(gfx_bitmap_t *bitmap, gfx_rect_t *srect,
+    gfx_coord2_t *offs)
+{
+	return bitmap->gc->ops->bitmap_render(bitmap->gc->arg, bitmap,
+	    srect, offs);
+}
+
+/** Get bitmap allocation info.
+ *
+ * @param bitmap Bitmap
+ * @param alloc Allocation info structure to fill in
+ *
+ * @return EOK on success, EIO if grahic device connection was lost
+ */
+errno_t gfx_bitmap_get_alloc(gfx_bitmap_t *bitmap, gfx_bitmap_alloc_t *alloc)
+{
+	return bitmap->gc->ops->bitmap_get_alloc(bitmap->gc->arg, bitmap,
+	    alloc);
+}
+
+/** @}
+ */
