[gs-cvs] gs/src
Igor Melichev
igor at casper.ghostscript.com
Mon Oct 7 03:59:11 PDT 2002
Update of /cvs/ghostscript/gs/src
In directory casper:/tmp/cvs-serv13127/gs/src
Modified Files:
gdevpdfc.c gdevpdfg.h
Log Message:
Fix (pdfwrite) : Implementing colorant names after DeviceN merge.
Index: gdevpdfc.c
===================================================================
RCS file: /cvs/ghostscript/gs/src/gdevpdfc.c,v
retrieving revision 1.28
retrieving revision 1.29
diff -u -d -r1.28 -r1.29
--- gdevpdfc.c 7 Oct 2002 08:28:56 -0000 1.28
+++ gdevpdfc.c 7 Oct 2002 10:59:09 -0000 1.29
@@ -477,6 +477,24 @@
}
/*
+ * Convert a string into cos name.
+ */
+private int
+pdf_string_to_cos_name(gx_device_pdf *pdev, const byte *str, uint len,
+ cos_value_t *pvalue)
+{
+ byte *chars = gs_alloc_string(pdev->pdf_memory, len + 1,
+ "pdf_string_to_cos_name");
+
+ if (chars == 0)
+ return_error(gs_error_VMerror);
+ chars[0] = '/';
+ memcpy(chars + 1, str, len);
+ cos_string_value(pvalue, chars, len + 1);
+ return 0;
+}
+
+/*
* Create a PDF color space corresponding to a PostScript color space.
* For parameterless color spaces, set *pvalue to a (literal) string with
* the color space name; for other color spaces, create a cos_array_t if
@@ -705,13 +723,17 @@
cos_array_t *psna =
cos_array_alloc(pdev, "pdf_color_space(DeviceN)");
int i;
+ byte *name_string;
+ uint name_string_length;
if (psna == 0)
return_error(gs_error_VMerror);
for (i = 0; i < pcs->params.device_n.num_components; ++i) {
- code = pdf_separation_name(pdev, &v,
- pcs->params.device_n.names[i]);
- if (code < 0 ||
+ if ((code = pcs->params.device_n.get_colorname_string(
+ pcs->params.device_n.names[i], &name_string,
+ &name_string_length)) < 0 ||
+ (code = pdf_string_to_cos_name(pdev, name_string,
+ name_string_length, &v)) < 0 ||
(code = cos_array_add_no_copy(psna, &v)) < 0)
return code;
}
@@ -729,13 +751,20 @@
/****** CURRENTLY WE ONLY HANDLE Functions ******/
if (pfn == 0)
return_error(gs_error_rangecheck);
- if ((code = pdf_separation_name(pdev, &v,
- pcs->params.separation.sep_name)) < 0 ||
- (code = pdf_separation_color_space(pdev, pca, "/Separation", &v,
- (const gs_color_space *)
- &pcs->params.separation.alt_space,
- pfn, &pdf_color_space_names)) < 0)
- return code;
+ {
+ byte *name_string;
+ uint name_string_length;
+ if ((code = pcs->params.separation.get_colorname_string(
+ pcs->params.separation.sep_name, &name_string,
+ &name_string_length)) < 0 ||
+ (code = pdf_string_to_cos_name(pdev, name_string,
+ name_string_length, &v)) < 0 ||
+ (code = pdf_separation_color_space(pdev, pca, "/Separation", &v,
+ (const gs_color_space *)
+ &pcs->params.separation.alt_space,
+ pfn, &pdf_color_space_names)) < 0)
+ return code;
+ }
break;
case gs_color_space_index_Pattern:
Index: gdevpdfg.h
===================================================================
RCS file: /cvs/ghostscript/gs/src/gdevpdfg.h,v
retrieving revision 1.17
retrieving revision 1.18
diff -u -d -r1.17 -r1.18
--- gdevpdfg.h 27 Jun 2002 04:03:03 -0000 1.17
+++ gdevpdfg.h 7 Oct 2002 10:59:09 -0000 1.18
@@ -122,12 +122,6 @@
int pdf_prepare_imagemask(gx_device_pdf *pdev, const gs_imager_state *pis,
const gx_drawing_color *pdcolor);
-/* Get the (string) name of a separation, */
-/* returning a newly allocated string with a / prefixed. */
-/****** BOGUS for all but standard separations ******/
-int pdf_separation_name(gx_device_pdf *pdev, cos_value_t *pvalue,
- gs_separation_name sname);
-
/* ---------------- Exported by gdevpdfj.c ---------------- */
/* ------ Image stream dictionaries ------ */
More information about the gs-cvs
mailing list