This project is read-only.

A concret implementation of a displayObject gives us the method:

virutal bool Draw(Direct2DContext* ctx, D2D1::Matrix3x2F* mtx);

Inside this method we can write our draw code:

bool ConcretDisplayObject::Draw(Direct2DContext* ctx, D2D1::Matrix3x2F* mtx) {
   //draw code
  return true;
}

The Direct2DContext object gives us all to call drawing methods. Who knows the HTML5 canvas specification has no problems to make rendercode:

        void save();
        void restore();
        void clearRect(float x, float y, float w, float h);
        void fillRect(float x, float y, float w, float h);
        void strokeRect(float x, float y, float w, float h);
        void beginPath();
        void fill();
        void stroke();
        void clip();
        void fillText(std::string text, float x, float y, float maxWidth = 0);
        void strokeText(std::string text, float x, float y, float maxWidth = 0);

        void scale(float x, float y);
        void rotate(float angle);
        void translate(float x, float y);
        void transform(float a, float b, float c, float d, float e, float f);
        void setTransform(float a, float b, float c, float d, float e, float f);

        void closePath();
        void moveTo(float x, float y);
        void lineTo(float x, float y);
        void quadraticCurveTo(float cpx, float cpy, float x, float y);
        void bezierCurveTo(float cp1x, float cp1y, float cp2x, float cp2y, float x, float y);
        void arcTo(float x1, float y1, float x2, float y2, float radius);
        void rect(float x, float y, float w, float h);
        void arc(float x, float y, float radius, float startAngle, float endAngle, bool anticlockwise);

        void drawImage(Image* image, int dx, int dy);
        void drawImage(Image* image, int dx, int dy, int dw, int dh);
        void drawImage(Image* image, int sx, int sy, int sw, int sh, int dx, int dy, int dw, int dh);

Last edited Mar 25, 2013 at 9:51 PM by TypeOverride, version 5

Comments

No comments yet.