summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorHenry Stiles <henry.stiles@artifex.com>2006-03-07 18:37:15 +0000
committerHenry Stiles <henry.stiles@artifex.com>2006-03-07 18:37:15 +0000
commita8f656f33466a09e0a09dd7f30b7f1cbb3760fe3 (patch)
tree40b4a49cd99ea1823f61500043baaca4df18c0da
parent7054e1ea4cf24c0f4190730a4c62f842d68d023e (diff)
a first stab at visual brush implementation and general cleanup. This is a rough draft checkin, clearing mods before we change over to svn.
git-svn-id: http://svn.ghostscript.com/ghostpcl/trunk/ghostpcl@2330 06663e23-700e-0410-b217-a244a6096597
-rw-r--r--met/met.mak4
-rw-r--r--met/metcomplex.h36
-rw-r--r--met/metgstate.c21
-rw-r--r--met/metgstate.h5
-rw-r--r--met/metimage.c8
-rw-r--r--met/metimage.h6
-rw-r--r--met/metparse.c40
-rw-r--r--met/metpath.c4
-rw-r--r--met/metrecorder.c50
-rw-r--r--met/metrecorder.h6
-rw-r--r--met/metstate.c1
-rw-r--r--met/metstate.h1
-rw-r--r--met/metundone.c9
-rw-r--r--met/xps_gradient_brush.c109
14 files changed, 201 insertions, 99 deletions
diff --git a/met/met.mak b/met/met.mak
index cfbcfc4b7..01e51497e 100644
--- a/met/met.mak
+++ b/met/met.mak
@@ -51,6 +51,9 @@ $(METOBJ)metimage.$(OBJ): $(METSRC)metimage.c
$(METOBJ)xps_gradient_brush.$(OBJ): $(METSRC)xps_gradient_brush.c
$(METCCC) $(METSRC)xps_gradient_brush.c $(METO_)xps_gradient_brush.$(OBJ)
+$(METOBJ)xps_visual_brush.$(OBJ): $(METSRC)xps_visual_brush.c
+ $(METCCC) $(METSRC)xps_visual_brush.c $(METO_)xps_visual_brush.$(OBJ)
+
$(METOBJ)metpage.$(OBJ): $(METSRC)metpage.c
$(METCCC) $(METSRC)metpage.c $(METO_)metpage.$(OBJ)
@@ -108,6 +111,7 @@ MET_OBJS=$(METOBJ)metparse.$(OBJ) $(METOBJ)metstate.$(OBJ) \
$(METOBJ)metelement.$(OBJ) $(METOBJ)metpath.$(OBJ)\
$(METOBJ)metglyphs.$(OBJ) $(METOBJ)metutil.$(OBJ) \
$(METOBJ)metimage.$(OBJ) $(METOBJ)xps_gradient_brush.$(OBJ) \
+ $(METOBJ)xps_visual_brush.$(OBJ) \
$(METOBJ)zipparse.$(OBJ) $(METOBJ)zippart.$(OBJ) \
$(METOBJ)xps_image_jpeg.$(OBJ) \
$(METOBJ)xps_image_png.$(OBJ) \
diff --git a/met/metcomplex.h b/met/metcomplex.h
index 0922c6b4c..d7d7f535a 100644
--- a/met/metcomplex.h
+++ b/met/metcomplex.h
@@ -92,27 +92,27 @@ typedef struct CT_SolidColorBrush_s {
} CT_SolidColorBrush;
typedef struct CT_LinearGradientBrush_s {
- char * Opacity;
- char * Key;
- char * ColorInterpolationMode;
- char * SpreadMethod;
- char * MappingMode;
- char * Transform;
- char * StartPoint;
- char * EndPoint;
+ ST_ZeroOne Opacity;
+ ST_Name Key;
+ ST_ClrIntMode ColorInterpolationMode;
+ ST_SpreadMethod SpreadMethod;
+ ST_Name MappingMode;
+ ST_RscRefMatrix Transform;
+ ST_Point StartPoint;
+ ST_Point EndPoint;
} CT_LinearGradientBrush;
typedef struct CT_RadialGradientBrush_s {
- char * Opacity;
- char * Key;
- char * ColorInterpolationMode;
- char * SpreadMethod;
- char * MappingMode;
- char * Transform;
- char * Center;
- char * GradientOrigin;
- char * RadiusX;
- char * RadiusY;
+ ST_ZeroOne Opacity;
+ ST_Name Key;
+ ST_ClrIntMode ColorInterpolationMode;
+ ST_SpreadMethod SpreadMethod;
+ ST_Name MappingMode;
+ ST_RscRefMatrix Transform;
+ ST_Point Center;
+ ST_Point GradientOrigin;
+ ST_GEZero RadiusX;
+ ST_GEZero RadiusY;
} CT_RadialGradientBrush;
typedef struct CT_VisualBrush_s {
diff --git a/met/metgstate.c b/met/metgstate.c
index fdee31c61..1129c0481 100644
--- a/met/metgstate.c
+++ b/met/metgstate.c
@@ -31,6 +31,7 @@ typedef struct metgstate_s {
bool charpathmode;
ST_RscRefColor CharFill;
met_path_child_t child;
+ void *VisualBrush;
gs_memory_t *pmem;
} metgstate_t;
@@ -223,6 +224,24 @@ ST_RscRefColor met_currentcharfillcolor(gs_state *pgs)
return pmg->CharFill;
}
+private metgstate_t *
+client_data(gs_state *pgs)
+{
+ return gs_state_client_data(pgs);
+}
+
+/* nb should be a resource type */
+void
+met_setvisualbrush(gs_state *pgs, void *vb)
+{
+ client_data(pgs)->VisualBrush = vb;
+}
+
+void *met_currentvisualbrush(gs_state *pgs)
+{
+ return client_data(pgs)->VisualBrush;
+}
+
private const gs_state_client_procs met_gstate_procs = {
met_gstate_alloc,
0,
@@ -230,6 +249,7 @@ private const gs_state_client_procs met_gstate_procs = {
met_gstate_copy_for
};
+
/* constructor for gstate */
void
met_gstate_init(gs_state *pgs, gs_memory_t *pmem)
@@ -243,6 +263,7 @@ met_gstate_init(gs_state *pgs, gs_memory_t *pmem)
pmg->CharFill = 0;
pmg->child = met_none;
pmg->pmem = pmem;
+ pmg->VisualBrush = 0;
gs_state_set_client(pgs, pmg, &met_gstate_procs, false);
}
diff --git a/met/metgstate.h b/met/metgstate.h
index 67c364c83..99566bcf0 100644
--- a/met/metgstate.h
+++ b/met/metgstate.h
@@ -80,4 +80,9 @@ bool met_iscolorpattern(gs_state *pgs, ST_RscRefColor color);
/* if set make an font outline path to be filled */
void met_setcharpathmode(gs_state *pgs, bool mode);
bool met_currentcharpathmode(gs_state *pgs);
+
+/* nb should be a resource type */
+void met_setvisualbrush(gs_state *pgs, void *vb);
+void *met_currentvisualbrush(gs_state *pgs);
+
#endif /* metgstate_INCLUDED */
diff --git a/met/metimage.c b/met/metimage.c
index 2c49fc472..9fd056eaf 100644
--- a/met/metimage.c
+++ b/met/metimage.c
@@ -189,6 +189,8 @@ met_PaintPattern(const gs_client_color *pcc, gs_state *pgs)
code = LinearGradientBrush_paint(pmpat->linear, pgs);
if (pmpat->radial)
code = RadialGradientBrush_paint(pmpat->radial, pgs);
+ if (pmpat->visual)
+ code = VisualBrush_paint(pmpat->visual, pgs);
gs_grestore(pgs);
if (code < 0)
return gs_rethrow(code, "could not paint gradient pattern");
@@ -421,12 +423,12 @@ ImageBrush_action(void *data, met_state_t *ms)
{
/* create the pattern dictionary entry */
CT_ImageBrush *aImageBrush = data;
- met_pattern_t *pat =
- (met_pattern_t *)gs_alloc_bytes(ms->memory,
- sizeof(met_pattern_t), "ImageBrush_action");
+ met_pattern_t *pat = (met_pattern_t *)gs_alloc_bytes(ms->memory,
+ sizeof(met_pattern_t), "ImageBrush_action");
xps_image_t *pim = (xps_image_t *)gs_alloc_bytes(ms->memory,
sizeof(xps_image_t), "ImageBrush_action");
+
if (!pat || !pim)
return -1;
diff --git a/met/metimage.h b/met/metimage.h
index 8b774f954..06f588630 100644
--- a/met/metimage.h
+++ b/met/metimage.h
@@ -18,6 +18,7 @@
# define metimage_INCLUDED
#include "gsmatrix.h"
+#include "plrcnogc.h"
/* type for the information derived directly from the raster file format */
@@ -42,11 +43,10 @@ int xps_decode_jpeg(gs_memory_t *mem, byte *rbuf, int rlen, xps_image_t *image);
int xps_decode_png(gs_memory_t *mem, byte *rbuf, int rlen, xps_image_t *image);
int xps_decode_tiff(gs_memory_t *mem, byte *rbuf, int rlen, xps_image_t *image);
-/* it appears all images in metro are really patterns. */
-
typedef struct met_pattern_s {
void *linear;
void *radial;
+ void *visual;
xps_image_t *raster_image;
gs_matrix Transform;
gs_rect Viewbox;
@@ -55,5 +55,5 @@ typedef struct met_pattern_s {
int LinearGradientBrush_paint(void *data, gs_state *pgs);
int RadialGradientBrush_paint(void *data, gs_state *pgs);
-
+int VisualBrush_paint(void *data, gs_state *pgs);
#endif /* metimage_INCLUDED */
diff --git a/met/metparse.c b/met/metparse.c
index d0a60b2d4..6a85a72c0 100644
--- a/met/metparse.c
+++ b/met/metparse.c
@@ -72,9 +72,9 @@ parse_trace(const char *el, const char **attr, int indent)
return;
/* assume empty attribute means close element */
if (!attr)
- dprintf3(gs_mem_ptr, "%*s%s\n", indent + 1, "/", el);
+ dprintf4(gs_mem_ptr, "%*s%s:%d\n", indent + 1, "/", el, indent / 4);
else
- dprintf2(gs_mem_ptr, "%*s\n", indent + strlen(el), el);
+ dprintf3(gs_mem_ptr, "%*s:%d\n", indent + strlen(el), el, indent / 4);
/* print the attributes if we have any. aren't closing out the element */
if (attr) {
int i;
@@ -108,6 +108,7 @@ met_start(void *data, const char *el, const char **attr)
met_parser_state_t *st = data;
gs_memory_t *mem = st->memory;
met_element_procs_t *metp = met_get_element_definition(el);
+ bool record_my_children = false;
int code;
parse_trace(el, attr, INDENT);
@@ -128,17 +129,15 @@ met_start(void *data, const char *el, const char **attr)
}
/* start recording */
if (code == 1) { /* nb record me return value */
+ record_my_children = true;
if (st->recording) {
gs_rethrow(code, "Fatal recursive recording not supported");
met_set_error(st, code);
}
- st->recording = true;
- st->depth_at_record_start = st->depth;
- dprintf2(mem, "starting recording at %s stack pos %d\n", el, st->depth);
}
if (st->recording) {
- met_record(mem, element);
+ met_record(mem, element, el, /* open */ true, st->depth);
} else {
/* only cook if we are recording */
code = (*metp->action)(element->cooked_data, st->mets);
@@ -150,7 +149,11 @@ met_start(void *data, const char *el, const char **attr)
st->last_element++;
}
st->depth++;
-
+ if (record_my_children) {
+ st->recording = true;
+ st->depth_at_record_start = st->depth;
+ dprintf2(mem, "starting recording at %s stack pos %d\n", el, st->depth);
+ }
}
private void
@@ -172,18 +175,10 @@ met_end(void *data, const char *el)
element = st->element_history[st->last_element];
if (st->recording) {
element.sel = met_done;
- code = met_record(mem, &element);
+ code = met_record(mem, &element, el, false /* open */, st->depth);
/* just free the cooked resource, the recorder made a copy. */
gs_free_object(mem, element.cooked_data, "met parser");
/* check if we have returned to the depth */
- if (st->depth == st->depth_at_record_start) {
- if (code >= 0) {
- code = met_playback(st->mets);
- if (code >= 0) {
- st->recording = false;
- }
- }
- }
} else {
code = (*metp->done)(element.cooked_data, st->mets);
}
@@ -192,6 +187,17 @@ met_end(void *data, const char *el)
met_set_error(st, code);
}
}
+
+ if (st->recording && (st->depth == st->depth_at_record_start)) {
+ if (code >= 0) {
+ dprintf2(mem, "stopping recording at %s stack pos %d\n", el, st->depth);
+ code = met_store(st->mets);
+ if (code >= 0) {
+ st->recording = false;
+ }
+ }
+ }
+
}
/* allocate the parser, and set the global memory pointer see above */
@@ -223,7 +229,7 @@ met_process_alloc(gs_memory_t *memory)
stp->memory = memory;
stp->parser = p;
- stp->depth = 0;
+ stp->depth = 0;
stp->error_code = 0;
stp->last_element = 0;
stp->recording = false;
diff --git a/met/metpath.c b/met/metpath.c
index 8b1f22e5b..cb658f6fa 100644
--- a/met/metpath.c
+++ b/met/metpath.c
@@ -382,8 +382,6 @@ Path_done(void *data, met_state_t *ms)
} while (0);
- /* hack nb fixme */
-
gs_free_object(ms->memory, data, "Path_done");
if (code < 0)
return gs_rethrow(code, "Path done failed");
@@ -607,7 +605,7 @@ private int
Path_Stroke_action(void *data, met_state_t *ms)
{
/* CT_CP_Brush *aPath_Stroke = data; */
-
+ met_setpathchild(ms->pgs, met_stroke);
return 0;
}
diff --git a/met/metrecorder.c b/met/metrecorder.c
index 303734408..afb6fb157 100644
--- a/met/metrecorder.c
+++ b/met/metrecorder.c
@@ -17,12 +17,18 @@
#include "metrecorder.h"
#include "gserror.h"
#include "string_.h"
+#include "metutil.h"
typedef struct metrecord_s metrecord_t;
struct metrecord_s {
data_element_t *data;
struct metrecord_s *next;
+ /* NB should be debugging */
+ bool open;
+ char *element;
+ int depth;
+
};
/* NB static fixme */
@@ -31,7 +37,7 @@ private metrecord_t *head = NULL;
private metrecord_t *tail = NULL;
int
-met_record(gs_memory_t *mem, const data_element_t *data)
+met_record(gs_memory_t *mem, const data_element_t *data, const char *xmlel, bool open, int depth)
{
metrecord_t *node = (metrecord_t *)gs_alloc_bytes(mem,
sizeof(metrecord_t), "met record node");
@@ -49,7 +55,9 @@ met_record(gs_memory_t *mem, const data_element_t *data)
gs_object_size(mem, data->cooked_data));
el->cooked_data = cooked_data;
node->data = el;
-
+ node->open = open;
+ node->element = met_strdup(mem, xmlel);
+ node->depth = depth;
if (head == NULL) {
head = tail = node;
} else {
@@ -57,7 +65,7 @@ met_record(gs_memory_t *mem, const data_element_t *data)
}
return 0;
}
-
+
int
met_playback(met_state_t *ms)
{
@@ -80,9 +88,11 @@ met_playback(met_state_t *ms)
break;
case met_action:
+ if (gs_debug_c('i')) dprintf2(ms->memory, "%d:opening %s\n", node->depth, node->element);
code = (*procs->action)(data->cooked_data, ms);
break;
case met_done:
+ if (gs_debug_c('i')) dprintf2(ms->memory, "%d:closing %s\n", node->depth, node->element);
code = (*procs->done)(data->cooked_data, ms);
break;
default:
@@ -99,3 +109,37 @@ met_playback(met_state_t *ms)
return code;
}
+
+/* NB todo */
+private int
+check_resource(met_state_t *ms, metrecord_t *first_node)
+{
+ gs_state *pgs = ms->pgs;
+ int code;
+ gs_gsave(pgs);
+
+ /* playback the resorce to the null device, checking for errors */
+ if (((code = gs_nulldevice(pgs)) >= 0) &&
+ ((code = met_playback(ms)) >= 0))
+ ;
+ gs_grestore(pgs);
+
+ if (code >= 0)
+ return 0;
+ else
+ return gs_rethrow(code, "bad resource");
+}
+
+
+/* NB wrong should copy the resource */
+int
+met_store(met_state_t *ms)
+{
+ int code = 0;
+ // code = check_resource(ms, head);
+ if (code == 0) {
+ ms->current_resource = head;
+ return code;
+ }
+ return gs_throw(code, "failed to store resource");
+}
diff --git a/met/metrecorder.h b/met/metrecorder.h
index 5aeb43dd4..1865bd4ff 100644
--- a/met/metrecorder.h
+++ b/met/metrecorder.h
@@ -19,7 +19,11 @@
#include "metparse.h"
-int met_record(gs_memory_t *mem, const data_element_t *data);
+/* record a cooked resource */
+int met_record(gs_memory_t *mem, const data_element_t *data, const char *el, bool open, int depth);
+/* play it back */
int met_playback(met_state_t *ms);
+/* store it in the state */
+int met_store(met_state_t *ms);
#endif /* metrecorder_INCLUDED */
diff --git a/met/metstate.c b/met/metstate.c
index e9865f212..94c214427 100644
--- a/met/metstate.c
+++ b/met/metstate.c
@@ -31,6 +31,7 @@ met_state_alloc(gs_memory_t *mem)
function somewhere */
pl_dict_init(&pmets->font_dict, mem, pl_free_font);
pmets->font_dir = gs_font_dir_alloc(mem);
+ pmets->current_resource = 0;
return pmets;
}
diff --git a/met/metstate.h b/met/metstate.h
index cb7645938..e5438562b 100644
--- a/met/metstate.h
+++ b/met/metstate.h
@@ -39,6 +39,7 @@ struct met_state_s {
pl_dict_t font_dict;
pl_dict_t pattern_dict;
gs_font_dir *font_dir;
+ void *current_resource;
};
/* allocate a metro state */
diff --git a/met/metundone.c b/met/metundone.c
index 3500c4708..4b0360148 100644
--- a/met/metundone.c
+++ b/met/metundone.c
@@ -57,7 +57,6 @@ UNDONE_STUB(PathGeometry_Transform);
UNDONE_STUB(RadialGradientBrush_GradientStops);
UNDONE_STUB(RadialGradientBrush_Transform);
UNDONE_STUB(ResourceDictionary);
-UNDONE_STUB(VisualBrush);
UNDONE_STUB(VisualBrush_Transform);
UNDONE_STUB(VisualBrush_Visual);
@@ -113,9 +112,11 @@ ELEMENT_done(void *data, met_state_t *ms)
const met_element_t met_element_procs_ELEMENT = {
"ELEMENT",
- ELEMENT_cook,
- ELEMENT_action,
- ELEMENT_done
+ {
+ ELEMENT_cook,
+ ELEMENT_action,
+ ELEMENT_done
+ }
};
#endif /* 0 */
diff --git a/met/xps_gradient_brush.c b/met/xps_gradient_brush.c
index 3a59a83fd..0ed6fd895 100644
--- a/met/xps_gradient_brush.c
+++ b/met/xps_gradient_brush.c
@@ -1,3 +1,19 @@
+/* Portions Copyright (C) 2001 artofcode LLC.
+ Portions Copyright (C) 1996, 2001, 2005 Artifex Software Inc.
+ Portions Copyright (C) 1988, 2000 Aladdin Enterprises.
+ This software is based in part on the work of the Independent JPEG Group.
+ All Rights Reserved.
+
+ This software is distributed under license and may not be copied, modified
+ or distributed except as expressly authorized under the terms of that
+ license. Refer to licensing information at http://www.artifex.com/ or
+ contact Artifex Software, Inc., 101 Lucas Valley Road #110,
+ San Rafael, CA 94903, (415)492-9861, for further information. */
+
+/*$Id: */
+
+/* gradient brush */
+
/* a big puddle of puke needed for the headers */
#include "memory_.h"
#include "gsmemory.h"
@@ -34,7 +50,7 @@ LinearGradientBrush_cook(void **ppdata, met_state_t *ms,
CT_LinearGradientBrush *brush;
int i;
- brush = (void*) gs_alloc_bytes(ms->memory,
+ brush = (CT_LinearGradientBrush *) gs_alloc_bytes(ms->memory,
sizeof(CT_LinearGradientBrush),
"LinearGradientBrush_cook");
if (!brush)
@@ -45,25 +61,24 @@ LinearGradientBrush_cook(void **ppdata, met_state_t *ms,
/* parse attributes, filling in the zeroed out C struct */
for(i = 0; attr[i]; i += 2)
{
- if (!strcmp(attr[i], "Opacity"))
- brush->Opacity = strdup(attr[i+1]);
- if (!strcmp(attr[i], "x:Key"))
- brush->Key = strdup(attr[i+1]);
- if (!strcmp(attr[i], "Opacity"))
- brush->Opacity = strdup(attr[i+1]);
- if (!strcmp(attr[i], "ColorInterpolationMode"))
- brush->ColorInterpolationMode = strdup(attr[i+1]);
- if (!strcmp(attr[i], "SpreadMethod"))
- brush->SpreadMethod = strdup(attr[i+1]);
- if (!strcmp(attr[i], "MappingMode"))
- brush->MappingMode = strdup(attr[i+1]);
- if (!strcmp(attr[i], "Transform"))
- brush->Transform = strdup(attr[i+1]);
-
- if (!strcmp(attr[i], "StartPoint"))
- brush->StartPoint = strdup(attr[i+1]);
- if (!strcmp(attr[i], "EndPoint"))
- brush->EndPoint = strdup(attr[i+1]);
+ if (!strcmp(attr[i], "Opacity"))
+ brush->Opacity = atof(attr[i+1]);
+ else if (!MYSET(&brush->ColorInterpolationMode, "ColorInterpolationMode"))
+ ;
+ else if (!MYSET(&brush->SpreadMethod, "SpreadMethod"))
+ ;
+ else if (!MYSET(&brush->MappingMode, "MappingMode"))
+ ;
+ else if (!MYSET(&brush->Transform, "Transform"))
+ ;
+ else if (!MYSET(&brush->StartPoint, "StartPoint"))
+ ;
+ else if (!MYSET(&brush->EndPoint, "EndPoint"))
+ ;
+ else {
+ gs_throw2(-1, "unsupported attribute %s=%s\n",
+ attr[i], attr[i+1]);
+ }
}
/* what about child LinearGradientBrush.Transform */
@@ -80,7 +95,7 @@ RadialGradientBrush_cook(void **ppdata, met_state_t *ms,
CT_RadialGradientBrush *brush;
int i;
- brush = (void*) gs_alloc_bytes(ms->memory,
+ brush = (CT_RadialGradientBrush *) gs_alloc_bytes(ms->memory,
sizeof(CT_RadialGradientBrush),
"RadialGradientBrush_cook");
if (!brush)
@@ -91,29 +106,28 @@ RadialGradientBrush_cook(void **ppdata, met_state_t *ms,
/* parse attributes, filling in the zeroed out C struct */
for(i = 0; attr[i]; i += 2)
{
- if (!strcmp(attr[i], "Opacity"))
- brush->Opacity = strdup(attr[i+1]);
- if (!strcmp(attr[i], "x:Key"))
- brush->Key = strdup(attr[i+1]);
- if (!strcmp(attr[i], "Opacity"))
- brush->Opacity = strdup(attr[i+1]);
- if (!strcmp(attr[i], "ColorInterpolationMode"))
- brush->ColorInterpolationMode = strdup(attr[i+1]);
- if (!strcmp(attr[i], "SpreadMethod"))
- brush->SpreadMethod = strdup(attr[i+1]);
- if (!strcmp(attr[i], "MappingMode"))
- brush->MappingMode = strdup(attr[i+1]);
- if (!strcmp(attr[i], "Transform"))
- brush->Transform = strdup(attr[i+1]);
-
- if (!strcmp(attr[i], "Center"))
- brush->Center = strdup(attr[i+1]);
- if (!strcmp(attr[i], "GradientOrigin"))
- brush->GradientOrigin = strdup(attr[i+1]);
- if (!strcmp(attr[i], "RadiusX"))
- brush->RadiusX = strdup(attr[i+1]);
- if (!strcmp(attr[i], "RadiusY"))
- brush->RadiusY = strdup(attr[i+1]);
+ if (!strcmp(attr[i], "Opacity"))
+ brush->Opacity = atof(attr[i+1]);
+ else if (!strcmp(attr[i], "RadiusY"))
+ brush->RadiusY = atof(attr[i+1]);
+ else if (!strcmp(attr[i], "RadiusX"))
+ brush->RadiusX = atof(attr[i+1]);
+ else if (!MYSET(&brush->ColorInterpolationMode, "ColorInterpolationMode"))
+ ;
+ else if (!MYSET(&brush->SpreadMethod, "SpreadMethod"))
+ ;
+ else if (!MYSET(&brush->MappingMode, "MappingMode"))
+ ;
+ else if (!MYSET(&brush->Transform, "Transform"))
+ ;
+ else if (!MYSET(&brush->Center, "Center"))
+ ;
+ else if (!MYSET(&brush->GradientOrigin, "GradientOrigin"))
+ ;
+ else {
+ gs_throw2(-1, "unsupported attribute %s=%s\n",
+ attr[i], attr[i+1]);
+ }
}
/* what about child RadialGradientBrush.Transform */
@@ -212,8 +226,9 @@ int RadialGradientBrush_paint(void *data, gs_state *pgs)
sscanf(brush->Center, "%lg,%lg", &center[0], &center[1]);
sscanf(brush->GradientOrigin, "%lg,%lg", &origin[0], &origin[1]);
- sscanf(brush->RadiusX, "%lg", &radiusx);
- sscanf(brush->RadiusY, "%lg", &radiusy);
+
+ radiusx = brush->RadiusX;
+ radiusy = brush->RadiusY;
dputs(gs_state_memory(pgs), "i'm painting radial\n");
@@ -254,7 +269,7 @@ private int CommonGradientBrush_action(void *data, met_state_t *ms, int type)
met_pattern_t *metpat =
(met_pattern_t *)gs_alloc_bytes(ms->memory,
sizeof(met_pattern_t), "GradientBrush_action");
-
+ metpat->visual = NULL;
metpat->linear = NULL;
metpat->radial = NULL;
metpat->raster_image = NULL;