summaryrefslogtreecommitdiff
path: root/render/picturestr.h
diff options
context:
space:
mode:
authorLars Knoll <lars@trolltech.com>2005-07-01 10:05:43 +0000
committerLars Knoll <lars@trolltech.com>2005-07-01 10:05:43 +0000
commitb5b2a0522efd61bd99b5d5d75cdd27960cd1c7e1 (patch)
tree455e2c8151f463288783b6e4e8fa29939cde4d3c /render/picturestr.h
parent30c019e847adef6f7f3963df8ef1f3f994669a54 (diff)
Add support for gradients and solid fills to Render.
Changed the semantics of the Convolution filter a bit. It now doesn't try to normalize the filter values but leaves this to the client. This gives more reasonable behaviour in the limit where the filter parameters sum up to 0.
Diffstat (limited to 'render/picturestr.h')
-rw-r--r--render/picturestr.h103
1 files changed, 101 insertions, 2 deletions
diff --git a/render/picturestr.h b/render/picturestr.h
index a532e4e1c..58b840c6d 100644
--- a/render/picturestr.h
+++ b/render/picturestr.h
@@ -62,6 +62,70 @@ typedef struct _PictTransform {
xFixed matrix[3][3];
} PictTransform, *PictTransformPtr;
+#define PICT_GRADIENT_STOPTABLE_SIZE 1024
+#define SourcePictTypeSolidFill 0
+#define SourcePictTypeLinear 1
+#define SourcePictTypeRadial 2
+#define SourcePictTypeConical 3
+
+typedef struct _PictSolidFill {
+ unsigned int type;
+ CARD32 color;
+} PictSolidFill, *PictSolidFillPtr;
+
+typedef struct _PictGradientStop {
+ xFixed x;
+ xRenderColor color;
+} PictGradientStop, *PictGradientStopPtr;
+
+typedef struct _PictGradient {
+ unsigned int type;
+ int nstops;
+ PictGradientStopPtr stops;
+ CARD32 colorTable[PICT_GRADIENT_STOPTABLE_SIZE];
+} PictGradient, *PictGradientPtr;
+
+typedef struct _PictLinearGradient {
+ unsigned int type;
+ int nstops;
+ PictGradientStopPtr stops;
+ CARD32 colorTable[PICT_GRADIENT_STOPTABLE_SIZE];
+ xPointFixed p1;
+ xPointFixed p2;
+} PictLinearGradient, *PictLinearGradientPtr;
+
+typedef struct _PictRadialGradient {
+ unsigned int type;
+ int nstops;
+ PictGradientStopPtr stops;
+ CARD32 colorTable[PICT_GRADIENT_STOPTABLE_SIZE];
+ double fx;
+ double fy;
+ double dx;
+ double dy;
+ double a;
+ double m;
+ double b;
+} PictRadialGradient, *PictRadialGradientPtr;
+
+typedef struct _PictConicalGradient {
+ unsigned int type;
+ int nstops;
+ PictGradientStopPtr stops;
+ CARD32 colorTable[PICT_GRADIENT_STOPTABLE_SIZE];
+ xPointFixed center;
+ xFixed angle;
+} PictConicalGradient, *PictConicalGradientPtr;
+
+typedef union _SourcePict {
+ unsigned int type;
+ PictSolidFill solidFill;
+ PictGradient gradient;
+ PictLinearGradient linear;
+ PictRadialGradient radial;
+ PictConicalGradient conical;
+} SourcePict, *SourcePictPtr;
+
typedef struct _Picture {
DrawablePtr pDrawable;
PictFormatPtr pFormat;
@@ -70,7 +134,7 @@ typedef struct _Picture {
CARD32 id;
PicturePtr pNext; /* chain on same drawable */
- unsigned int repeat : 1;
+ unsigned int repeat : 2;
unsigned int graphicsExposures : 1;
unsigned int subWindowMode : 1;
unsigned int polyEdge : 1;
@@ -78,7 +142,7 @@ typedef struct _Picture {
unsigned int freeCompClip : 1;
unsigned int clientClipType : 2;
unsigned int componentAlpha : 1;
- unsigned int unused : 23;
+ unsigned int unused : 22;
PicturePtr alphaMap;
DDXPointRec alphaOrigin;
@@ -100,6 +164,7 @@ typedef struct _Picture {
int filter;
xFixed *filter_params;
int filter_nparams;
+ SourcePictPtr pSourcePict;
} PictureRec;
typedef Bool (*PictFilterValidateParamsProcPtr) (PicturePtr pPicture, int id,
@@ -546,6 +611,40 @@ AddTraps (PicturePtr pPicture,
int ntraps,
xTrap *traps);
+PicturePtr
+CreateSolidPicture (Picture pid,
+ xRenderColor *color,
+ int *error);
+
+PicturePtr
+CreateLinearGradientPicture (Picture pid,
+ xPointFixed *p1,
+ xPointFixed *p2,
+ int nStops,
+ xFixed *stops,
+ xRenderColor *colors,
+ int *error);
+
+PicturePtr
+CreateRadialGradientPicture (Picture pid,
+ xPointFixed *inner,
+ xPointFixed *outer,
+ xFixed innerRadius,
+ xFixed outerRadius,
+ int nStops,
+ xFixed *stops,
+ xRenderColor *colors,
+ int *error);
+
+PicturePtr
+CreateConicalGradientPicture (Picture pid,
+ xPointFixed *center,
+ xFixed angle,
+ int nStops,
+ xFixed *stops,
+ xRenderColor *colors,
+ int *error);
+
#ifdef PANORAMIX
void PanoramiXRenderInit (void);
void PanoramiXRenderReset (void);