Source Code (Use browser search to find items of interest.)

Class Index

killustrator'GradientShape (./koffice/killustrator/share/GradientShape.h:33)

class GradientShape {
public:
  GradientShape ();

  void setRegion (const QRegion& r);
  void setBox (const Rect& r);
  void setGradient (const Gradient& g);

  bool valid () const { return isValid; }
  void setInvalid () { isValid = false; }

  void draw (QPainter& p);

  void updatePixmap ();

private:
  Rect box;
  QRegion region;
  QPixmap pixmap;
  Gradient gradient;
  bool isValid;
};

killustrator'GradientShape::GradientShape() (./koffice/killustrator/share/GradientShape.cc:30)

GradientShape::GradientShape () : isValid (false) {
}


killustrator'GradientShape::setRegion() (./koffice/killustrator/share/GradientShape.cc:33)

void GradientShape::setRegion (const QRegion& r) {
  region = r;
  setInvalid ();
}


killustrator'GradientShape::setBox() (./koffice/killustrator/share/GradientShape.cc:38)

void GradientShape::setBox (const Rect& r) {
  box = r.normalize ();
  setInvalid ();
}


killustrator'GradientShape::setGradient() (./koffice/killustrator/share/GradientShape.cc:43)

void GradientShape::setGradient (const Gradient& g) {
  gradient = g;
  setInvalid ();
}


killustrator'GradientShape::draw() (./koffice/killustrator/share/GradientShape.cc:48)

void GradientShape::draw (QPainter& p) {
  p.save ();
  p.setClipRegion (region);
  p.setClipping (true);
  p.drawPixmap (box.left (), box.top (), pixmap);
  p.restore ();
}


killustrator'GradientShape::updatePixmap() (./koffice/killustrator/share/GradientShape.cc:56)

void GradientShape::updatePixmap () {
  if (!region.isEmpty () && !box.empty ()) {
    isValid = true;
    pixmap = gradient.createPixmap (box.width (), box.height ());
  }
}