示例#1
0
void ColourFilterObjectData::render(const GraphicsObject& go,
                                    const GraphicsObject* parent,
                                    std::ostream* tree) {
  if (go.width() != 100 || go.height() != 100) {
    static bool printed = false;
    if (!printed) {
      printed = true;
      cerr << "We can't yet scaling colour filters." << endl;
    }
  }

  // Lazily create colour object.
  if (!colour_filer_) {
    colour_filer_.reset(graphics_system_.BuildColourFiller(screen_rect_));
  }

  RGBAColour colour = go.colour();
  colour.setAlpha(
      static_cast<int>(colour.a_float() * go.computedAlpha()));
  colour_filer_->Fill(go, colour);

  if (tree) {
    *tree << "  ColourFilterObjectData" << std::endl
          << "  Screen rect: " << screen_rect_ << std::endl
          << "  Colour: " << colour << std::endl
          << "  Properties: ";
    PrintGraphicsObjectToTree(go, tree);
    *tree << endl;
  }
}
示例#2
0
void GraphicsObjectData::PrintGraphicsObjectToTree(const GraphicsObject& go,
                                                   std::ostream* tree) {
  if (go.mono())
    *tree << "(mono) ";
  if (go.invert())
    *tree << "(invert) ";
  if (go.light())
    *tree << "(light=" << go.light() << ") ";
  if (go.tint() != RGBColour::Black())
    *tree << "(tint=" << go.tint() << ") ";
  if (go.colour() != RGBAColour::Clear())
    *tree << "(colour=" << go.colour() << ") ";
  if (go.compositeMode())
    *tree << "(composite=" << go.compositeMode() << ") ";
  if (go.xOrigin())
    *tree << "(xOrigin=" << go.xOrigin() << ") ";
  if (go.yOrigin())
    *tree << "(yOrigin=" << go.yOrigin() << ") ";
}
void ColourFilterObjectData::render(const GraphicsObject& go,
                                    const GraphicsObject* parent,
                                    std::ostream* tree) {
  if (go.mono() == 0) {
    RGBAColour colour = go.colour();
    colour.setAlpha(
        static_cast<int>(colour.a_float() * go.computedAlpha()));

    graphics_system_.fillScreenArea(screen_rect_, colour);

    if (tree)
      objectInfo(*tree);
  } else {
    static bool printed = false;
    if (!printed) {
      printed = true;
      cerr << "We don't yet deal with objMono() and colour filters." << endl;
    }
  }
}