diff options
-rw-r--r-- | devices/vector/gdevpdfc.c | 85 |
1 files changed, 82 insertions, 3 deletions
diff --git a/devices/vector/gdevpdfc.c b/devices/vector/gdevpdfc.c index 570c3f00a..7363a1953 100644 --- a/devices/vector/gdevpdfc.c +++ b/devices/vector/gdevpdfc.c | |||
@@ -1137,7 +1137,8 @@ pdf_color_space_named(gx_device_pdf *pdev, const gs_gstate * pgs, | |||
1137 | int i; | 1137 | int i; |
1138 | byte *name_string; | 1138 | byte *name_string; |
1139 | uint name_string_length; | 1139 | uint name_string_length; |
1140 | cos_value_t v_attriburtes, *va = NULL; | 1140 | cos_value_t v_attributes, *va = NULL; |
1141 | pdf_resource_t *pres_attributes = NULL; | ||
1141 | 1142 | ||
1142 | if (psna == 0) | 1143 | if (psna == 0) |
1143 | return_error(gs_error_VMerror); | 1144 | return_error(gs_error_VMerror); |
@@ -1150,18 +1151,94 @@ pdf_color_space_named(gx_device_pdf *pdev, const gs_gstate * pgs, | |||
1150 | return code; | 1151 | return code; |
1151 | } | 1152 | } |
1152 | COS_OBJECT_VALUE(&v, psna); | 1153 | COS_OBJECT_VALUE(&v, psna); |
1154 | |||
1155 | /* If we have either /Process or /Colorants (or both) then we need to create an | ||
1156 | * attributes dictionary. | ||
1157 | */ | ||
1158 | if (pcs->params.device_n.devn_process_space != NULL || pcs->params.device_n.colorants != NULL) { | ||
1159 | cos_value_t v_Subtype_name; | ||
1160 | |||
1161 | code = pdf_alloc_resource(pdev, resourceOther, 0, &pres_attributes, -1); | ||
1162 | if (code < 0) | ||
1163 | return code; | ||
1164 | cos_become(pres_attributes->object, cos_type_dict); | ||
1165 | |||
1166 | if (pcs->params.device_n.subtype == gs_devicen_DeviceN) { | ||
1167 | code = pdf_string_to_cos_name(pdev, (const byte *)"DeviceN", 7, &v_Subtype_name); | ||
1168 | if (code < 0) | ||
1169 | return code; | ||
1170 | } else { | ||
1171 | if (pcs->params.device_n.subtype == gs_devicen_NChannel) { | ||
1172 | code = pdf_string_to_cos_name(pdev, (const byte *)"NChannel", 8, &v_Subtype_name); | ||
1173 | if (code < 0) | ||
1174 | return code; | ||
1175 | } else | ||
1176 | return gs_note_error(gs_error_typecheck); | ||
1177 | } | ||
1178 | code = cos_dict_put((cos_dict_t *)pres_attributes->object, (const byte *)"/Subtype", 8, &v_Subtype_name); | ||
1179 | } | ||
1180 | #if 1 | ||
1181 | if (pcs->params.device_n.devn_process_space != NULL) { | ||
1182 | cos_dict_t *process; | ||
1183 | cos_array_t *components; | ||
1184 | cos_value_t v_process, v_components, v_process_space, v_process_name; | ||
1185 | int m; | ||
1186 | |||
1187 | process = cos_dict_alloc(pdev, "pdf_color_space(DeviceN)"); | ||
1188 | if (process == NULL) | ||
1189 | return_error(gs_error_VMerror); | ||
1190 | |||
1191 | COS_OBJECT_VALUE(&v_process, process); | ||
1192 | code = cos_dict_put((cos_dict_t *)pres_attributes->object, | ||
1193 | (const byte *)"/Process", 8, &v_process); | ||
1194 | if (code < 0) | ||
1195 | return code; | ||
1196 | |||
1197 | code = pdf_color_space_named(pdev, pgs, &v_process_space, NULL, pcs->params.device_n.devn_process_space, pcsn, false, NULL, 0, keepICC); | ||
1198 | if (code < 0) | ||
1199 | return code; | ||
1200 | code = pdf_string_to_cos_name(pdev, (const byte *)"ColorSpace", 10, &v_process_name); | ||
1201 | if (code < 0) | ||
1202 | return code; | ||
1203 | code = cos_dict_put(process, v_process_name.contents.chars.data, | ||
1204 | v_process_name.contents.chars.size, &v_process_space); | ||
1205 | if (code < 0) | ||
1206 | return code; | ||
1207 | |||
1208 | components = cos_array_alloc(pdev, "pdf_color_space(DeviceN)"); | ||
1209 | if (components == NULL) { | ||
1210 | return_error(gs_error_VMerror); | ||
1211 | } | ||
1212 | COS_OBJECT_VALUE(&v_components, components); | ||
1213 | code = cos_dict_put((cos_dict_t *)process, | ||
1214 | (const byte *)"/Components", 11, &v_components); | ||
1215 | if (code < 0) | ||
1216 | return code; | ||
1217 | for (m=0;m < pcs->params.device_n.num_process_names;m++) { | ||
1218 | code = pdf_string_to_cos_name(pdev, (const byte *)pcs->params.device_n.process_names[m], strlen(pcs->params.device_n.process_names[m]), &v_process_name); | ||
1219 | if (code < 0) | ||
1220 | return code; | ||
1221 | code = cos_array_put(components, m, &v_process_name); | ||
1222 | if (code < 0) | ||
1223 | return code; | ||
1224 | } | ||
1225 | |||
1226 | } | ||
1227 | #endif | ||
1153 | if (pcs->params.device_n.colorants != NULL) { | 1228 | if (pcs->params.device_n.colorants != NULL) { |
1154 | cos_dict_t *colorants = cos_dict_alloc(pdev, "pdf_color_space(DeviceN)"); | 1229 | cos_dict_t *colorants = cos_dict_alloc(pdev, "pdf_color_space(DeviceN)"); |
1155 | cos_value_t v_colorants, v_separation, v_colorant_name; | 1230 | cos_value_t v_colorants, v_separation, v_colorant_name; |
1156 | const gs_device_n_colorant *csa; | 1231 | const gs_device_n_colorant *csa; |
1157 | pdf_resource_t *pres_attributes; | ||
1158 | 1232 | ||
1159 | if (colorants == NULL) | 1233 | if (colorants == NULL) |
1160 | return_error(gs_error_VMerror); | 1234 | return_error(gs_error_VMerror); |
1235 | #if 0 | ||
1161 | code = pdf_alloc_resource(pdev, resourceOther, 0, &pres_attributes, -1); | 1236 | code = pdf_alloc_resource(pdev, resourceOther, 0, &pres_attributes, -1); |
1162 | if (code < 0) | 1237 | if (code < 0) |
1163 | return code; | 1238 | return code; |
1164 | cos_become(pres_attributes->object, cos_type_dict); | 1239 | cos_become(pres_attributes->object, cos_type_dict); |
1240 | #endif | ||
1241 | |||
1165 | COS_OBJECT_VALUE(&v_colorants, colorants); | 1242 | COS_OBJECT_VALUE(&v_colorants, colorants); |
1166 | code = cos_dict_put((cos_dict_t *)pres_attributes->object, | 1243 | code = cos_dict_put((cos_dict_t *)pres_attributes->object, |
1167 | (const byte *)"/Colorants", 10, &v_colorants); | 1244 | (const byte *)"/Colorants", 10, &v_colorants); |
@@ -1181,11 +1258,13 @@ pdf_color_space_named(gx_device_pdf *pdev, const gs_gstate * pgs, | |||
1181 | if (code < 0) | 1258 | if (code < 0) |
1182 | return code; | 1259 | return code; |
1183 | } | 1260 | } |
1261 | } | ||
1262 | if (pres_attributes != NULL) { | ||
1184 | code = pdf_substitute_resource(pdev, &pres_attributes, resourceOther, NULL, true); | 1263 | code = pdf_substitute_resource(pdev, &pres_attributes, resourceOther, NULL, true); |
1185 | if (code < 0) | 1264 | if (code < 0) |
1186 | return code; | 1265 | return code; |
1187 | pres_attributes->where_used |= pdev->used_mask; | 1266 | pres_attributes->where_used |= pdev->used_mask; |
1188 | va = &v_attriburtes; | 1267 | va = &v_attributes; |
1189 | COS_OBJECT_VALUE(va, pres_attributes->object); | 1268 | COS_OBJECT_VALUE(va, pres_attributes->object); |
1190 | } | 1269 | } |
1191 | if ((code = pdf_separation_color_space(pdev, pgs, pca, "/DeviceN", &v, | 1270 | if ((code = pdf_separation_color_space(pdev, pgs, pca, "/DeviceN", &v, |