Пример #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
Rect GraphicsObjectData::dstRect(const GraphicsObject& go) {
  Point origin = dstOrigin(go);
  Rect src = srcRect(go);

  int xPos1 = go.x() + go.xAdjustmentSum() - origin.x();
  int yPos1 = go.y() + go.yAdjustmentSum() - origin.y();
  int xPos2 = int(xPos1 + src.width() * (go.width() / 100.0f));
  int yPos2 = int(yPos1 + src.height() * (go.height() / 100.0f));

  return Rect::GRP(xPos1, yPos1, xPos2, yPos2);
}
Пример #3
0
int GraphicsObjectOfFile::pixelHeight(const GraphicsObject& rp) {
  const Surface::GrpRect& rect = surface_->getPattern(rp.pattNo());
  int height = rect.rect.height();
  return int((rp.height() / 100.0f) * height);
}