fn spc_read_color_pdf(spe: &mut SpcEnv, ap: &mut SpcArg) -> Result<PdfColor, ()> {
    let mut isarry: bool = false;
    ap.cur.skip_blank();
    if ap.cur[0] == b'[' {
        ap.cur = &ap.cur[1..];
        ap.cur.skip_blank();
        isarry = true
    }
    let cv = read_numbers::<[_; 4]>(ap);
    let mut result = match cv.len() {
        1 => PdfColor::from_gray(cv[0]).map_err(|err| err.warn()),
        3 => PdfColor::from_rgb(cv[0], cv[1], cv[2]).map_err(|err| err.warn()),
        4 => PdfColor::from_cmyk(cv[0], cv[1], cv[2], cv[3]).map_err(|err| err.warn()),
        _ => {
            /* Try to read the color names defined in dvipsname.def */
            if let Some(q) = ap.cur.parse_c_ident() {
                let result = PdfColor::named(&q).ok_or(());
                if result.is_err() {
                    spc_warn!(
                        spe,
                        "Unrecognized color name: {}, keep the current color",
                        q,
                    );
                }
                result
            } else {
                spc_warn!(spe, "No valid color specified?");
                return Err(());
            }
        }
    };
    if isarry {
        ap.cur.skip_blank();
        if ap.cur.is_empty() || ap.cur[0] != b']' {
            spc_warn!(spe, "Unbalanced \'[\' and \']\' in color specification.");
            result = Err(())
        } else {
            ap.cur = &ap.cur[1..];
        }
    }
    result
}
/* Argument for this is PDF_Number or PDF_Array.
 * But we ignore that since we don't want to add
 * dependency to pdfxxx and @foo can not be
 * allowed for color specification. "pdf" here
 * means pdf: special syntax.
 */
Argument for this is PDF_Number or PDF_Array.
But we ignore that since we don't want to add
dependency to pdfxxx and @foo can not be
allowed for color specification. "pdf" here
means pdf: special syntax.
Argument for this is PDF_Number or PDF_Array . But we ignore that since we don ' t want to add dependency to pdfxxx and @foo can not be allowed for color specification . " pdf " here means pdf : special syntax .
fn spc_read_color_pdf(spe: &mut SpcEnv, ap: &mut SpcArg) -> Result<PdfColor, ()> {
    let mut isarry: bool = false;
    ap.cur.skip_blank();
    if ap.cur[0] == b'[' {
        ap.cur = &ap.cur[1..];
        ap.cur.skip_blank();
        isarry = true
    }
    let cv = read_numbers::<[_; 4]>(ap);
    let mut result = match cv.len() {
        1 => PdfColor::from_gray(cv[0]).map_err(|err| err.warn()),
        3 => PdfColor::from_rgb(cv[0], cv[1], cv[2]).map_err(|err| err.warn()),
        4 => PdfColor::from_cmyk(cv[0], cv[1], cv[2], cv[3]).map_err(|err| err.warn()),
        _ => {
            /* Try to read the color names defined in dvipsname.def */
            if let Some(q) = ap.cur.parse_c_ident() {
                let result = PdfColor::named(&q).ok_or(());
                if result.is_err() {
                    spc_warn!(
                        spe,
                        "Unrecognized color name: {}, keep the current color",
                        q,
                    );
                }
                result
            } else {
                spc_warn!(spe, "No valid color specified?");
                return Err(());
            }
        }
    };
    if isarry {
        ap.cur.skip_blank();
        if ap.cur.is_empty() || ap.cur[0] != b']' {
            spc_warn!(spe, "Unbalanced \'[\' and \']\' in color specification.");
            result = Err(())
        } else {
            ap.cur = &ap.cur[1..];
        }
    }
    result
}
fn spc_read_color_pdf ( spe : & mut SpcEnv , ap : & mut SpcArg ) -> Result < PdfColor , ( ) > { let mut isarry : bool = false ; ap . cur . skip_blank ( ) ; if ap . cur [ 0 ] == b'[' { ap . cur = & ap . cur [ 1 .. ] ; ap . cur . skip_blank ( ) ; isarry = true } let cv = read_numbers :: < [ _ ; 4 ] > ( ap ) ; let mut result = match cv . len ( ) { 1 => PdfColor :: from_gray ( cv [ 0 ] ) . map_err ( | err | err . warn ( ) ) , 3 => PdfColor :: from_rgb ( cv [ 0 ] , cv [ 1 ] , cv [ 2 ] ) . map_err ( | err | err . warn ( ) ) , 4 => PdfColor :: from_cmyk ( cv [ 0 ] , cv [ 1 ] , cv [ 2 ] , cv [ 3 ] ) . map_err ( | err | err . warn ( ) ) , _ => { /* Try to read the color names defined in dvipsname.def */ if let Some ( q ) = ap . cur . parse_c_ident ( ) { let result = PdfColor :: named ( & q ) . ok_or ( ( ) ) ; if result . is_err ( ) { spc_warn ! ( spe " " q ) ; } result } else { spc_warn ! ( spe " " ) ; return Err ( ( ) ) ; } } } ; if isarry { ap . cur . skip_blank ( ) ; if ap . cur . is_empty ( ) || ap . cur [ 0 ] != b']' { spc_warn ! ( spe " \' \' \' \' " ) ; result = Err ( ( ) ) } else { ap . cur = & ap . cur [ 1 .. ] ; } } result }
Argument for this is PDF_Number or PDF_Array.
Argument for this is PDF_Number or PDF_Array .
spe
&mut SpcEnv
ap
&mut SpcArg