Index: uspace/lib/softrend/Makefile
===================================================================
--- uspace/lib/softrend/Makefile	(revision 6d5e378b28e2c858f3813b5d4d57fa46f709d753)
+++ uspace/lib/softrend/Makefile	(revision 6d5e378b28e2c858f3813b5d4d57fa46f709d753)
@@ -0,0 +1,41 @@
+#
+# Copyright (c) 2011 Petr Koupy
+# 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.
+#
+
+USPACE_PREFIX = ../..
+LIBRARY = libsoftrend
+SLIBRARY = libsoftrend.so.0.0
+LSONAME = libsoftrend.so0
+
+SOURCES = \
+	compose.c \
+	filter.c \
+	pixconv.c \
+	rectangle.c \
+	transform.c
+
+include $(USPACE_PREFIX)/Makefile.common
Index: uspace/lib/softrend/compose.c
===================================================================
--- uspace/lib/softrend/compose.c	(revision 6d5e378b28e2c858f3813b5d4d57fa46f709d753)
+++ uspace/lib/softrend/compose.c	(revision 6d5e378b28e2c858f3813b5d4d57fa46f709d753)
@@ -0,0 +1,115 @@
+/*
+ * Copyright (c) 2012 Petr Koupy
+ * 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 softrend
+ * @{
+ */
+/**
+ * @file
+ */
+
+#include "compose.h"
+
+pixel_t compose_clr(pixel_t fg, pixel_t bg)
+{
+	return 0;
+}
+
+pixel_t compose_src(pixel_t fg, pixel_t bg)
+{
+	return fg;
+}
+
+pixel_t compose_dst(pixel_t fg, pixel_t bg)
+{
+	return bg;
+}
+
+pixel_t compose_over(pixel_t fg, pixel_t bg)
+{
+	double mul;
+	double mul_cmp;
+
+	double res_a;
+	double res_r;
+	double res_g;
+	double res_b;
+
+	if (ALPHA(bg) == 255) {
+		res_a = 1;
+		mul = ((double) ALPHA(fg)) / 255.0;
+		mul_cmp = 1 - mul;
+	} else {
+		double fg_a = ((double) ALPHA(fg)) / 255.0;
+		double bg_a = ((double) ALPHA(bg)) / 255.0;
+
+		res_a = 1 - (1 - fg_a) * (1 - bg_a);
+		mul = fg_a / res_a;
+		mul_cmp = 1 - mul;
+	}
+
+	res_r = mul * ((double) RED(fg)) + mul_cmp * ((double) RED(bg));
+	res_g = mul * ((double) GREEN(fg)) + mul_cmp * ((double) GREEN(bg));
+	res_b = mul * ((double) BLUE(fg)) + mul_cmp * ((double) BLUE(bg));
+
+	return PIXEL((unsigned) (res_a * 255),
+	    (unsigned) res_r, (unsigned) res_g, (unsigned) res_b);
+}
+
+pixel_t compose_in(pixel_t fg, pixel_t bg)
+{
+	// TODO
+	return 0;
+}
+
+pixel_t compose_out(pixel_t fg, pixel_t bg)
+{
+	// TODO
+	return 0;
+}
+
+pixel_t compose_atop(pixel_t fg, pixel_t bg)
+{
+	// TODO
+	return 0;
+}
+
+pixel_t compose_xor(pixel_t fg, pixel_t bg)
+{
+	// TODO
+	return 0;
+}
+
+pixel_t compose_add(pixel_t fg, pixel_t bg)
+{
+	// TODO
+	return 0;
+}
+
+/** @}
+ */
Index: uspace/lib/softrend/compose.h
===================================================================
--- uspace/lib/softrend/compose.h	(revision 6d5e378b28e2c858f3813b5d4d57fa46f709d753)
+++ uspace/lib/softrend/compose.h	(revision 6d5e378b28e2c858f3813b5d4d57fa46f709d753)
@@ -0,0 +1,57 @@
+/*
+ * Copyright (c) 2012 Petr Koupy
+ * 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 softrend
+ * @{
+ */
+/**
+ * @file
+ */
+
+#ifndef SOFTREND_COMPOSE_H_
+#define SOFTREND_COMPOSE_H_
+
+#include <io/pixel.h>
+
+typedef pixel_t (*compose_t)(pixel_t, pixel_t);
+
+extern pixel_t compose_clr(pixel_t, pixel_t);
+extern pixel_t compose_src(pixel_t, pixel_t);
+extern pixel_t compose_dst(pixel_t, pixel_t);
+
+extern pixel_t compose_over(pixel_t, pixel_t);
+extern pixel_t compose_in(pixel_t, pixel_t);
+extern pixel_t compose_out(pixel_t, pixel_t);
+extern pixel_t compose_atop(pixel_t, pixel_t);
+extern pixel_t compose_xor(pixel_t, pixel_t);
+extern pixel_t compose_add(pixel_t, pixel_t);
+
+#endif
+
+/** @}
+ */
Index: uspace/lib/softrend/filter.c
===================================================================
--- uspace/lib/softrend/filter.c	(revision 6d5e378b28e2c858f3813b5d4d57fa46f709d753)
+++ uspace/lib/softrend/filter.c	(revision 6d5e378b28e2c858f3813b5d4d57fa46f709d753)
@@ -0,0 +1,66 @@
+/*
+ * Copyright (c) 2012 Petr Koupy
+ * 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 softrend
+ * @{
+ */
+/**
+ * @file
+ */
+
+#include "filter.h"
+
+pixel_t filter_nearest(pixelmap_t *pixmap, double x, double y, bool tile)
+{
+	long _x = x > 0 ? (long) (x + 0.5) : (long) (x - 0.5);
+	long _y = y > 0 ? (long) (y + 0.5) : (long) (y - 0.5);
+
+	if (tile) {
+		_x %= pixmap->width;
+		_y %= pixmap->height;
+	} else if (_x < 0 || _x >= (long) pixmap->width || _y < 0 || _y >= (long) pixmap->height) {
+		return 0;
+	}
+
+	return pixelmap_get_pixel(pixmap, (sysarg_t) _x, (sysarg_t) _y);
+}
+
+pixel_t filter_bilinear(pixelmap_t *pixmap, double x, double y, bool tile)
+{
+	// TODO
+	return 0;
+}
+
+pixel_t filter_bicubic(pixelmap_t *pixmap, double x, double y, bool tile)
+{
+	// TODO
+	return 0;
+}
+
+/** @}
+ */
Index: uspace/lib/softrend/filter.h
===================================================================
--- uspace/lib/softrend/filter.h	(revision 6d5e378b28e2c858f3813b5d4d57fa46f709d753)
+++ uspace/lib/softrend/filter.h	(revision 6d5e378b28e2c858f3813b5d4d57fa46f709d753)
@@ -0,0 +1,51 @@
+/*
+ * Copyright (c) 2012 Petr Koupy
+ * 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 softrend
+ * @{
+ */
+/**
+ * @file
+ */
+
+#ifndef SOFTREND_FILTER_H_
+#define SOFTREND_FILTER_H_
+
+#include <bool.h>
+#include <io/pixelmap.h>
+
+typedef pixel_t (*filter_t)(pixelmap_t *, double, double, bool);
+
+extern pixel_t filter_nearest(pixelmap_t *, double, double, bool);
+extern pixel_t filter_bilinear(pixelmap_t *, double, double, bool);
+extern pixel_t filter_bicubic(pixelmap_t *, double, double, bool);
+
+#endif
+
+/** @}
+ */
Index: uspace/lib/softrend/pixconv.c
===================================================================
--- uspace/lib/softrend/pixconv.c	(revision 6d5e378b28e2c858f3813b5d4d57fa46f709d753)
+++ uspace/lib/softrend/pixconv.c	(revision 6d5e378b28e2c858f3813b5d4d57fa46f709d753)
@@ -0,0 +1,290 @@
+/*
+ * Copyright (c) 2011 Martin Decky
+ * Copyright (c) 2011 Petr Koupy
+ * 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 softrend
+ * @{
+ */
+/**
+ * @file
+ */
+
+#include <byteorder.h>
+#include "pixconv.h"
+
+/** Pixel conversion and mask functions
+ *
+ * These functions write an ARGB pixel value to a memory location
+ * in a predefined format. The naming convention corresponds to
+ * the names of the visuals and the format created by these functions.
+ * The functions use the so called network bit order (i.e. big endian)
+ * with respect to their names.
+ */
+
+void pixel2argb_8888(void *dst, pixel_t pix)
+{
+	*((uint32_t *) dst) = host2uint32_t_be(
+	    (ALPHA(pix) << 24) | (RED(pix) << 16) | (GREEN(pix) << 8) | (BLUE(pix)));
+}
+
+void pixel2abgr_8888(void *dst, pixel_t pix)
+{
+	*((uint32_t *) dst) = host2uint32_t_be(
+	    (ALPHA(pix) << 24) | (BLUE(pix) << 16) | (GREEN(pix) << 8) | (RED(pix)));
+}
+
+void pixel2rgba_8888(void *dst, pixel_t pix)
+{
+	*((uint32_t *) dst) = host2uint32_t_be(
+	    (RED(pix) << 24) | (GREEN(pix) << 16) | (BLUE(pix) << 8) | (ALPHA(pix)));
+}
+
+void pixel2bgra_8888(void *dst, pixel_t pix)
+{
+	*((uint32_t *) dst) = host2uint32_t_be(
+	    (BLUE(pix) << 24) | (GREEN(pix) << 16) | (RED(pix) << 8) | (ALPHA(pix)));
+}
+
+void pixel2rgb_0888(void *dst, pixel_t pix)
+{
+	*((uint32_t *) dst) = host2uint32_t_be(
+	    (RED(pix) << 16) | (GREEN(pix) << 8) | (BLUE(pix)));
+}
+
+void pixel2bgr_0888(void *dst, pixel_t pix)
+{
+	*((uint32_t *) dst) = host2uint32_t_be(
+	    (BLUE(pix) << 16) | (GREEN(pix) << 8) | (RED(pix)));
+}
+
+void pixel2rgb_8880(void *dst, pixel_t pix)
+{
+	*((uint32_t *) dst) = host2uint32_t_be(
+	    (RED(pix) << 24) | (GREEN(pix) << 16) | (BLUE(pix) << 8));
+}
+
+void pixel2bgr_8880(void *dst, pixel_t pix)
+{
+	*((uint32_t *) dst) = host2uint32_t_be(
+	    (BLUE(pix) << 24) | (GREEN(pix) << 16) | (RED(pix) << 8));
+}
+
+void pixel2rgb_888(void *dst, pixel_t pix)
+{
+	((uint8_t *) dst)[0] = RED(pix);
+	((uint8_t *) dst)[1] = GREEN(pix);
+	((uint8_t *) dst)[2] = BLUE(pix);
+}
+
+void pixel2bgr_888(void *dst, pixel_t pix)
+{
+	((uint8_t *) dst)[0] = BLUE(pix);
+	((uint8_t *) dst)[1] = GREEN(pix);
+	((uint8_t *) dst)[2] = RED(pix);
+}
+
+void pixel2rgb_555_be(void *dst, pixel_t pix)
+{
+	*((uint16_t *) dst) = host2uint16_t_be(
+	    (NARROW(RED(pix), 5) << 10) | (NARROW(GREEN(pix), 5) << 5) | (NARROW(BLUE(pix), 5)));
+}
+
+void pixel2rgb_555_le(void *dst, pixel_t pix)
+{
+	*((uint16_t *) dst) = host2uint16_t_le(
+	    (NARROW(RED(pix), 5) << 10) | (NARROW(GREEN(pix), 5) << 5) | (NARROW(BLUE(pix), 5)));
+}
+
+void pixel2rgb_565_be(void *dst, pixel_t pix)
+{
+	*((uint16_t *) dst) = host2uint16_t_be(
+	    (NARROW(RED(pix), 5) << 11) | (NARROW(GREEN(pix), 6) << 5) | (NARROW(BLUE(pix), 5)));
+}
+
+void pixel2rgb_565_le(void *dst, pixel_t pix)
+{
+	*((uint16_t *) dst) = host2uint16_t_le(
+	    (NARROW(RED(pix), 5) << 11) | (NARROW(GREEN(pix), 6) << 5) | (NARROW(BLUE(pix), 5)));
+}
+
+void pixel2bgr_323(void *dst, pixel_t pix)
+{
+	*((uint8_t *) dst) =
+	    ~((NARROW(RED(pix), 3) << 5) | (NARROW(GREEN(pix), 2) << 3) | NARROW(BLUE(pix), 3));
+}
+
+void pixel2gray_8(void *dst, pixel_t pix)
+{
+	uint32_t red = RED(pix) * 5034375;
+	uint32_t green = GREEN(pix) * 9886846;
+	uint32_t blue = BLUE(pix) * 1920103;
+
+	*((uint8_t *) dst) = (red + green + blue) >> 24;
+}
+
+void visual_mask_8888(void *dst, bool mask)
+{
+	pixel2abgr_8888(dst, mask ? 0xffffffff : 0);
+}
+
+void visual_mask_0888(void *dst, bool mask)
+{
+	pixel2bgr_0888(dst, mask ? 0xffffffff : 0);
+}
+
+void visual_mask_8880(void *dst, bool mask)
+{
+	pixel2bgr_8880(dst, mask ? 0xffffffff : 0);
+}
+
+void visual_mask_888(void *dst, bool mask)
+{
+	pixel2bgr_888(dst, mask ? 0xffffffff : 0);
+}
+
+void visual_mask_555(void *dst, bool mask)
+{
+	pixel2rgb_555_be(dst, mask ? 0xffffffff : 0);
+}
+
+void visual_mask_565(void *dst, bool mask)
+{
+	pixel2rgb_565_be(dst, mask ? 0xffffffff : 0);
+}
+
+void visual_mask_323(void *dst, bool mask)
+{
+	pixel2bgr_323(dst, mask ? 0x0 : ~0x0);
+}
+
+void visual_mask_8(void *dst, bool mask)
+{
+	pixel2gray_8(dst, mask ? 0xffffffff : 0);
+}
+
+pixel_t argb_8888_2pixel(void *src)
+{
+	return (uint32_t_be2host(*((uint32_t *) src)));
+}
+
+pixel_t abgr_8888_2pixel(void *src)
+{
+	uint32_t val = uint32_t_be2host(*((uint32_t *) src));
+	return ((val & 0xff000000) | ((val & 0xff0000) >> 16) | (val & 0xff00) | ((val & 0xff) << 16));
+}
+
+pixel_t rgba_8888_2pixel(void *src)
+{
+	uint32_t val = uint32_t_be2host(*((uint32_t *) src));
+	return ((val << 24) | (val >> 8));
+}
+
+pixel_t bgra_8888_2pixel(void *src)
+{
+	uint32_t val = uint32_t_be2host(*((uint32_t *) src));
+	return ((val >> 24) | ((val & 0xff0000) >> 8) | ((val & 0xff00) << 8) | (val << 24));
+}
+
+pixel_t rgb_0888_2pixel(void *src)
+{
+	return (0xff000000 | (uint32_t_be2host(*((uint32_t *) src)) & 0xffffff));
+}
+
+pixel_t bgr_0888_2pixel(void *src)
+{
+	uint32_t val = uint32_t_be2host(*((uint32_t *) src));
+	return (0xff000000 | ((val & 0xff0000) >> 16) | (val & 0xff00) | ((val & 0xff) << 16));
+}
+
+pixel_t rgb_8880_2pixel(void *src)
+{
+	return (0xff000000 | (uint32_t_be2host(*((uint32_t *) src)) >> 8));
+}
+
+pixel_t bgr_8880_2pixel(void *src)
+{
+	uint32_t val = uint32_t_be2host(*((uint32_t *) src));
+	return (0xff000000 | (val >> 24) | ((val & 0xff0000) >> 8) | ((val & 0xff00) << 8));
+}
+
+pixel_t rgb_888_2pixel(void *src)
+{
+	uint8_t red = ((uint8_t *) src)[0];
+	uint8_t green = ((uint8_t *) src)[1];
+	uint8_t blue = ((uint8_t *) src)[2];
+
+	return (0xff000000 | (red << 16) | (green << 8) | (blue));
+}
+
+pixel_t bgr_888_2pixel(void *src)
+{
+	uint8_t blue = ((uint8_t *) src)[0];
+	uint8_t green = ((uint8_t *) src)[1];
+	uint8_t red = ((uint8_t *) src)[2];
+
+	return (0xff000000 | (red << 16) | (green << 8) | (blue));
+}
+
+pixel_t rgb_555_be_2pixel(void *src)
+{
+	uint16_t val = uint16_t_be2host(*((uint16_t *) src));
+	return (0xff000000 | ((val & 0x7c00) << 9) | ((val & 0x3e0) << 6) | ((val & 0x1f) << 3));
+}
+
+pixel_t rgb_555_le_2pixel(void *src)
+{
+	uint16_t val = uint16_t_le2host(*((uint16_t *) src));
+	return (0xff000000 | ((val & 0x7c00) << 9) | ((val & 0x3e0) << 6) | ((val & 0x1f) << 3));
+}
+
+pixel_t rgb_565_be_2pixel(void *src)
+{
+	uint16_t val = uint16_t_be2host(*((uint16_t *) src));
+	return (0xff000000 | ((val & 0xf800) << 8) | ((val & 0x7e0) << 5) | ((val & 0x1f) << 3));
+}
+
+pixel_t rgb_565_le_2pixel(void *src)
+{
+	uint16_t val = uint16_t_le2host(*((uint16_t *) src));
+	return (0xff000000 | ((val & 0xf800) << 8) | ((val & 0x7e0) << 5) | ((val & 0x1f) << 3));
+}
+
+pixel_t bgr_323_2pixel(void *src)
+{
+	uint8_t val = ~(*((uint8_t *) src));
+	return (0xff000000 | ((val & 0xe0) << 16) | ((val & 0x18) << 11) | ((val & 0x7) << 5));
+}
+
+pixel_t gray_8_2pixel(void *src)
+{
+	uint8_t val = *((uint8_t *) src);
+	return (0xff000000 | (val << 16) | (val << 8) | (val));
+}
+
+/** @}
+ */
Index: uspace/lib/softrend/pixconv.h
===================================================================
--- uspace/lib/softrend/pixconv.h	(revision 6d5e378b28e2c858f3813b5d4d57fa46f709d753)
+++ uspace/lib/softrend/pixconv.h	(revision 6d5e378b28e2c858f3813b5d4d57fa46f709d753)
@@ -0,0 +1,98 @@
+/*
+ * Copyright (c) 2011 Martin Decky
+ * Copyright (c) 2011 Petr Koupy
+ * 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 softrend
+ * @{
+ */
+/**
+ * @file
+ */
+
+#ifndef SOFTREND_PIXCONV_H_
+#define SOFTREND_PIXCONV_H_
+
+#include <bool.h>
+#include <io/pixel.h>
+
+/** Function to render a pixel. */
+typedef void (*pixel2visual_t)(void *, pixel_t);
+
+/** Function to render a bit mask. */
+typedef void (*visual_mask_t)(void *, bool);
+
+/** Function to retrieve a pixel. */
+typedef pixel_t (*visual2pixel_t)(void *);
+
+extern void pixel2argb_8888(void *, pixel_t);
+extern void pixel2abgr_8888(void *, pixel_t);
+extern void pixel2rgba_8888(void *, pixel_t);
+extern void pixel2bgra_8888(void *, pixel_t);
+extern void pixel2rgb_0888(void *, pixel_t);
+extern void pixel2bgr_0888(void *, pixel_t);
+extern void pixel2rgb_8880(void *, pixel_t);
+extern void pixel2bgr_8880(void *, pixel_t);
+extern void pixel2rgb_888(void *, pixel_t);
+extern void pixel2bgr_888(void *, pixel_t);
+extern void pixel2rgb_555_be(void *, pixel_t);
+extern void pixel2rgb_555_le(void *, pixel_t);
+extern void pixel2rgb_565_be(void *, pixel_t);
+extern void pixel2rgb_565_le(void *, pixel_t);
+extern void pixel2bgr_323(void *, pixel_t);
+extern void pixel2gray_8(void *, pixel_t);
+
+extern void visual_mask_8888(void *, bool);
+extern void visual_mask_0888(void *, bool);
+extern void visual_mask_8880(void *, bool);
+extern void visual_mask_888(void *, bool);
+extern void visual_mask_555(void *, bool);
+extern void visual_mask_565(void *, bool);
+extern void visual_mask_323(void *, bool);
+extern void visual_mask_8(void *, bool);
+
+extern pixel_t argb_8888_2pixel(void *);
+extern pixel_t abgr_8888_2pixel(void *);
+extern pixel_t rgba_8888_2pixel(void *);
+extern pixel_t bgra_8888_2pixel(void *);
+extern pixel_t rgb_0888_2pixel(void *);
+extern pixel_t bgr_0888_2pixel(void *);
+extern pixel_t rgb_8880_2pixel(void *);
+extern pixel_t bgr_8880_2pixel(void *);
+extern pixel_t rgb_888_2pixel(void *);
+extern pixel_t bgr_888_2pixel(void *);
+extern pixel_t rgb_555_be_2pixel(void *);
+extern pixel_t rgb_555_le_2pixel(void *);
+extern pixel_t rgb_565_be_2pixel(void *);
+extern pixel_t rgb_565_le_2pixel(void *);
+extern pixel_t bgr_323_2pixel(void *);
+extern pixel_t gray_8_2pixel(void *);
+
+#endif
+
+/** @}
+ */
Index: uspace/lib/softrend/rectangle.c
===================================================================
--- uspace/lib/softrend/rectangle.c	(revision 6d5e378b28e2c858f3813b5d4d57fa46f709d753)
+++ uspace/lib/softrend/rectangle.c	(revision 6d5e378b28e2c858f3813b5d4d57fa46f709d753)
@@ -0,0 +1,84 @@
+/*
+ * Copyright (c) 2012 Petr Koupy
+ * 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 softrend
+ * @{
+ */
+/**
+ * @file
+ */
+
+#include "rectangle.h"
+
+bool rectangle_intersect(
+    sysarg_t x1, sysarg_t y1, sysarg_t w1, sysarg_t h1,
+    sysarg_t x2, sysarg_t y2, sysarg_t w2, sysarg_t h2,
+    sysarg_t *x_out, sysarg_t *y_out, sysarg_t *w_out, sysarg_t *h_out)
+{
+	sysarg_t l, r, t, b;
+
+	l = x1 < x2 ? x2 : x1;
+	t = y1 < y2 ? y2 : y1;
+	r = x1 + w1 < x2 + w2 ? x1 + w1 : x2 + w2;
+	b = y1 + h1 < y2 + h2 ? y1 + h1 : y2 + h2;
+
+	if (l < r && t < b) {
+		(*x_out) = l;
+		(*y_out) = t;
+		(*w_out) = r - l;
+		(*h_out) = b - t;
+		return true;
+	} else {
+		(*x_out) = 0;
+		(*y_out) = 0;
+		(*w_out) = 0;
+		(*h_out) = 0;
+		return false;
+	}
+}
+
+void rectangle_union(
+    sysarg_t x1, sysarg_t y1, sysarg_t w1, sysarg_t h1,
+    sysarg_t x2, sysarg_t y2, sysarg_t w2, sysarg_t h2,
+    sysarg_t *x_out, sysarg_t *y_out, sysarg_t *w_out, sysarg_t *h_out)
+{
+	sysarg_t l, r, t, b;
+
+	l = x1 > x2 ? x2 : x1;
+	t = y1 > y2 ? y2 : y1;
+	r = x1 + w1 > x2 + w2 ? x1 + w1 : x2 + w2;
+	b = y1 + h1 > y2 + h2 ? y1 + h1 : y2 + h2;
+
+	(*x_out) = l;
+	(*y_out) = t;
+	(*w_out) = r - l;
+	(*h_out) = b - t;
+}
+
+/** @}
+ */
Index: uspace/lib/softrend/rectangle.h
===================================================================
--- uspace/lib/softrend/rectangle.h	(revision 6d5e378b28e2c858f3813b5d4d57fa46f709d753)
+++ uspace/lib/softrend/rectangle.h	(revision 6d5e378b28e2c858f3813b5d4d57fa46f709d753)
@@ -0,0 +1,54 @@
+/*
+ * Copyright (c) 2012 Petr Koupy
+ * 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 softrend
+ * @{
+ */
+/**
+ * @file
+ */
+
+#ifndef SOFTREND_RECTANGLE_H_
+#define SOFTREND_RECTANGLE_H_
+
+#include <sys/types.h>
+#include <bool.h>
+
+extern bool rectangle_intersect(
+    sysarg_t, sysarg_t, sysarg_t, sysarg_t,
+    sysarg_t, sysarg_t, sysarg_t, sysarg_t,
+    sysarg_t *, sysarg_t *, sysarg_t *, sysarg_t *);
+extern void rectangle_union(
+    sysarg_t, sysarg_t, sysarg_t, sysarg_t,
+    sysarg_t, sysarg_t, sysarg_t, sysarg_t,
+    sysarg_t *, sysarg_t *, sysarg_t *, sysarg_t *);
+
+#endif
+
+/** @}
+ */
Index: uspace/lib/softrend/transform.c
===================================================================
--- uspace/lib/softrend/transform.c	(revision 6d5e378b28e2c858f3813b5d4d57fa46f709d753)
+++ uspace/lib/softrend/transform.c	(revision 6d5e378b28e2c858f3813b5d4d57fa46f709d753)
@@ -0,0 +1,155 @@
+/*
+ * Copyright (c) 2011 Petr Koupy
+ * 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 softrend
+ * @{
+ */
+/**
+ * @file
+ */
+
+#include "transform.h"
+
+void transform_multiply(transform_t *res, const transform_t *left, const transform_t *right)
+{
+	for (int i = 0; i < 3; ++i) {
+		for (int j = 0; j < 3; ++j) {
+			double comb = 0;
+			for (int k = 0; k < 3; ++k) {
+				comb += left->m[i][k] * right->m[k][j];
+			}
+			res->m[i][j] = comb;
+		}
+	}
+}
+
+void transform_invert(transform_t *t)
+{
+	double a = t->m[1][1] * t->m[2][2] - t->m[1][2] * t->m[2][1];
+	double b = t->m[1][2] * t->m[2][0] - t->m[2][2] * t->m[1][0];
+	double c = t->m[1][0] * t->m[2][1] - t->m[1][1] * t->m[2][0];
+	double d = t->m[0][2] * t->m[2][1] - t->m[0][1] * t->m[2][2];
+	double e = t->m[0][0] * t->m[2][2] - t->m[0][2] * t->m[2][0];
+	double f = t->m[2][0] * t->m[0][1] - t->m[0][0] * t->m[2][1];
+	double g = t->m[0][1] * t->m[1][2] - t->m[0][2] * t->m[1][1];
+	double h = t->m[0][2] * t->m[1][0] - t->m[0][0] * t->m[1][2];
+	double k = t->m[0][0] * t->m[1][1] - t->m[0][1] * t->m[1][0];
+
+	double det = t->m[0][0] * a + t->m[0][1] * b + t->m[0][2] * c;
+	det = 1 / det;
+
+	t->m[0][0] = a * det;   t->m[0][1] = d * det;   t->m[0][2] = g * det;
+	t->m[1][0] = b * det;   t->m[1][1] = e * det;   t->m[1][2] = h * det;
+	t->m[2][0] = c * det;   t->m[2][1] = f * det;   t->m[2][2] = k * det;
+}
+
+void transform_identity(transform_t *t)
+{
+	t->m[0][0] = 1;   t->m[0][1] = 0;   t->m[0][2] = 0;
+	t->m[1][0] = 0;   t->m[1][1] = 1;   t->m[1][2] = 0;
+	t->m[2][0] = 0;   t->m[2][1] = 0;   t->m[2][2] = 1;
+}
+
+void transform_translate(transform_t *t, double dx, double dy)
+{
+	transform_t a;
+	a.m[0][0] = 1;   a.m[0][1] = 0;   a.m[0][2] = dx;
+	a.m[1][0] = 0;   a.m[1][1] = 1;   a.m[1][2] = dy;
+	a.m[2][0] = 0;   a.m[2][1] = 0;   a.m[2][2] = 1;
+
+	transform_t r;
+	transform_multiply(&r, &a, t);
+	*t = r;
+}
+
+void transform_scale(transform_t *t, double qx, double qy)
+{
+	transform_t a;
+	a.m[0][0] = qx;  a.m[0][1] = 0;   a.m[0][2] = 0;
+	a.m[1][0] = 0;   a.m[1][1] = qy;  a.m[1][2] = 0;
+	a.m[2][0] = 0;   a.m[2][1] = 0;   a.m[2][2] = 1;
+
+	transform_t r;
+	transform_multiply(&r, &a, t);
+	*t = r;
+}
+
+void transform_rotate(transform_t *t, double rad)
+{
+	double s, c;
+
+	// FIXME: temporary solution until there are trigonometric functions in libc
+
+	while (rad < 0) {
+		rad += (2 * PI);
+	}
+	
+	while (rad > (2 * PI)) {
+		rad -= (2 * PI);
+	}
+
+	if (rad >= 0 && rad < (PI / 4)) {
+		s = 0; c = 1;
+	} else if (rad >= (PI / 4) && rad < (3 * PI / 4)) {
+		s = 1; c = 0;
+	} else if (rad >= (3 * PI / 4) && rad < (5 * PI / 4)) {
+		s = 0; c = -1;
+	} else if (rad >= (5 * PI / 4) && rad < (7 * PI / 4)) {
+		s = -1; c = 0;
+	} else {
+		s = 0; c = 1;
+	}
+
+	transform_t a;
+	a.m[0][0] = c;   a.m[0][1] = -s;  a.m[0][2] = 0;
+	a.m[1][0] = s;   a.m[1][1] = c;   a.m[1][2] = 0;
+	a.m[2][0] = 0;   a.m[2][1] = 0;   a.m[2][2] = 1;
+
+	transform_t r;
+	transform_multiply(&r, &a, t);
+	*t = r;
+}
+
+void transform_apply_linear(const transform_t *t, double *x, double *y)
+{
+	double x_ = *x;
+	double y_ = *y;
+	*x = x_ * t->m[0][0] + y_ * t->m[0][1];
+	*y = x_ * t->m[1][0] + y_ * t->m[1][1];
+}
+
+void transform_apply_affine(const transform_t *t, double *x, double *y)
+{
+	double x_ = *x;
+	double y_ = *y;
+	*x = x_ * t->m[0][0] + y_ * t->m[0][1] + t->m[0][2];
+	*y = x_ * t->m[1][0] + y_ * t->m[1][1] + t->m[1][2];
+}
+
+/** @}
+ */
Index: uspace/lib/softrend/transform.h
===================================================================
--- uspace/lib/softrend/transform.h	(revision 6d5e378b28e2c858f3813b5d4d57fa46f709d753)
+++ uspace/lib/softrend/transform.h	(revision 6d5e378b28e2c858f3813b5d4d57fa46f709d753)
@@ -0,0 +1,61 @@
+/*
+ * Copyright (c) 2011 Petr Koupy
+ * 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 softrend
+ * @{
+ */
+/**
+ * @file
+ */
+
+#ifndef SOFTREND_TRANSFORM_H_
+#define SOFTREND_TRANSFORM_H_
+
+#ifndef PI
+#define PI 3.141592653589793
+#endif
+
+typedef struct {
+	double m[3][3];
+} transform_t;
+
+extern void transform_multiply(transform_t *, const transform_t *, const transform_t *);
+extern void transform_invert(transform_t *);
+
+extern void transform_identity(transform_t *);
+extern void transform_translate(transform_t *, double, double);
+extern void transform_scale(transform_t *, double, double);
+extern void transform_rotate(transform_t *, double);
+
+extern void transform_apply_linear(const transform_t *, double *, double *);
+extern void transform_apply_affine(const transform_t *, double *, double *);
+
+#endif
+
+/** @}
+ */
