[cups.development] How to find out end of file in raster format

Michael Sweet msweet at apple.com
Mon Dec 7 13:45:08 PST 2009


On Dec 7, 2009, at 11:54 AM, solomon wrote:
> ...
> how do i find out blank lines in the raster data ?
> is it like
> ex:  if(buffer == NULL) // declare as blank line
> 
> Please give me some ideas

You have to look at the data in the line buffer.  For RGB and grayscale color spaces, you can compare the lines to 255 to see if it is blank:

    if (buffer[0] == 255 && !memcmp(buffer, buffer + 1, header.cupsBytesPerLine - 1))
    {
      // line is blank
    }
    else
    {
      // line is not blank
    }

For CMY, CMYK, and K color spaces, compare buffer[0] to 0 instead of 255 (the memcmp is the same).

___________________________________________________
Michael Sweet, Senior Printing System Engineer







More information about the cups mailing list