Index: uspace/lib/gfx/src/coord.c
===================================================================
--- uspace/lib/gfx/src/coord.c	(revision f93e4e3ae22ee5f272a9195be2946896615a6219)
+++ uspace/lib/gfx/src/coord.c	(revision 13d20e5193e101df61fa9376d8d50fc032741d4c)
@@ -238,4 +238,28 @@
 }
 
+/** Center rectangle on rectangle.
+ *
+ * Translate rectangle @a a so that its center coincides with the
+ * center of rectangle @a b, saving the result in @a dest.
+ *
+ * @param a Rectnagle to translate
+ * @param b Rectangle on which to center
+ * @param dest Place to store resulting rectangle
+ */
+void gfx_rect_ctr_on_rect(gfx_rect_t *a, gfx_rect_t *b, gfx_rect_t *dest)
+{
+	gfx_coord2_t adim;
+	gfx_coord2_t bdim;
+
+	gfx_rect_dims(a, &adim);
+	gfx_rect_dims(b, &bdim);
+
+	dest->p0.x = b->p0.x + bdim.x / 2 - adim.x / 2;
+	dest->p0.y = b->p0.y + bdim.y / 2 - adim.y / 2;
+
+	dest->p1.x = dest->p0.x + adim.x;
+	dest->p1.y = dest->p0.y + adim.y;
+}
+
 /** Sort points of a rectangle.
  *
