Main Page   Modules   Alphabetical List   Data Structures   File List   Data Fields   Globals  

src/main/color-raw.c File Reference

#include <gimp-print/gimp-print.h>
#include "gimp-print-internal.h"
#include <gimp-print/gimp-print-intl-internal.h>
#include <math.h>
#include <string.h>
#include "lut.h"

Go to the source code of this file.

Defines

#define RAW_COLOR_TO_COLOR_FUNC(T, bits)
#define GRAY_TO_COLOR_RAW_FUNC(T, bits)


Define Documentation

#define GRAY_TO_COLOR_RAW_FUNC T,
bits   
 

Value:

static unsigned                                                            \
gray_##bits##_to_color_raw(stp_const_vars_t vars, const unsigned char *in, \
                           unsigned short *out)                            \
{                                                                          \
  int i;                                                                   \
  int nz = 0;                                                              \
  const T *s_in = (const T *) in;                                          \
  lut_t *lut = (lut_t *)(stpi_get_component_data(vars, "Color"));          \
  unsigned mask = 0;                                                       \
  if (lut->invert_output)                                                  \
    mask = 0xffff;                                                         \
                                                                           \
  for (i = 0; i < lut->image_width; i++)                                   \
    {                                                                      \
      unsigned outval = s_in[0] ^ mask;                                    \
      out[0] = outval;                                                     \
      out[1] = outval;                                                     \
      out[2] = outval;                                                     \
      if (outval)                                                          \
        nz = 7;                                                            \
      s_in++;                                                              \
      out += 3;                                                            \
    }                                                                      \
  return nz;                                                               \
}

Definition at line 83 of file color-raw.c.

#define RAW_COLOR_TO_COLOR_FUNC T,
bits   
 

Value:

static unsigned                                                             \
color_##bits##_to_color_raw(stp_const_vars_t vars, const unsigned char *in, \
                            unsigned short *out)                            \
{                                                                           \
  int i;                                                                    \
  int j;                                                                    \
  int nz = 0;                                                               \
  const T *s_in = (const T *) in;                                           \
  lut_t *lut = (lut_t *)(stpi_get_component_data(vars, "Color"));           \
  unsigned mask = 0;                                                        \
  if (lut->invert_output)                                                   \
    mask = 0xffff;                                                          \
                                                                            \
  for (i = 0; i < lut->image_width; i++)                                    \
    {                                                                       \
      unsigned bit = 1;                                                     \
      for (j = 0; j < 3; j++, bit += bit)                                   \
        {                                                                   \
          out[j] = s_in[j] ^ mask;                                          \
          if (out[j])                                                       \
            nz |= bit;                                                      \
        }                                                                   \
      s_in += 3;                                                            \
      out += 3;                                                             \
    }                                                                       \
  return nz;                                                                \
}

Definition at line 46 of file color-raw.c.


Generated on Wed May 12 20:21:35 2004 for libgimpprint API Reference by doxygen1.2.17