예제 #1
0
static int
tfax_get_params(gx_device * dev, gs_param_list * plist)
{
    gx_device_tfax *const tfdev = (gx_device_tfax *)dev;
    int code = gdev_fax_get_params(dev, plist);
    int ecode = code;
    gs_param_string comprstr;

    if ((code = param_write_long(plist, "MaxStripSize", &tfdev->MaxStripSize)) < 0)
        ecode = code;
    if ((code = param_write_int(plist, "FillOrder", &tfdev->FillOrder)) < 0)
        ecode = code;
    if ((code = param_write_bool(plist, "BigEndian", &tfdev->BigEndian)) < 0)
        ecode = code;
#if (TIFFLIB_VERSION >= 20111221)
    if ((code = param_write_bool(plist, "UseBigTIFF", &tfdev->UseBigTIFF)) < 0)
        ecode = code;
#endif
    if ((code = param_write_bool(plist, "TIFFDateTime", &tfdev->write_datetime)) < 0)
        ecode = code;
    if ((code = tiff_compression_param_string(&comprstr, tfdev->Compression)) < 0 ||
        (code = param_write_string(plist, "Compression", &comprstr)) < 0)
        ecode = code;

    return ecode;
}
예제 #2
0
/* Get parameters. */
int
gdev_pdf_get_params(gx_device * dev, gs_param_list * plist)
{
    gx_device_pdf *pdev = (gx_device_pdf *) dev;
    float cl = (float)pdev->CompatibilityLevel;
    int code;
    int cdv = CoreDistVersion;
    int EmbedFontObjects = 1;

    pdev->ParamCompatibilityLevel = cl;
    code = gdev_psdf_get_params(dev, plist);
    if (code < 0 ||
	(code = param_write_int(plist, ".EmbedFontObjects", &EmbedFontObjects)) < 0 ||
	(code = param_write_int(plist, "CoreDistVersion", &cdv)) < 0 ||
	(code = param_write_float(plist, "CompatibilityLevel", &cl)) < 0 ||
	(pdev->is_ps2write && (code = param_write_string(plist, "OPDFReadProcsetPath", &pdev->OPDFReadProcsetPath)) < 0) ||
	(!pdev->is_ps2write && (code = param_write_bool(plist, "ForOPDFRead", &pdev->ForOPDFRead)) < 0) ||
	/* Indicate that we can process pdfmark and DSC. */
	(param_requested(plist, "pdfmark") > 0 &&
	 (code = param_write_null(plist, "pdfmark")) < 0) ||
	(param_requested(plist, "DSC") > 0 &&
	 (code = param_write_null(plist, "DSC")) < 0) ||
	(code = gs_param_write_items(plist, pdev, NULL, pdf_param_items)) < 0
	);
    return code;
}
예제 #3
0
static int
tiff_get_some_params(gx_device * dev, gs_param_list * plist, int which)
{
    gx_device_tiff *const tfdev = (gx_device_tiff *)dev;
    int code = gdev_prn_get_params(dev, plist);
    int ecode = code;
    gs_param_string comprstr;

    if ((code = param_write_bool(plist, "BigEndian", &tfdev->BigEndian)) < 0)
        ecode = code;
    if ((code = tiff_compression_param_string(&comprstr, tfdev->Compression)) < 0 ||
        (code = param_write_string(plist, "Compression", &comprstr)) < 0)
        ecode = code;
    if (which & 1)
    {
      if ((code = param_write_long(plist, "DownScaleFactor", &tfdev->DownScaleFactor)) < 0)
          ecode = code;
    }
    if ((code = param_write_long(plist, "MaxStripSize", &tfdev->MaxStripSize)) < 0)
        ecode = code;
    if ((code = param_write_long(plist, "AdjustWidth", &tfdev->AdjustWidth)) < 0)
        ecode = code;
    if ((code = param_write_long(plist, "MinFeatureSize", &tfdev->MinFeatureSize)) < 0)
        ecode = code;
    return ecode;
}
예제 #4
0
static int
mac_get_params(gx_device *dev, gs_param_list *plist)
{
	gx_device_macos		*mdev	= (gx_device_macos *)dev;
	
	int						code;
    gs_param_string			outputFile;
	
	code = gx_default_get_params(dev, plist);
	if (code < 0)
		return code;
	
	// UseExternalFonts
	code = param_write_bool(plist, "UseExternalFonts", &(mdev->useXFonts));
	
	// color depth
	code = param_write_int(plist, "BitsPerPixel", &(mdev->color_info.depth));
	
	// output file name
	outputFile.data = (const byte *) mdev->outputFileName;
	outputFile.size = strlen(mdev->outputFileName);
	outputFile.persistent = false;
	code = param_write_string(plist, "OutputFile", &outputFile);
	
	return code;
}
예제 #5
0
/* We implement get_params to provide a way to read out the bounding box. */
static int
bbox_get_params(gx_device * dev, gs_param_list * plist)
{
    gx_device_bbox *const bdev = (gx_device_bbox *) dev;
    gs_fixed_rect fbox;
    int code = gx_forward_get_params(dev, plist);
    gs_param_float_array bba;
    float bbox[4];

    if (code < 0)
	return code;
    /*
     * We might be calling get_params before the device has been
     * initialized: in this case, box_proc_data = 0.
     */
    if (bdev->box_proc_data == 0)
	fbox = bdev->bbox;
    else
	BBOX_GET_BOX(bdev, &fbox);
    bbox[0] = fixed2float(fbox.p.x);
    bbox[1] = fixed2float(fbox.p.y);
    bbox[2] = fixed2float(fbox.q.x);
    bbox[3] = fixed2float(fbox.q.y);
    bba.data = bbox, bba.size = 4, bba.persistent = false;
    code = param_write_float_array(plist, "PageBoundingBox", &bba);
    if (code < 0)
        return code;
    code = param_write_bool(plist, "WhiteIsOpaque", &bdev->white_is_opaque);
    return code;
}
예제 #6
0
static int
hpjet_get_params(gx_device *pdev, gs_param_list *plist)
{
    gx_device_hpjet *dev = (gx_device_hpjet *)pdev;
    int code = gdev_prn_get_params(pdev, plist);

    if (code >= 0)
    {
        code = param_write_bool(plist, "ManualFeed", &dev->ManualFeed);
    }
    if (code >= 0)
    {
        code = param_write_int(plist, "MediaPosition", &dev->MediaPosition);
    }
    if (code >=0)
        code = param_write_bool(plist, "Tumble", &dev->Tumble);
    return code;
}
예제 #7
0
파일: gdevppla.c 프로젝트: 99years/plan9
/* Augment get/put_params to add UsePlanarBuffer. */
int
gdev_prn_get_params_planar(gx_device * pdev, gs_param_list * plist,
			   bool *pupb)
{
    int ecode = gdev_prn_get_params(pdev, plist);

    if (ecode < 0)
	return ecode;
    return param_write_bool(plist, "UsePlanarBuffer", pupb);
}
예제 #8
0
/* Get device parameters */
int
win_pr2_get_params(gx_device * pdev, gs_param_list * plist)
{
    int code = gdev_prn_get_params(pdev, plist);

    win_pr2_copy_check(wdev);

    if (code >= 0)
	code = param_write_bool(plist, "NoCancel",
				&(wdev->nocancel));
    if (code >= 0)
	code = param_write_int(plist, "QueryUser",
				&(wdev->query_user));
    if (code >= 0)
	code = win_pr2_write_user_settings(wdev, plist);
    
    if ((code >= 0) && (wdev->Duplex_set > 0))
	code = param_write_bool(plist, "Tumble",
				&(wdev->tumble));

    return code;
}
예제 #9
0
static int
tfax_get_params(gx_device * dev, gs_param_list * plist)
{
    gx_device_tfax *const tfdev = (gx_device_tfax *)dev;
    int code = gdev_fax_get_params(dev, plist);
    int ecode = code;
    gs_param_string comprstr;

    if ((code = param_write_long(plist, "MaxStripSize", &tfdev->MaxStripSize)) < 0)
        ecode = code;
    if ((code = param_write_int(plist, "FillOrder", &tfdev->FillOrder)) < 0)
        ecode = code;
    if ((code = param_write_bool(plist, "BigEndian", &tfdev->BigEndian)) < 0)
        ecode = code;
    if ((code = tiff_compression_param_string(&comprstr, tfdev->Compression)) < 0 ||
        (code = param_write_string(plist, "Compression", &comprstr)) < 0)
        ecode = code;

    return ecode;
}
예제 #10
0
/* Get standard parameters. */
int
gx_default_get_params(gx_device * dev, gs_param_list * plist)
{
    int code;

    /* Standard page device parameters: */

    bool seprs = false;
    gs_param_string dns, pcms, profile_array[NUM_DEVICE_PROFILES];
    gsicc_rendering_intents_t profile_intents[NUM_DEVICE_PROFILES];
    bool devicegraytok = true;  /* Default if device profile stuct not set */
    int k;
    gs_param_float_array msa, ibba, hwra, ma;
    gs_param_string_array scna;
    char null_str[1]={'\0'};
    gs_param_string temp_str;

#define set_param_array(a, d, s)\
  (a.data = d, a.size = s, a.persistent = false);

    /* Non-standard parameters: */
    int colors = dev->color_info.num_components;
    int mns = colors;
    int depth = dev->color_info.depth;
    int GrayValues = dev->color_info.max_gray + 1;
    int HWSize[2];
    gs_param_int_array hwsa;
    gs_param_float_array hwma, mhwra;
    cmm_dev_profile_t *dev_profile;

    /* Fill in page device parameters. */

    param_string_from_string(dns, dev->dname);
    {
        const char *cms = get_process_color_model_name(dev);

        /* We might have an uninitialized device with */
        /* color_info.num_components = 0.... */
        if ((cms != NULL) && (*cms != '\0'))
            param_string_from_string(pcms, cms);
        else
            pcms.data = 0;
    }

    set_param_array(hwra, dev->HWResolution, 2);
    set_param_array(msa, dev->MediaSize, 2);
    set_param_array(ibba, dev->ImagingBBox, 4);
    set_param_array(ma, dev->Margins, 2);
    set_param_array(scna, NULL, 0);

    /* Fill in non-standard parameters. */
    HWSize[0] = dev->width;
    HWSize[1] = dev->height;
    set_param_array(hwsa, HWSize, 2);
    set_param_array(hwma, dev->HWMargins, 4);
    set_param_array(mhwra, dev->MarginsHWResolution, 2);
    /* Check if the device profile is null.  If it is, then we need to
       go ahead and get it set up at this time.  If the proc is not
       set up yet then we are not going to do anything yet */
    if (dev->procs.get_profile != NULL) {
        code = dev_proc(dev, get_profile)(dev,  &dev_profile);
        if (dev_profile == NULL) { 
            code = gsicc_init_device_profile_struct(dev, NULL, 0);
            code = dev_proc(dev, get_profile)(dev,  &dev_profile);
        } 
        for (k = 0; k < NUM_DEVICE_PROFILES; k++) {
            if (dev_profile->device_profile[k] == NULL) {
                param_string_from_string(profile_array[k], null_str);
                profile_intents[k] = gsPERCEPTUAL;
            } else {
                param_string_from_string(profile_array[k], 
                    dev_profile->device_profile[k]->name);
                profile_intents[k] = dev_profile->intent[k];
            }
        }
        devicegraytok = dev_profile->devicegraytok;
    } else {
        for (k = 0; k < NUM_DEVICE_PROFILES; k++) {
            param_string_from_string(profile_array[k], null_str);
            profile_intents[k] = gsPERCEPTUAL;
        }
    }
    /* Transmit the values. */
       if (
        /* Standard parameters */
        (code = param_write_name(plist, "OutputDevice", &dns)) < 0 ||
#ifdef PAGESIZE_IS_MEDIASIZE
        (code = param_write_float_array(plist, "PageSize", &msa)) < 0 ||
#endif
        (code = (pcms.data == 0 ? 0 :
                 param_write_name(plist, "ProcessColorModel", &pcms))) < 0 ||
        (code = param_write_float_array(plist, "HWResolution", &hwra)) < 0 ||
        (code = (dev->ImagingBBox_set ?
                 param_write_float_array(plist, "ImagingBBox", &ibba) :
                 param_write_null(plist, "ImagingBBox"))) < 0 ||
        (code = param_write_float_array(plist, "Margins", &ma)) < 0 ||
        (code = param_write_int(plist, "MaxSeparations", &mns)) < 0 ||
        (code = (dev->NumCopies_set < 0 ||
                 (*dev_proc(dev, get_page_device))(dev) == 0 ? 0:
                 dev->NumCopies_set ?
                 param_write_int(plist, "NumCopies", &dev->NumCopies) :
                 param_write_null(plist, "NumCopies"))) < 0 ||
        (code = param_write_name_array(plist, "SeparationColorNames", &scna)) < 0 ||
        (code = param_write_bool(plist, "Separations", &seprs)) < 0 ||
        (code = param_write_bool(plist, "UseCIEColor", &dev->UseCIEColor)) < 0 ||
        /* Non-standard parameters */
        /* Note:  if change is made in NUM_DEVICE_PROFILES we need to name
           that profile here for the device parameter on the command line */
        (code = param_write_bool(plist, "DeviceGrayToK", &devicegraytok)) < 0 ||
        (code = param_write_string(plist,"OutputICCProfile", &(profile_array[0]))) < 0 ||
        (code = param_write_string(plist,"GraphicICCProfile", &(profile_array[1]))) < 0 ||
        (code = param_write_string(plist,"ImageICCProfile", &(profile_array[2]))) < 0 ||
        (code = param_write_string(plist,"TextICCProfile", &(profile_array[3]))) < 0 ||
        (code = param_write_int(plist,"RenderIntent", &(profile_intents[0]))) < 0 ||
        (code = param_write_int(plist,"GraphicIntent", &(profile_intents[1]))) < 0 ||
        (code = param_write_int(plist,"ImageIntent", &(profile_intents[2]))) < 0 ||
        (code = param_write_int(plist,"TextIntent", &(profile_intents[3]))) < 0 ||
        (code = param_write_int_array(plist, "HWSize", &hwsa)) < 0 ||
        (code = param_write_float_array(plist, ".HWMargins", &hwma)) < 0 ||
        (code = param_write_float_array(plist, ".MarginsHWResolution", &mhwra)) < 0 ||
        (code = param_write_float_array(plist, ".MediaSize", &msa)) < 0 ||
        (code = param_write_string(plist, "Name", &dns)) < 0 ||
        (code = param_write_int(plist, "Colors", &colors)) < 0 ||
        (code = param_write_int(plist, "BitsPerPixel", &depth)) < 0 ||
        (code = param_write_int(plist, "GrayValues", &GrayValues)) < 0 ||
        (code = param_write_long(plist, "PageCount", &dev->PageCount)) < 0 ||
        (code = param_write_bool(plist, ".IgnoreNumCopies", &dev->IgnoreNumCopies)) < 0 ||
        (code = param_write_int(plist, "TextAlphaBits",
                                &dev->color_info.anti_alias.text_bits)) < 0 ||
        (code = param_write_int(plist, "GraphicsAlphaBits",
                                &dev->color_info.anti_alias.graphics_bits)) < 0 ||
        (code = param_write_bool(plist, ".LockSafetyParams", &dev->LockSafetyParams)) < 0 ||
        (code = param_write_int(plist, "MaxPatternBitmap", &dev->MaxPatternBitmap)) < 0
        )
        return code;

    /* If LeadingEdge was set explicitly, report it here. */
    if (dev->LeadingEdge & LEADINGEDGE_SET_MASK) {
        int leadingedge = dev->LeadingEdge & LEADINGEDGE_MASK;
        code = param_write_int(plist, "LeadingEdge", &leadingedge);
    }
    if (code < 0)
        return code;

    /* Fill in color information. */

    if (colors > 1) {
        int RGBValues = dev->color_info.max_color + 1;
        long ColorValues = (depth >= 32 ? -1 : 1L << depth); /* value can only be 32 bits */

        if ((code = param_write_int(plist, "RedValues", &RGBValues)) < 0 ||
            (code = param_write_int(plist, "GreenValues", &RGBValues)) < 0 ||
            (code = param_write_int(plist, "BlueValues", &RGBValues)) < 0 ||
            (code = param_write_long(plist, "ColorValues", &ColorValues)) < 0
            )
            return code;
    }
    if (param_requested(plist, "HWColorMap")) {
        byte palette[3 << 8];

        if (param_HWColorMap(dev, palette)) {
            gs_param_string hwcms;

            hwcms.data = palette, hwcms.size = colors << depth,
                hwcms.persistent = false;
            if ((code = param_write_string(plist, "HWColorMap", &hwcms)) < 0)
                return code;
        }
    }

    return 0;
}
예제 #11
0
static int
current_param_list(i_ctx_t *i_ctx_p, const param_set * pset,
                   const ref * psref /*t_string */ )
{
    stack_param_list list;
    gs_param_list *const plist = (gs_param_list *)&list;
    int code = 0;
    unsigned int i;

    stack_param_list_write(&list, &o_stack, NULL, iimemory);
    for (i = 0; i < pset->long_count; i++) {
        const char *pname = pset->long_defs[i].pname;

        if (pname_matches(pname, psref)) {
            long val = (*pset->long_defs[i].current)(i_ctx_p);

            code = param_write_long(plist, pname, &val);
            if (code < 0)
                return code;
        }
    }
    for (i = 0; i < pset->bool_count; i++) {
        const char *pname = pset->bool_defs[i].pname;

        if (pname_matches(pname, psref)) {
            bool val = (*pset->bool_defs[i].current)(i_ctx_p);

            code = param_write_bool(plist, pname, &val);
            if (code < 0)
                return code;
        }
    }
    for (i = 0; i < pset->string_count; i++) {
        const char *pname = pset->string_defs[i].pname;

        if (pname_matches(pname, psref)) {
            gs_param_string val;

            (*pset->string_defs[i].current)(i_ctx_p, &val);
            code = param_write_string(plist, pname, &val);
            if (code < 0)
                return code;
        }
    }
    if (psref) {
        /*
         * Scanner options can be read, but only individually by .getuserparam.
         * This avoids putting them into userparams, and being affected by save/restore.
         */
        const char *pname;
        bool val;
        int code;

        switch (ztoken_get_scanner_option(psref, i_ctx_p->scanner_options, &pname)) {
            case 0:
                code = param_write_null(plist, pname);
                break;
            case 1:
                val = true;
                code = param_write_bool(plist, pname, &val);
                break;
            default:
                code = 0;
                break;
        }
        if (code < 0)
            return code;
    }
    return code;
}
예제 #12
0
static int
win_pr2_write_user_settings(gx_device_win_pr2 * wdev, gs_param_list * plist)
{
    gs_param_dict dict;
    gs_param_int_array range;
    gs_param_float_array box;
    gs_param_string docn;
    gs_param_string papn;
    int array[2];
    const char* pname = "UserSettings";
    int code;

    dict.size = 12;
    code = param_begin_write_dict(plist, pname, &dict, false);
    if (code < 0) return code;

    array[0] = wdev->doc_page_begin;
    array[1] = wdev->doc_page_end;
    range.data = array;
    range.size = 2;
    range.persistent = false;
    code = param_write_int_array(dict.list, "DocumentRange", &range);
    if (code < 0) goto error;

    array[0] = wdev->user_page_begin;
    array[1] = wdev->user_page_end;
    range.data = array;
    range.size = 2;
    range.persistent = false;
    code = param_write_int_array(dict.list, "SelectedRange", &range);
    if (code < 0) goto error;

    box.data = wdev->user_media_size;
    box.size = 2;
    box.persistent = false;
    code = param_write_float_array(dict.list, "MediaSize", &box);
    if (code < 0) goto error;

    code = param_write_int(dict.list, "Copies", &wdev->user_copies);
    if (code < 0) goto error;

    code = param_write_int(dict.list, "Paper", &wdev->user_paper);
    if (code < 0) goto error;
    
    code = param_write_int(dict.list, "Orientation", &wdev->user_orient);
    if (code < 0) goto error;
    
    code = param_write_int(dict.list, "Color", &wdev->user_color);
    if (code < 0) goto error;
    
    code = param_write_int(dict.list, "MaxResolution", &wdev->max_dpi);
    if (code < 0) goto error;
    
    code = param_write_int(dict.list, "PrintCopies", &wdev->print_copies);
    if (code < 0) goto error;

    docn.data = (const byte*)wdev->doc_name;
    docn.size = strlen(wdev->doc_name);
    docn.persistent = false;

    code = param_write_string(dict.list, "DocumentName", &docn);
    if (code < 0) goto error;
    
    papn.data = (const byte*)wdev->paper_name;
    papn.size = strlen(wdev->paper_name);
    papn.persistent = false;
    
    code = param_write_string(dict.list, "PaperName", &papn);
    if (code < 0) goto error;

    code = param_write_bool(dict.list, "UserChangedSettings", &wdev->user_changed_settings);

error:
    param_end_write_dict(plist, pname, &dict);
    return code;
}
예제 #13
0
/* Get standard parameters. */
int
gx_default_get_params(gx_device * dev, gs_param_list * plist)
{
    int code;

    /* Standard page device parameters: */

    bool seprs = false;
    gs_param_string dns, pcms;
    gs_param_float_array msa, ibba, hwra, ma;
    gs_param_string_array scna;

#define set_param_array(a, d, s)\
  (a.data = d, a.size = s, a.persistent = false);

    /* Non-standard parameters: */

    int colors = dev->color_info.num_components;
    int mns = colors;
    int depth = dev->color_info.depth;
    int GrayValues = dev->color_info.max_gray + 1;
    int HWSize[2];
    gs_param_int_array hwsa;
    gs_param_float_array hwma, mhwra;

    /* Fill in page device parameters. */

    param_string_from_string(dns, dev->dname);
    {
	const char *cms = get_process_color_model_name(dev);

	/* We might have an uninitialized device with */
	/* color_info.num_components = 0.... */
	if ((cms != NULL) && (*cms != '\0'))
	    param_string_from_string(pcms, cms);
	else
	    pcms.data = 0;
    }
    set_param_array(hwra, dev->HWResolution, 2);
    set_param_array(msa, dev->MediaSize, 2);
    set_param_array(ibba, dev->ImagingBBox, 4);
    set_param_array(ma, dev->Margins, 2);
    set_param_array(scna, NULL, 0);

    /* Fill in non-standard parameters. */

    HWSize[0] = dev->width;
    HWSize[1] = dev->height;
    set_param_array(hwsa, HWSize, 2);
    set_param_array(hwma, dev->HWMargins, 4);
    set_param_array(mhwra, dev->MarginsHWResolution, 2);

    /* Transmit the values. */

    if (

	/* Standard parameters */

	(code = param_write_name(plist, "OutputDevice", &dns)) < 0 ||
#ifdef PAGESIZE_IS_MEDIASIZE
	(code = param_write_float_array(plist, "PageSize", &msa)) < 0 ||
#endif
	(code = (pcms.data == 0 ? 0 :
		 param_write_name(plist, "ProcessColorModel", &pcms))) < 0 ||
	(code = param_write_float_array(plist, "HWResolution", &hwra)) < 0 ||
	(code = (dev->ImagingBBox_set ?
		 param_write_float_array(plist, "ImagingBBox", &ibba) :
		 param_write_null(plist, "ImagingBBox"))) < 0 ||
	(code = param_write_float_array(plist, "Margins", &ma)) < 0 ||
	(code = param_write_int(plist, "MaxSeparations", &mns)) < 0 ||
	(code = (dev->NumCopies_set < 0 ||
		 (*dev_proc(dev, get_page_device))(dev) == 0 ? 0:
		 dev->NumCopies_set ?
		 param_write_int(plist, "NumCopies", &dev->NumCopies) :
		 param_write_null(plist, "NumCopies"))) < 0 ||
	(code = param_write_name_array(plist, "SeparationColorNames", &scna)) < 0 ||
	(code = param_write_bool(plist, "Separations", &seprs)) < 0 ||
	(code = param_write_bool(plist, "UseCIEColor", &dev->UseCIEColor)) < 0 ||

	/* Non-standard parameters */

	(code = param_write_int_array(plist, "HWSize", &hwsa)) < 0 ||
	(code = param_write_float_array(plist, ".HWMargins", &hwma)) < 0 ||
	(code = param_write_float_array(plist, ".MarginsHWResolution", &mhwra)) < 0 ||
	(code = param_write_float_array(plist, ".MediaSize", &msa)) < 0 ||
	(code = param_write_string(plist, "Name", &dns)) < 0 ||
	(code = param_write_int(plist, "Colors", &colors)) < 0 ||
	(code = param_write_int(plist, "BitsPerPixel", &depth)) < 0 ||
	(code = param_write_int(plist, "GrayValues", &GrayValues)) < 0 ||
	(code = param_write_long(plist, "PageCount", &dev->PageCount)) < 0 ||
	(code = param_write_bool(plist, ".IgnoreNumCopies", &dev->IgnoreNumCopies)) < 0 ||
	(code = param_write_int(plist, "TextAlphaBits",
				&dev->color_info.anti_alias.text_bits)) < 0 ||
	(code = param_write_int(plist, "GraphicsAlphaBits",
				&dev->color_info.anti_alias.graphics_bits)) < 0 ||
	(code = param_write_bool(plist, ".LockSafetyParams", &dev->LockSafetyParams)) < 0 
	)
	return code;

    /* If LeadingEdge was set explicitly, report it here. */
    if (dev->LeadingEdge & LEADINGEDGE_SET_MASK) {
	int leadingedge = dev->LeadingEdge & LEADINGEDGE_MASK;
	code = param_write_int(plist, "LeadingEdge", &leadingedge);
    }
    if (code < 0)
	return code;

    /* Fill in color information. */

    if (colors > 1) {
	int RGBValues = dev->color_info.max_color + 1;
	long ColorValues = (depth >= 32 ? -1 : 1L << depth); /* value can only be 32 bits */

	if ((code = param_write_int(plist, "RedValues", &RGBValues)) < 0 ||
	    (code = param_write_int(plist, "GreenValues", &RGBValues)) < 0 ||
	    (code = param_write_int(plist, "BlueValues", &RGBValues)) < 0 ||
	    (code = param_write_long(plist, "ColorValues", &ColorValues)) < 0
	    )
	    return code;
    }
    if (param_requested(plist, "HWColorMap")) {
	byte palette[3 << 8];

	if (param_HWColorMap(dev, palette)) {
	    gs_param_string hwcms;

	    hwcms.data = palette, hwcms.size = colors << depth,
		hwcms.persistent = false;
	    if ((code = param_write_string(plist, "HWColorMap", &hwcms)) < 0)
		return code;
	}
    }

    return 0;
}