Index: /libpipi/trunk/pipi/dither/ordered.c
===================================================================
--- /libpipi/trunk/pipi/dither/ordered.c	(revision 2810)
+++ /libpipi/trunk/pipi/dither/ordered.c	(revision 2811)
@@ -21,4 +21,5 @@
 
 #include <stdlib.h>
+#include <math.h>
 
 #include "pipi.h"
@@ -27,8 +28,15 @@
 pipi_image_t *pipi_dither_ordered(pipi_image_t *img, pipi_image_t *kernel)
 {
+    return pipi_dither_ordered_ext(img, kernel, 0.0);
+}
+
+pipi_image_t *pipi_dither_ordered_ext(pipi_image_t *img, pipi_image_t *kernel,
+                                      double angle)
+{
+    double sint, cost;
     pipi_image_t *dst;
     pipi_pixels_t *dstp, *kernelp;
     float *dstdata, *kerneldata;
-    int x, y, w, h, kw, kh;
+    int x, y, w, h, kx, ky, kw, kh;
 
     w = img->w;
@@ -36,4 +44,7 @@
     kw = kernel->w;
     kh = kernel->h;
+
+    cost = cos(angle * (M_PI / 180));
+    sint = sin(angle * (M_PI / 180));
 
     dst = pipi_copy(img);
@@ -50,6 +61,9 @@
             float p, q;
 
+            kx = (int)(cost * x - sint * y + 2 * w * h) % kw;
+            ky = (int)(cost * y + sint * x + 2 * w * h) % kh;
+
             p = dstdata[y * w + x];
-            q = p > kerneldata[(y % kh) * kw + (x % kw)] ? 1. : 0.;
+            q = p > kerneldata[ky * kw + kx] ? 1. : 0.;
             dstdata[y * w + x] = q;
         }
Index: /libpipi/trunk/pipi/pipi.h
===================================================================
--- /libpipi/trunk/pipi/pipi.h	(revision 2810)
+++ /libpipi/trunk/pipi/pipi.h	(revision 2811)
@@ -183,4 +183,6 @@
                                        pipi_scan_t);
 extern pipi_image_t *pipi_dither_ordered(pipi_image_t *, pipi_image_t *);
+extern pipi_image_t *pipi_dither_ordered_ext(pipi_image_t *, pipi_image_t *,
+                                             double);
 extern pipi_image_t *pipi_dither_halftone(pipi_image_t *, double, double);
 extern pipi_image_t *pipi_dither_random(pipi_image_t *);
Index: /libpipi/trunk/pipi/context.c
===================================================================
--- /libpipi/trunk/pipi/context.c	(revision 2810)
+++ /libpipi/trunk/pipi/context.c	(revision 2811)
@@ -105,9 +105,14 @@
             ctx->nimages--;
         }
-        else if(!strcmp(method, "ordered"))
+        else if(!strncmp(method, "ordered", 7))
         {
+            double angle = .0;
+            method = strchr(method, ':');
+            if(method)
+                angle = atof(method + 1);
             if(ctx->nimages < 2)
                 return -1;
-            dst = pipi_dither_ordered(ctx->images[ctx->nimages - 2], src);
+            dst = pipi_dither_ordered_ext(ctx->images[ctx->nimages - 2], src,
+                                          angle);
             pipi_free(ctx->images[ctx->nimages - 2]);
             ctx->nimages--;
