Exemple #1
0
void pdf_convpixmap(fz_colorspace *ss, fz_pixmap *sp, fz_colorspace *ds, fz_pixmap *dp)
{
	pdf_logimage("convert pixmap from %s to %s\n", ss->name, ds->name);

	if (ss == pdf_devicegray)
	{
		if (ds == pdf_devicergb) fastgraytorgb(sp, dp);
		else if (ds == pdf_devicecmyk) fastgraytocmyk(sp, dp);
		else fz_stdconvpixmap(ss, sp, ds, dp);
	}

	else if (ss == pdf_devicergb)
	{
		if (ds == pdf_devicegray) fastrgbtogray(sp, dp);
		else if (ds == pdf_devicecmyk) fastrgbtocmyk(sp, dp);
		else fz_stdconvpixmap(ss, sp, ds, dp);

	}

	else if (ss == pdf_devicecmyk)
	{
		if (ds == pdf_devicegray) fastcmyktogray(sp, dp);
		else if (ds == pdf_devicergb) fastcmyktorgb(sp, dp);
		else fz_stdconvpixmap(ss, sp, ds, dp);
	}

	else fz_stdconvpixmap(ss, sp, ds, dp);
}
Exemple #2
0
void
fz_convertpixmap(fz_pixmap *sp, fz_pixmap *dp)
{
	fz_colorspace *ss = sp->colorspace;
	fz_colorspace *ds = dp->colorspace;

	assert(ss && ds);

	if (sp->mask)
		dp->mask = fz_keeppixmap(sp->mask);
	dp->interpolate = sp->interpolate;

	if (ss == fz_devicegray)
	{
		if (ds == fz_devicergb) fastgraytorgb(sp, dp);
		else if (ds == fz_devicebgr) fastgraytorgb(sp, dp); /* bgr == rgb here */
		else if (ds == fz_devicecmyk) fastgraytocmyk(sp, dp);
		else fz_stdconvpixmap(sp, dp);
	}

	else if (ss == fz_devicergb)
	{
		if (ds == fz_devicegray) fastrgbtogray(sp, dp);
		else if (ds == fz_devicebgr) fastrgbtobgr(sp, dp);
		else if (ds == fz_devicecmyk) fastrgbtocmyk(sp, dp);
		else fz_stdconvpixmap(sp, dp);
	}

	else if (ss == fz_devicebgr)
	{
		if (ds == fz_devicegray) fastbgrtogray(sp, dp);
		else if (ds == fz_devicergb) fastrgbtobgr(sp, dp); /* bgr = rgb here */
		else if (ds == fz_devicecmyk) fastbgrtocmyk(sp, dp);
		else fz_stdconvpixmap(sp, dp);
	}

	else if (ss == fz_devicecmyk)
	{
		if (ds == fz_devicegray) fastcmyktogray(sp, dp);
		else if (ds == fz_devicebgr) fastcmyktobgr(sp, dp);
		else if (ds == fz_devicergb) fastcmyktorgb(sp, dp);
		else fz_stdconvpixmap(sp, dp);
	}

	else fz_stdconvpixmap(sp, dp);
}