Ejemplo n.º 1
0
int color_utils::color_for_allegro(const app::Color& color, int depth)
{
  int c = -1;

  switch (color.getType()) {

    case app::Color::MaskType:
      c = get_mask_for_bitmap(depth);
      break;

    case app::Color::RgbType:
    case app::Color::HsvType:
      c = makeacol_depth(depth,
                         color.getRed(),
                         color.getGreen(),
                         color.getBlue(), 255);
      break;

    case app::Color::GrayType:
      c = color.getGray();
      if (depth != 8)
        c = makeacol_depth(depth, c, c, c, 255);
      break;

    case app::Color::IndexType:
      c = color.getIndex();
      if (depth != 8) {
        ASSERT(c >= 0 && c < (int)get_current_palette()->size());

        uint32_t _c = get_current_palette()->getEntry(c);
        c = makeacol_depth(depth,
                           rgba_getr(_c),
                           rgba_getg(_c),
                           rgba_getb(_c), 255);
      }
      break;

  }

  return c;
}
Ejemplo n.º 2
0
    void OpenLayerImage::putPixel(int x, int y, const Color& color)
    {
        if (mAllegroBitmap == NULL && mOpenLayerBitmap == NULL)
        {
            throw FCN_EXCEPTION("Trying to put a pixel in a non loaded image.");
        }

        if (mAllegroBitmap == NULL)
        {
            return;
        }

        int c = makeacol_depth(32, color.r, color.g, color.b, color.a);

        putpixel(mAllegroBitmap, x, y, c);
    }
Ejemplo n.º 3
0
int IAGSEngine::MakeRawColorPixel(int32 coldepth, int32 red, int32 green, int32 blue, int32 alpha) {
  return makeacol_depth(coldepth, red, green, blue, alpha);
}
Ejemplo n.º 4
0
/* makeacol:
 *  Converts R, G, B, and A values (ranging 0-255) to whatever pixel format
 *  is required by the current video mode.
 */
int makeacol(int r, int g, int b, int a)
{
   return makeacol_depth(_color_depth, r, g, b, a);
}