Mozilla2:GFXGraphics: Difference between revisions

Line 3: Line 3:


=== API ===
=== API ===
class Graphics {
[http://pavlov.net/projects/thebes/public/Graphics.h Graphics.h]
public:
    Graphics();
    ~Graphics();
    // <insert refcount stuff here>
    void SetSurface(ASurface* surface);
    ASurface* Surface();
    // state
    void Save();
    void Restore();
    // drawing
    void NewPath();
    void ClosePath();
    void Stroke();
    void Fill();
   
    void MoveTo(double x, double y);
    void LineTo(double x, double y);
    void CurveTo(double x1, double y1,
                  double x2, double y2,
                  double x3, double y3);
    void Arc(double xc, double yc,
              double radius,
              double angle1, double angle2);
    void Rectangle(double x, double y, double width, double height);
    void Polygon(const Point<double> points[], unsigned long numPoints);
    // transform stuff
    void Translate(double x, double y);
    void Scale(double x, double y);
    void Rotate(double angle);
    void SetMatrix(const Matrix& matrix);
    void CurrentMatrix(Matrix& matrix) const;
    // properties
    void SetColor(const RGBA& c);
    void CurrentColor(RGBA& c) const;
    void SetDash(double* dashes, int ndash, double offset);
    //void getDash() const;
    void SetLineWidth(double width);
    double LineWidth() const;
    // define enum for operators (clear, src, dst, etc)
    void SetOperator(int op);
    int Operator() const;
    // define line caps (butt, round, square)
    void SetLineCap(int cap);
    int LineCap() const;
    void SetMiterLimit(double limit);
    double MiterLimit() const;
    // clipping
    void Clip(const Rect& rect); // will clip to a rect
    void Clip(const Region& region); // will clip to a region
    void Clip(void); // will clip the last path you've drawn
    // patterns
    // fonts?
private:
    cairo_t *mCairo;
};


=== Filters ===
=== Filters ===
569

edits