[poppler] Seeking development aids: Conversion colorspace -> SplashColorMode

Thomas Freitag Thomas.Freitag at kabelmail.de
Sat Oct 9 02:22:21 PDT 2010


  Hi Christian!

Does this code snippet help You? :

     state->setFillColor(&gfxColor);
   switch (colorMode) {
   case splashModeMono1:
   case splashModeMono8:
     state->getFillGray(&gray);
     color[0] = colToByte(gray);
     break;
   case splashModeXBGR8:
     color[3] = 255;
   case splashModeRGB8:
   case splashModeBGR8:
     state->getFillRGB(&rgb);
     color[0] = colToByte(rgb.r);
     color[1] = colToByte(rgb.g);
     color[2] = colToByte(rgb.b);
     break;
#if SPLASH_CMYK
   case splashModeCMYK8:
     state->getFillCMYK(&cmyk);
     color[0] = colToByte(cmyk.c);
     color[1] = colToByte(cmyk.m);
     color[2] = colToByte(cmyk.y);
     color[3] = colToByte(cmyk.k);
     break;
#endif
   }

     splashColorCopy(c, color);

It's part of my patch from bug
https://bugs.freedesktop.org/show_bug.cgi?id=30436
Have a look at it if You need more details!

Best regards,
Thomas

Am 08.10.2010 23:16, schrieb Christian Feuersaenger:
> Dear developers,
>
> as part of a patch for shaders (compare the related postings), I need 
> to convert a given GfxColor (with well-known GfxColorSpace) to a 
> SplashColorMode.
>
> Is there a standard procedure of the form
>
> gfxColorToSplashColor( GfxColorSpace* inputColorSpace, GfxColor* 
> input,  SplashColorMode outputMode, GuChar* output ) ?
>
> I failed to find one so far, so I intent to write a helper routine 
> which does it by means of the GfxColorSpace::getRGB() and its friends 
> and switch statements. But if there is already a tested alternative 
> solution, I will prefer it.
>
> Thanks.
>
> Best regards
>
> Christian
> _______________________________________________
> poppler mailing list
> poppler at lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/poppler
>
> .
>




More information about the poppler mailing list