summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSøren Sandmann Pedersen <ssp@redhat.com>2010-03-08 03:36:39 -0500
committerSøren Sandmann Pedersen <ssp@redhat.com>2010-03-08 03:36:39 -0500
commit2089a53c581d4023969517e755ea503e05004fbe (patch)
treea459fceca22a0d9d597fe630996224e98410a1b0
parent5c22fea38c732b661b209ae0e0f02cfa2ad49165 (diff)
Notes about LERPlerp-ops
-rw-r--r--lerp-notes42
-rw-r--r--pixman/pixman.h92
2 files changed, 90 insertions, 44 deletions
diff --git a/lerp-notes b/lerp-notes
new file mode 100644
index 00000000..883c6e93
--- /dev/null
+++ b/lerp-notes
@@ -0,0 +1,42 @@
+PIXMAN_TYPE_A means the A channel is at the bottom of the pixel. Ie.,
+x4a4 is xxxxaaaa and not aaaaxxxx.
+
+PIXMAN_TYPE_W means the W channel is at the top of the pixel. Ie.,
+x4w4 would be meaningless. However, w8x24 means
+
+ wwwwwwwwxxxxxxxxxxxxxxxxxxxxxxxx
+
+
+The interpretation of TYPE_W formats is that they are shades of
+white. Basically, the alpha channel is replicated in the r, g, and b
+channels so that the result is white with an alpha of w.
+
+The interpretation for TYPE_A formats is that the rgb channels are
+0. Ie., TYPE_A pixels are black with an alpha of a.
+
+The TYPE_W interpretation is convenient because in conjunction with
+the LERP operators it means component alpha becomes completely
+regular.
+
+LERP is always interpreted across all channels, so if you use a TYPE_W
+format, the result is that all channels are modulated with the alpha
+value. Component alpha then is just a matter of using an RGB mask for
+the LERP.
+
+We need to be careful with strength reducing. Basically, the OVER_LERP
+operator can be reduced from
+
+ OVER_LERP with TYPE_W mask
+
+to
+
+ OVER with TYPE_A mask
+
+For regular OVER TYPE_A and TYPE_W masks are the same.
+
+However, OVER_LERP with TYPE_A mask is something entirely different
+that cannot be implemented in terms of regular OVER. (That one simply
+throws away the RGB channels of the operation).
+
+For completeness, we should probably specify what happens if you ask
+for component alpha with an A mask.
diff --git a/pixman/pixman.h b/pixman/pixman.h
index ec95fcc2..75969a2d 100644
--- a/pixman/pixman.h
+++ b/pixman/pixman.h
@@ -664,6 +664,7 @@ struct pixman_indexed
#define PIXMAN_TYPE_YUY2 6
#define PIXMAN_TYPE_YV12 7
#define PIXMAN_TYPE_BGRA 8
+#define PIXMAN_TYPE_W 9
#define PIXMAN_FORMAT_COLOR(f) \
(PIXMAN_FORMAT_TYPE(f) == PIXMAN_TYPE_ARGB || \
@@ -672,67 +673,70 @@ struct pixman_indexed
/* 32bpp formats */
typedef enum {
- PIXMAN_a8r8g8b8 = PIXMAN_FORMAT(32,PIXMAN_TYPE_ARGB,8,8,8,8),
- PIXMAN_x8r8g8b8 = PIXMAN_FORMAT(32,PIXMAN_TYPE_ARGB,0,8,8,8),
- PIXMAN_a8b8g8r8 = PIXMAN_FORMAT(32,PIXMAN_TYPE_ABGR,8,8,8,8),
- PIXMAN_x8b8g8r8 = PIXMAN_FORMAT(32,PIXMAN_TYPE_ABGR,0,8,8,8),
- PIXMAN_b8g8r8a8 = PIXMAN_FORMAT(32,PIXMAN_TYPE_BGRA,8,8,8,8),
- PIXMAN_b8g8r8x8 = PIXMAN_FORMAT(32,PIXMAN_TYPE_BGRA,0,8,8,8),
- PIXMAN_x2r10g10b10 = PIXMAN_FORMAT(32,PIXMAN_TYPE_ARGB,0,10,10,10),
- PIXMAN_a2r10g10b10 = PIXMAN_FORMAT(32,PIXMAN_TYPE_ARGB,2,10,10,10),
- PIXMAN_x2b10g10r10 = PIXMAN_FORMAT(32,PIXMAN_TYPE_ABGR,0,10,10,10),
- PIXMAN_a2b10g10r10 = PIXMAN_FORMAT(32,PIXMAN_TYPE_ABGR,2,10,10,10),
+ PIXMAN_a8r8g8b8 = PIXMAN_FORMAT(32,PIXMAN_TYPE_ARGB,8,8,8,8),
+ PIXMAN_x8r8g8b8 = PIXMAN_FORMAT(32,PIXMAN_TYPE_ARGB,0,8,8,8),
+ PIXMAN_a8b8g8r8 = PIXMAN_FORMAT(32,PIXMAN_TYPE_ABGR,8,8,8,8),
+ PIXMAN_x8b8g8r8 = PIXMAN_FORMAT(32,PIXMAN_TYPE_ABGR,0,8,8,8),
+ PIXMAN_b8g8r8a8 = PIXMAN_FORMAT(32,PIXMAN_TYPE_BGRA,8,8,8,8),
+ PIXMAN_b8g8r8x8 = PIXMAN_FORMAT(32,PIXMAN_TYPE_BGRA,0,8,8,8),
+ PIXMAN_x2r10g10b10 = PIXMAN_FORMAT(32,PIXMAN_TYPE_ARGB,0,10,10,10),
+ PIXMAN_a2r10g10b10 = PIXMAN_FORMAT(32,PIXMAN_TYPE_ARGB,2,10,10,10),
+ PIXMAN_x2b10g10r10 = PIXMAN_FORMAT(32,PIXMAN_TYPE_ABGR,0,10,10,10),
+ PIXMAN_a2b10g10r10 = PIXMAN_FORMAT(32,PIXMAN_TYPE_ABGR,2,10,10,10),
+ PIXMAN_w8x24 = PIXMAN_FORMAT(32,PIXMAN_TYPE_W,8,0,0,0),
/* 24bpp formats */
- PIXMAN_r8g8b8 = PIXMAN_FORMAT(24,PIXMAN_TYPE_ARGB,0,8,8,8),
- PIXMAN_b8g8r8 = PIXMAN_FORMAT(24,PIXMAN_TYPE_ABGR,0,8,8,8),
+ PIXMAN_r8g8b8 = PIXMAN_FORMAT(24,PIXMAN_TYPE_ARGB,0,8,8,8),
+ PIXMAN_b8g8r8 = PIXMAN_FORMAT(24,PIXMAN_TYPE_ABGR,0,8,8,8),
/* 16bpp formats */
- PIXMAN_r5g6b5 = PIXMAN_FORMAT(16,PIXMAN_TYPE_ARGB,0,5,6,5),
- PIXMAN_b5g6r5 = PIXMAN_FORMAT(16,PIXMAN_TYPE_ABGR,0,5,6,5),
-
- PIXMAN_a1r5g5b5 = PIXMAN_FORMAT(16,PIXMAN_TYPE_ARGB,1,5,5,5),
- PIXMAN_x1r5g5b5 = PIXMAN_FORMAT(16,PIXMAN_TYPE_ARGB,0,5,5,5),
- PIXMAN_a1b5g5r5 = PIXMAN_FORMAT(16,PIXMAN_TYPE_ABGR,1,5,5,5),
- PIXMAN_x1b5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g1 = PIXMAN_FORMAT(1,PIXMAN_TYPE_GRAY,0,0,0,0),
/* YUV formats */
- PIXMAN_yuy2 = PIXMAN_FORMAT(16,PIXMAN_TYPE_YUY2,0,0,0,0),
- PIXMAN_yv12 = PIXMAN_FORMAT(12,PIXMAN_TYPE_YV12,0,0,0,0)
+ PIXMAN_yuy2 = PIXMAN_FORMAT(16,PIXMAN_TYPE_YUY2,0,0,0,0),
+ PIXMAN_yv12 = PIXMAN_FORMAT(12,PIXMAN_TYPE_YV12,0,0,0,0)
} pixman_format_code_t;
/* Querying supported format values. */