dojox/gfx/silverlight.js

  • Provides:

    • dojox.gfx.silverlight
  • Requires:

    • dojox.gfx._base in common
    • dojox.gfx.shape in common
    • dojox.gfx.path in common
  • dojox.gfx.silverlight.Shape

    • type
      Function
    • chains:
      • gs.Shape: (prototype)
      • gs.Shape: (call)
    • summary
      Silverlight-specific implementation of dojox.gfx.Shape methods
  • dojox.gfx.silverlight.Shape.setFill

    • type
      Function
    • parameters:
      • fill: (typeof Object)
        a fill object
        (see dojox.gfx.defaultLinearGradient,
        dojox.gfx.defaultRadialGradient,
        dojox.gfx.defaultPattern,
        or dojo.Color)
    • source: [view]
         var p = this.rawNode.getHost().content, r = this.rawNode, f;
         if(!fill){
          // don't fill
          this.fillStyle = null;
          this._setFillAttr(null);
          return this; // self
         }
         if(typeof(fill) == "object" && "type" in fill){
          // gradient
          switch(fill.type){
           case "linear":
            this.fillStyle = f = g.makeParameters(g.defaultLinearGradient, fill);
            var lgb = p.createFromXaml("");
            lgb.mappingMode = "Absolute";
            lgb.startPoint = f.x1 + "," + f.y1;
            lgb.endPoint = f.x2 + "," + f.y2;
            d.forEach(f.colors, function(c){
             var t = p.createFromXaml("");
             t.offset = c.offset;
             t.color = hexColor(c.color);
             lgb.gradientStops.add(t);
            });
            this._setFillAttr(lgb);
            break;
           case "radial":
            this.fillStyle = f = g.makeParameters(g.defaultRadialGradient, fill);
            var rgb = p.createFromXaml(""),
             c = g.matrix.multiplyPoint(g.matrix.invert(this._getAdjustedMatrix()), f.cx, f.cy),
             pt = c.x + "," + c.y;
            rgb.mappingMode = "Absolute";
            rgb.gradientOrigin = pt;
            rgb.center = pt;
            rgb.radiusX = rgb.radiusY = f.r;
            d.forEach(f.colors, function(c){
             var t = p.createFromXaml("");
             t.offset = c.offset;
             t.color = hexColor(c.color);
             rgb.gradientStops.add(t);
            });
            this._setFillAttr(rgb);
            break;
           case "pattern":
            // don't fill: Silverlight doesn't define TileBrush for some reason
            this.fillStyle = null;
            this._setFillAttr(null);
            break;
          }
          return this; // self
         }
         // color object
         this.fillStyle = f = g.normalizeColor(fill);
         var scb = p.createFromXaml("");
         scb.color = f.toHex();
         scb.opacity = f.a;
         this._setFillAttr(scb);
         return this; // self
    • summary
      sets a fill object (Silverlight)
    • returns
      self
  • dojox.gfx.silverlight.Shape._setFillAttr

    • type
      Function
    • parameters:
      • f: (typeof )
    • source: [view]
         this.rawNode.fill = f;
    • summary
  • dojox.gfx.silverlight.Shape.setStroke

    • type
      Function
    • parameters:
      • stroke: (typeof Object)
        a stroke object
        (see dojox.gfx.defaultStroke)
    • source: [view]
         var p = this.rawNode.getHost().content, r = this.rawNode;
         if(!stroke){
          // don't stroke
          this.strokeStyle = null;
          r.stroke = null;
          return this;
         }
         // normalize the stroke
         if(typeof stroke == "string" || d.isArray(stroke) || stroke instanceof d.Color){
          stroke = {color: stroke};
         }
         var s = this.strokeStyle = g.makeParameters(g.defaultStroke, stroke);
         s.color = g.normalizeColor(s.color);
         // generate attributes
         if(s){
          var scb = p.createFromXaml("");
          scb.color = s.color.toHex();
          scb.opacity = s.color.a;
          r.stroke = scb;
          r.strokeThickness = s.width;
          r.strokeStartLineCap = r.strokeEndLineCap = r.strokeDashCap =
           caps[s.cap];
          if(typeof s.join == "number"){
           r.strokeLineJoin = "Miter";
           r.strokeMiterLimit = s.join;
          }else{
           r.strokeLineJoin = joins[s.join];
          }
          var da = s.style.toLowerCase();
          if(da in dasharray){ da = dasharray[da]; }
          if(da instanceof Array){
           da = d.clone(da);
           var i;
           /*
           for(var i = 0; i < da.length; ++i){
            da[i] *= s.width;
           }
           */
           if(s.cap != "butt"){
            for(i = 0; i < da.length; i += 2){
             //da[i] -= s.width;
             --da[i]
             if(da[i] < 1){ da[i] = 1; }
            }
            for(i = 1; i < da.length; i += 2){
             //da[i] += s.width;
             ++da[i];
            }
           }
           r.strokeDashArray = da.join(",");
          }else{
           r.strokeDashArray = null;
          }
         }
         return this; // self
    • summary
      sets a stroke object (Silverlight)
    • returns
      self
  • dojox.gfx.silverlight.Shape._getParentSurface

    • type
      Function
    • source: [view]
         var surface = this.parent;
         for(; surface && !(surface instanceof g.Surface); surface = surface.parent);
         return surface;
    • summary
  • dojox.gfx.silverlight.Shape._applyTransform

    • type
      Function
    • source: [view]
         var tm = this._getAdjustedMatrix(), r = this.rawNode;
         if(tm){
          var p = this.rawNode.getHost().content,
           mt = p.createFromXaml(""),
           mm = p.createFromXaml("");
          mm.m11 = tm.xx;
          mm.m21 = tm.xy;
          mm.m12 = tm.yx;
          mm.m22 = tm.yy;
          mm.offsetX = tm.dx;
          mm.offsetY = tm.dy;
          mt.matrix = mm;
          r.renderTransform = mt;
         }else{
          r.renderTransform = null;
         }
         return this;
    • summary
  • dojox.gfx.silverlight.Shape.setRawNode

    • type
      Function
    • parameters:
      • rawNode: (typeof )
    • source: [view]
         rawNode.fill = null;
         rawNode.stroke = null;
         this.rawNode = rawNode;
    • summary
      assigns and clears the underlying node that will represent this
      shape. Once set, transforms, gradients, etc, can be applied.
      (no fill &amp; stroke by default)
  • dojox.gfx.silverlight.Shape._moveToFront

    • type
      Function
    • source: [view]
         var c = this.parent.rawNode.children, r = this.rawNode;
         c.remove(r);
         c.add(r);
         return this; // self
    • summary
      moves a shape to front of its parent's list of shapes (Silverlight)
    • returns
      self
  • dojox.gfx.silverlight.Shape._moveToBack

    • type
      Function
    • source: [view]
         var c = this.parent.rawNode.children, r = this.rawNode;
         c.remove(r);
         c.insert(0, r);
         return this; // self
    • summary
      moves a shape to back of its parent's list of shapes (Silverlight)
    • returns
      self
  • dojox.gfx.silverlight.Shape._getAdjustedMatrix

    • type
      Function
    • source: [view]
         return this.matrix; // dojox.gfx.Matrix2D
    • summary
      returns the adjusted (&quot;real&quot;) transformation matrix
    • returns
      dojox.gfx.Matrix2D
  • dojox.gfx.silverlight.Shape.fillStyle

    • summary
  • dojox.gfx.silverlight.Shape.rawNode.fill

    • summary
  • dojox.gfx.silverlight.Shape.strokeStyle

    • summary
  • dojox.gfx.silverlight.Shape.rawNode

    • summary
  • dojox.gfx.silverlight.Group

    • type
      Function
    • chains:
      • sl.Shape: (prototype)
      • sl.Shape: (call)
      • gs.Container._init: (call)
    • summary
      a group shape (Silverlight), which can be used
      to logically group shapes (e.g, to propagate matricies)
    • source: [view]
         gs.Container._init.call(this);
  • dojox.gfx.silverlight.Group.setRawNode

    • type
      Function
    • parameters:
      • rawNode: (typeof Node)
        an Silverlight node
    • source: [view]
         this.rawNode = rawNode;
    • summary
      sets a raw Silverlight node to be used by this shape
  • dojox.gfx.silverlight.Group.rawNode

    • summary
  • dojox.gfx.silverlight.Group.setRawNode.rawNode

    • type
      Node
    • summary
      an Silverlight node
  • dojox.gfx.silverlight.Rect

    • type
      Function
    • chains:
      • sl.Shape: (prototype)
      • sl.Shape: (call)
      • gs.Rect: (call)
    • mixins:
      • gs.Rect.prototype: (prototype)
    • summary
      a rectangle shape (Silverlight)
  • dojox.gfx.silverlight.Rect.setShape

    • type
      Function
    • parameters:
      • newShape: (typeof Object)
        a rectangle shape object
    • source: [view]
         this.shape = g.makeParameters(this.shape, newShape);
         this.bbox = null;
         var r = this.rawNode, n = this.shape;
         r.width = n.width;
         r.height = n.height;
         r.radiusX = r.radiusY = n.r;
         return this._applyTransform(); // self
    • summary
      sets a rectangle shape object (Silverlight)
    • returns
      self
  • dojox.gfx.silverlight.Rect._getAdjustedMatrix

    • type
      Function
    • source: [view]
         var matrix = this.matrix, s = this.shape, delta = {dx: s.x, dy: s.y};
         return new g.Matrix2D(matrix ? [matrix, delta] : delta); // dojox.gfx.Matrix2D
    • summary
      returns the adjusted (&quot;real&quot;) transformation matrix
    • returns
      dojox.gfx.Matrix2D
  • dojox.gfx.silverlight.Rect.shape

    • summary
  • dojox.gfx.silverlight.Rect.bbox

    • summary
  • dojox.gfx.silverlight.Ellipse

    • type
      Function
    • chains:
      • sl.Shape: (prototype)
      • sl.Shape: (call)
      • gs.Ellipse: (call)
    • mixins:
      • gs.Ellipse.prototype: (prototype)
    • summary
      an ellipse shape (Silverlight)
  • dojox.gfx.silverlight.Ellipse.setShape

    • type
      Function
    • parameters:
      • newShape: (typeof Object)
        an ellipse shape object
    • source: [view]
         this.shape = g.makeParameters(this.shape, newShape);
         this.bbox = null;
         var r = this.rawNode, n = this.shape;
         r.width = 2 * n.rx;
         r.height = 2 * n.ry;
         return this._applyTransform(); // self
    • summary
      sets an ellipse shape object (Silverlight)
    • returns
      self
  • dojox.gfx.silverlight.Ellipse._getAdjustedMatrix

    • type
      Function
    • source: [view]
         var matrix = this.matrix, s = this.shape, delta = {dx: s.cx - s.rx, dy: s.cy - s.ry};
         return new g.Matrix2D(matrix ? [matrix, delta] : delta); // dojox.gfx.Matrix2D
    • summary
      returns the adjusted (&quot;real&quot;) transformation matrix
    • returns
      dojox.gfx.Matrix2D
  • dojox.gfx.silverlight.Ellipse.shape

    • summary
  • dojox.gfx.silverlight.Ellipse.bbox

    • summary
  • dojox.gfx.silverlight.Circle

    • type
      Function
    • chains:
      • sl.Shape: (prototype)
      • sl.Shape: (call)
      • gs.Circle: (call)
    • mixins:
      • gs.Circle.prototype: (prototype)
    • summary
      a circle shape (Silverlight)
  • dojox.gfx.silverlight.Circle.setShape

    • type
      Function
    • parameters:
      • newShape: (typeof Object)
        a circle shape object
    • source: [view]
         this.shape = g.makeParameters(this.shape, newShape);
         this.bbox = null;
         var r = this.rawNode, n = this.shape;
         r.width = r.height = 2 * n.r;
         return this._applyTransform(); // self
    • summary
      sets a circle shape object (Silverlight)
    • returns
      self
  • dojox.gfx.silverlight.Circle._getAdjustedMatrix

    • type
      Function
    • source: [view]
         var matrix = this.matrix, s = this.shape, delta = {dx: s.cx - s.r, dy: s.cy - s.r};
         return new g.Matrix2D(matrix ? [matrix, delta] : delta); // dojox.gfx.Matrix2D
    • summary
      returns the adjusted (&quot;real&quot;) transformation matrix
    • returns
      dojox.gfx.Matrix2D
  • dojox.gfx.silverlight.Circle.shape

    • summary
  • dojox.gfx.silverlight.Circle.bbox

    • summary
  • dojox.gfx.silverlight.Line

    • type
      Function
    • chains:
      • sl.Shape: (prototype)
      • sl.Shape: (call)
      • gs.Line: (call)
    • mixins:
      • gs.Line.prototype: (prototype)
    • summary
      a line shape (Silverlight)
  • dojox.gfx.silverlight.Line.setShape

    • type
      Function
    • parameters:
      • newShape: (typeof Object)
        a line shape object
    • source: [view]
         this.shape = g.makeParameters(this.shape, newShape);
         this.bbox = null;
         var r = this.rawNode, n = this.shape;
         r.x1 = n.x1; r.y1 = n.y1; r.x2 = n.x2; r.y2 = n.y2;
         return this; // self
    • summary
      sets a line shape object (Silverlight)
    • returns
      self
  • dojox.gfx.silverlight.Line.shape

    • summary
  • dojox.gfx.silverlight.Line.bbox

    • summary
  • dojox.gfx.silverlight.Polyline

    • type
      Function
    • chains:
      • sl.Shape: (prototype)
      • sl.Shape: (call)
      • gs.Polyline: (call)
    • mixins:
      • gs.Polyline.prototype: (prototype)
    • summary
      a polyline/polygon shape (Silverlight)
  • dojox.gfx.silverlight.Polyline.setShape

    • type
      Function
    • parameters:
      • points: (typeof Object)
        a polyline/polygon shape object
      • closed: (typeof )
    • source: [view]
         if(points && points instanceof Array){
          // branch
          // points: Array: an array of points
          this.shape = g.makeParameters(this.shape, {points: points});
          if(closed && this.shape.points.length){
           this.shape.points.push(this.shape.points[0]);
          }
         }else{
          this.shape = g.makeParameters(this.shape, points);
         }
         this.bbox = null;
         this._normalizePoints();
         var p = this.shape.points, rp = [];
         for(var i = 0; i < p.length; ++i){
          rp.push(p[i].x, p[i].y);
         }
         this.rawNode.points = rp.join(",");
         return this; // self
    • summary
      sets a polyline/polygon shape object (Silverlight)
    • returns
      self
  • dojox.gfx.silverlight.Polyline.shape

    • summary
  • dojox.gfx.silverlight.Polyline.bbox

    • summary
  • dojox.gfx.silverlight.Polyline.rawNode.points

    • summary
  • dojox.gfx.silverlight.Image

    • type
      Function
    • chains:
      • sl.Shape: (prototype)
      • sl.Shape: (call)
      • gs.Image: (call)
    • mixins:
      • gs.Image.prototype: (prototype)
    • summary
      an image (Silverlight)
  • dojox.gfx.silverlight.Image.setShape

    • type
      Function
    • parameters:
      • newShape: (typeof Object)
        an image shape object
    • source: [view]
         this.shape = g.makeParameters(this.shape, newShape);
         this.bbox = null;
         var r = this.rawNode, n = this.shape;
         r.width = n.width;
         r.height = n.height;
         r.source = n.src;
         return this._applyTransform(); // self
    • summary
      sets an image shape object (Silverlight)
    • returns
      self
  • dojox.gfx.silverlight.Image._getAdjustedMatrix

    • type
      Function
    • source: [view]
         var matrix = this.matrix, s = this.shape, delta = {dx: s.x, dy: s.y};
         return new g.Matrix2D(matrix ? [matrix, delta] : delta); // dojox.gfx.Matrix2D
    • summary
      returns the adjusted (&quot;real&quot;) transformation matrix
    • returns
      dojox.gfx.Matrix2D
  • dojox.gfx.silverlight.Image.setRawNode

    • type
      Function
    • parameters:
      • rawNode: (typeof )
    • source: [view]
         this.rawNode = rawNode;
    • summary
      assigns and clears the underlying node that will represent this
      shape. Once set, transforms, gradients, etc, can be applied.
      (no fill &amp; stroke by default)
  • dojox.gfx.silverlight.Image.shape

    • summary
  • dojox.gfx.silverlight.Image.bbox

    • summary
  • dojox.gfx.silverlight.Image.rawNode

    • summary
  • dojox.gfx.silverlight.Text

    • type
      Function
    • chains:
      • sl.Shape: (prototype)
      • sl.Shape: (call)
      • gs.Text: (call)
    • mixins:
      • gs.Text.prototype: (prototype)
    • summary
      an anchored text (Silverlight)
  • dojox.gfx.silverlight.Text.setShape

    • type
      Function
    • parameters:
      • newShape: (typeof Object)
        a text shape object
    • source: [view]
         this.shape = g.makeParameters(this.shape, newShape);
         this.bbox = null;
         var r = this.rawNode, s = this.shape;
         r.text = s.text;
         r.textDecorations = s.decoration === "underline" ? "Underline" : "None";
         r["Canvas.Left"] = -10000;
         r["Canvas.Top"] = -10000;
         if(!this._delay){
          this._delay = window.setTimeout(d.hitch(this, "_delayAlignment"), 10);
         }
         return this; // self
    • summary
      sets a text shape object (Silverlight)
    • returns
      self
  • dojox.gfx.silverlight.Text._delayAlignment

    • type
      Function
    • source: [view]
      dojo.provide("dojox.gfx.silverlight");


      dojo.require("dojox.gfx._base");
      dojo.require("dojox.gfx.shape");
      dojo.require("dojox.gfx.path");


      dojo.experimental("dojox.gfx.silverlight");


      (function(){
       var d = dojo, g = dojox.gfx, gs = g.shape, sl = g.silverlight;


       var dasharray = {
         solid:    "none",
         shortdash:   [4, 1],
         shortdot:   [1, 1],
         shortdashdot:  [4, 1, 1, 1],
         shortdashdotdot: [4, 1, 1, 1, 1, 1],
         dot:    [1, 3],
         dash:    [4, 3],
         longdash:   [8, 3],
         dashdot:   [4, 3, 1, 3],
         longdashdot:  [8, 3, 1, 3],
         longdashdotdot:  [8, 3, 1, 3, 1, 3]
        },
        fontweight = {
         normal: 400,
         bold: 700
        },
        caps = {butt: "Flat", round: "Round", square: "Square"},
        joins = {bevel: "Bevel", round: "Round"},
        fonts = {
         serif: "Times New Roman",
         times: "Times New Roman",
         "sans-serif": "Arial",
         helvetica: "Arial",
         monotone: "Courier New",
         courier: "Courier New"
        };


       function hexColor(/*String|Array|dojo.Color*/ color){
        // summary: converts a color object to a Silverlight hex color string (#aarrggbb)
        var c = g.normalizeColor(color),
         t = c.toHex(), a = Math.round(c.a * 255);
        a = (a < 0 ? 0 : a > 255 ? 255 : a).toString(16);
        return "#" + (a.length < 2 ? "0" + a : a) + t.slice(1); // String
       }


       d.declare("dojox.gfx.silverlight.Shape", gs.Shape, {
        // summary: Silverlight-specific implementation of dojox.gfx.Shape methods


        setFill: function(fill){
         // summary: sets a fill object (Silverlight)
         // fill: Object: a fill object
         // (see dojox.gfx.defaultLinearGradient,
         // dojox.gfx.defaultRadialGradient,
         // dojox.gfx.defaultPattern,
         // or dojo.Color)


         var p = this.rawNode.getHost().content, r = this.rawNode, f;
         if(!fill){
          // don't fill
          this.fillStyle = null;
          this._setFillAttr(null);
          return this; // self
         }
         if(typeof(fill) == "object" && "type" in fill){
          // gradient
          switch(fill.type){
           case "linear":
            this.fillStyle = f = g.makeParameters(g.defaultLinearGradient, fill);
            var lgb = p.createFromXaml("");
            lgb.mappingMode = "Absolute";
            lgb.startPoint = f.x1 + "," + f.y1;
            lgb.endPoint = f.x2 + "," + f.y2;
            d.forEach(f.colors, function(c){
             var t = p.createFromXaml("");
             t.offset = c.offset;
             t.color = hexColor(c.color);
             lgb.gradientStops.add(t);
            });
            this._setFillAttr(lgb);
            break;
           case "radial":
            this.fillStyle = f = g.makeParameters(g.defaultRadialGradient, fill);
            var rgb = p.createFromXaml(""),
             c = g.matrix.multiplyPoint(g.matrix.invert(this._getAdjustedMatrix()), f.cx, f.cy),
             pt = c.x + "," + c.y;
            rgb.mappingMode = "Absolute";
            rgb.gradientOrigin = pt;
            rgb.center = pt;
            rgb.radiusX = rgb.radiusY = f.r;
            d.forEach(f.colors, function(c){
             var t = p.createFromXaml("");
             t.offset = c.offset;
             t.color = hexColor(c.color);
             rgb.gradientStops.add(t);
            });
            this._setFillAttr(rgb);
            break;
           case "pattern":
            // don't fill: Silverlight doesn't define TileBrush for some reason
            this.fillStyle = null;
            this._setFillAttr(null);
            break;
          }
          return this; // self
         }
         // color object
         this.fillStyle = f = g.normalizeColor(fill);
         var scb = p.createFromXaml("");
         scb.color = f.toHex();
         scb.opacity = f.a;
         this._setFillAttr(scb);
         return this; // self
        },
        _setFillAttr: function(f){
         this.rawNode.fill = f;
        },


        setStroke: function(stroke){
         // summary: sets a stroke object (Silverlight)
         // stroke: Object: a stroke object
         // (see dojox.gfx.defaultStroke)


         var p = this.rawNode.getHost().content, r = this.rawNode;
         if(!stroke){
          // don't stroke
          this.strokeStyle = null;
          r.stroke = null;
          return this;
         }
         // normalize the stroke
         if(typeof stroke == "string" || d.isArray(stroke) || stroke instanceof d.Color){
          stroke = {color: stroke};
         }
         var s = this.strokeStyle = g.makeParameters(g.defaultStroke, stroke);
         s.color = g.normalizeColor(s.color);
         // generate attributes
         if(s){
          var scb = p.createFromXaml("");
          scb.color = s.color.toHex();
          scb.opacity = s.color.a;
          r.stroke = scb;
          r.strokeThickness = s.width;
          r.strokeStartLineCap = r.strokeEndLineCap = r.strokeDashCap =
           caps[s.cap];
          if(typeof s.join == "number"){
           r.strokeLineJoin = "Miter";
           r.strokeMiterLimit = s.join;
          }else{
           r.strokeLineJoin = joins[s.join];
          }
          var da = s.style.toLowerCase();
          if(da in dasharray){ da = dasharray[da]; }
          if(da instanceof Array){
           da = d.clone(da);
           var i;
           /*
           for(var i = 0; i < da.length; ++i){
            da[i] *= s.width;
           }
           */
           if(s.cap != "butt"){
            for(i = 0; i < da.length; i += 2){
             //da[i] -= s.width;
             --da[i]
             if(da[i] < 1){ da[i] = 1; }
            }
            for(i = 1; i < da.length; i += 2){
             //da[i] += s.width;
             ++da[i];
            }
           }
           r.strokeDashArray = da.join(",");
          }else{
           r.strokeDashArray = null;
          }
         }
         return this; // self
        },


        _getParentSurface: function(){
         var surface = this.parent;
         for(; surface && !(surface instanceof g.Surface); surface = surface.parent);
         return surface;
        },


        _applyTransform: function() {
         var tm = this._getAdjustedMatrix(), r = this.rawNode;
         if(tm){
          var p = this.rawNode.getHost().content,
           mt = p.createFromXaml(""),
           mm = p.createFromXaml("");
          mm.m11 = tm.xx;
          mm.m21 = tm.xy;
          mm.m12 = tm.yx;
          mm.m22 = tm.yy;
          mm.offsetX = tm.dx;
          mm.offsetY = tm.dy;
          mt.matrix = mm;
          r.renderTransform = mt;
         }else{
          r.renderTransform = null;
         }
         return this;
        },


        setRawNode: function(rawNode){
         // summary:
         // assigns and clears the underlying node that will represent this
         // shape. Once set, transforms, gradients, etc, can be applied.
         // (no fill & stroke by default)
         rawNode.fill = null;
         rawNode.stroke = null;
         this.rawNode = rawNode;
        },


        // move family


        _moveToFront: function(){
         // summary: moves a shape to front of its parent's list of shapes (Silverlight)
         var c = this.parent.rawNode.children, r = this.rawNode;
         c.remove(r);
         c.add(r);
         return this; // self
        },
        _moveToBack: function(){
         // summary: moves a shape to back of its parent's list of shapes (Silverlight)
         var c = this.parent.rawNode.children, r = this.rawNode;
         c.remove(r);
         c.insert(0, r);
         return this; // self
        },


        _getAdjustedMatrix: function(){
         // summary: returns the adjusted ("real") transformation matrix
         return this.matrix; // dojox.gfx.Matrix2D
        }
       });


       d.declare("dojox.gfx.silverlight.Group", sl.Shape, {
        // summary: a group shape (Silverlight), which can be used
        // to logically group shapes (e.g, to propagate matricies)
        constructor: function(){
         gs.Container._init.call(this);
        },
        setRawNode: function(rawNode){
         // summary: sets a raw Silverlight node to be used by this shape
         // rawNode: Node: an Silverlight node
         this.rawNode = rawNode;
        }
       });
       sl.Group.nodeType = "Canvas";


       d.declare("dojox.gfx.silverlight.Rect", [sl.Shape, gs.Rect], {
        // summary: a rectangle shape (Silverlight)
        setShape: function(newShape){
         // summary: sets a rectangle shape object (Silverlight)
         // newShape: Object: a rectangle shape object
         this.shape = g.makeParameters(this.shape, newShape);
         this.bbox = null;
         var r = this.rawNode, n = this.shape;
         r.width = n.width;
         r.height = n.height;
         r.radiusX = r.radiusY = n.r;
         return this._applyTransform(); // self
        },
        _getAdjustedMatrix: function(){
         // summary: returns the adjusted ("real") transformation matrix
         var matrix = this.matrix, s = this.shape, delta = {dx: s.x, dy: s.y};
         return new g.Matrix2D(matrix ? [matrix, delta] : delta); // dojox.gfx.Matrix2D
        }
       });
       sl.Rect.nodeType = "Rectangle";


       d.declare("dojox.gfx.silverlight.Ellipse", [sl.Shape, gs.Ellipse], {
        // summary: an ellipse shape (Silverlight)
        setShape: function(newShape){
         // summary: sets an ellipse shape object (Silverlight)
         // newShape: Object: an ellipse shape object
         this.shape = g.makeParameters(this.shape, newShape);
         this.bbox = null;
         var r = this.rawNode, n = this.shape;
         r.width = 2 * n.rx;
         r.height = 2 * n.ry;
         return this._applyTransform(); // self
        },
        _getAdjustedMatrix: function(){
         // summary: returns the adjusted ("real") transformation matrix
         var matrix = this.matrix, s = this.shape, delta = {dx: s.cx - s.rx, dy: s.cy - s.ry};
         return new g.Matrix2D(matrix ? [matrix, delta] : delta); // dojox.gfx.Matrix2D
        }
       });
       sl.Ellipse.nodeType = "Ellipse";


       d.declare("dojox.gfx.silverlight.Circle", [sl.Shape, gs.Circle], {
        // summary: a circle shape (Silverlight)
        setShape: function(newShape){
         // summary: sets a circle shape object (Silverlight)
         // newShape: Object: a circle shape object
         this.shape = g.makeParameters(this.shape, newShape);
         this.bbox = null;
         var r = this.rawNode, n = this.shape;
         r.width = r.height = 2 * n.r;
         return this._applyTransform(); // self
        },
        _getAdjustedMatrix: function(){
         // summary: returns the adjusted ("real") transformation matrix
         var matrix = this.matrix, s = this.shape, delta = {dx: s.cx - s.r, dy: s.cy - s.r};
         return new g.Matrix2D(matrix ? [matrix, delta] : delta); // dojox.gfx.Matrix2D
        }
       });
       sl.Circle.nodeType = "Ellipse";


       d.declare("dojox.gfx.silverlight.Line", [sl.Shape, gs.Line], {
        // summary: a line shape (Silverlight)
        setShape: function(newShape){
         // summary: sets a line shape object (Silverlight)
         // newShape: Object: a line shape object
         this.shape = g.makeParameters(this.shape, newShape);
         this.bbox = null;
         var r = this.rawNode, n = this.shape;
         r.x1 = n.x1; r.y1 = n.y1; r.x2 = n.x2; r.y2 = n.y2;
         return this; // self
        }
       });
       sl.Line.nodeType = "Line";


       d.declare("dojox.gfx.silverlight.Polyline", [sl.Shape, gs.Polyline], {
        // summary: a polyline/polygon shape (Silverlight)
        setShape: function(points, closed){
         // summary: sets a polyline/polygon shape object (Silverlight)
         // points: Object: a polyline/polygon shape object
         if(points && points instanceof Array){
          // branch
          // points: Array: an array of points
          this.shape = g.makeParameters(this.shape, {points: points});
          if(closed && this.shape.points.length){
           this.shape.points.push(this.shape.points[0]);
          }
         }else{
          this.shape = g.makeParameters(this.shape, points);
         }
         this.bbox = null;
         this._normalizePoints();
         var p = this.shape.points, rp = [];
         for(var i = 0; i < p.length; ++i){
          rp.push(p[i].x, p[i].y);
         }
         this.rawNode.points = rp.join(",");
         return this; // self
        }
       });
       sl.Polyline.nodeType = "Polyline";


       d.declare("dojox.gfx.silverlight.Image", [sl.Shape, gs.Image], {
        // summary: an image (Silverlight)
        setShape: function(newShape){
         // summary: sets an image shape object (Silverlight)
         // newShape: Object: an image shape object
         this.shape = g.makeParameters(this.shape, newShape);
         this.bbox = null;
         var r = this.rawNode, n = this.shape;
         r.width = n.width;
         r.height = n.height;
         r.source = n.src;
         return this._applyTransform(); // self
        },
        _getAdjustedMatrix: function(){
         // summary: returns the adjusted ("real") transformation matrix
         var matrix = this.matrix, s = this.shape, delta = {dx: s.x, dy: s.y};
         return new g.Matrix2D(matrix ? [matrix, delta] : delta); // dojox.gfx.Matrix2D
        },
        setRawNode: function(rawNode){
         // summary:
         // assigns and clears the underlying node that will represent this
         // shape. Once set, transforms, gradients, etc, can be applied.
         // (no fill & stroke by default)
         this.rawNode = rawNode;
        }
       });
       sl.Image.nodeType = "Image";


       d.declare("dojox.gfx.silverlight.Text", [sl.Shape, gs.Text], {
        // summary: an anchored text (Silverlight)
        setShape: function(newShape){
         // summary: sets a text shape object (Silverlight)
         // newShape: Object: a text shape object
         this.shape = g.makeParameters(this.shape, newShape);
         this.bbox = null;
         var r = this.rawNode, s = this.shape;
         r.text = s.text;
         r.textDecorations = s.decoration === "underline" ? "Underline" : "None";
         r["Canvas.Left"] = -10000;
         r["Canvas.Top"] = -10000;
         if(!this._delay){
          this._delay = window.setTimeout(d.hitch(this, "_delayAlignment"), 10);
         }
         return this; // self
        },
        _delayAlignment: function(){
         // handle alignment
         var r = this.rawNode, s = this.shape, w, h;
         try{
          w = r.actualWidth;
          h = r.actualHeight;
         }catch(e){
          // bail out if the node is hidden
          return;
         }
         var x = s.x, y = s.y - h * 0.75;
         switch(s.align){
          case "middle":
           x -= w / 2;
           break;
          case "end":
           x -= w;
           break;
         }
         this._delta = {dx: x, dy: y};
         r["Canvas.Left"] = 0;
         r["Canvas.Top"] = 0;
         this._applyTransform();
         delete this._delay;
    • returns
      String|self|dojox.gfx.Matrix2D
    • summary
  • dojox.gfx.silverlight.Text._getAdjustedMatrix

    • type
      Function
    • source: [view]
         var matrix = this.matrix, delta = this._delta, x;
         if(matrix){
          x = delta ? [matrix, delta] : matrix;
         }else{
          x = delta ? delta : {};
         }
         return new g.Matrix2D(x);
    • summary
      returns the adjusted (&quot;real&quot;) transformation matrix
  • dojox.gfx.silverlight.Text.setStroke

    • type
      Function
    • source: [view]
         return this; // self
    • summary
      ignore setting a stroke style
    • returns
      self
  • dojox.gfx.silverlight.Text._setFillAttr

    • type
      Function
    • parameters:
      • f: (typeof )
    • source: [view]
         this.rawNode.foreground = f;
    • summary
  • dojox.gfx.silverlight.Text.setRawNode

    • type
      Function
    • parameters:
      • rawNode: (typeof )
    • source: [view]
         this.rawNode = rawNode;
    • summary
      assigns and clears the underlying node that will represent this
      shape. Once set, transforms, gradients, etc, can be applied.
      (no fill &amp; stroke by default)
  • dojox.gfx.silverlight.Text.getTextWidth

    • type
      Function
    • source: [view]
         return this.rawNode.actualWidth;
    • summary
      get the text width in pixels
  • dojox.gfx.silverlight.Text.shape

    • summary
  • dojox.gfx.silverlight.Text.bbox

    • summary
  • dojox.gfx.silverlight.Text._delay

    • summary
  • dojox.gfx.silverlight.Text._delta

    • summary
  • dojox.gfx.silverlight.Text.rawNode.foreground

    • summary
  • dojox.gfx.silverlight.Text.rawNode

    • summary
  • dojox.gfx.silverlight.Path

    • type
      Function
    • chains:
      • sl.Shape: (prototype)
      • sl.Shape: (call)
      • g.path.Path: (call)
    • mixins:
      • g.path.Path.prototype: (prototype)
    • summary
      a path shape (Silverlight)
  • dojox.gfx.silverlight.Path._updateWithSegment

    • type
      Function
    • parameters:
      • segment: (typeof Object)
        a segment
    • source: [view]
         this.inherited(arguments);
         var p = this.shape.path;
         if(typeof(p) == "string"){
          this.rawNode.data = p ? p : null;
         }
    • summary
      updates the bounding box of path with new segment
  • dojox.gfx.silverlight.Path.setShape

    • type
      Function
    • parameters:
      • newShape: (typeof Object)
        an SVG path string or a path object (see dojox.gfx.defaultPath)
    • source: [view]
         this.inherited(arguments);
         var p = this.shape.path;
         this.rawNode.data = p ? p : null;
         return this; // self
    • summary
      forms a path using a shape (Silverlight)
    • returns
      self
  • dojox.gfx.silverlight.Path.rawNode.data

    • summary
  • dojox.gfx.silverlight.TextPath

    • type
      Function
    • chains:
      • sl.Shape: (prototype)
      • sl.Shape: (call)
      • g.path.TextPath: (call)
    • mixins:
      • g.path.TextPath.prototype: (prototype)
    • summary
      a textpath shape (Silverlight)
  • dojox.gfx.silverlight.TextPath._updateWithSegment

    • type
      Function
    • parameters:
      • segment: (typeof Object)
        a segment
    • source: [view]
         // summary: updates the bounding box of path with new segment
         // segment: Object: a segment
    • summary
      updates the bounding box of path with new segment
  • dojox.gfx.silverlight.TextPath.setShape

    • type
      Function
    • parameters:
      • newShape: (typeof Object)
        an SVG path string or a path object (see dojox.gfx.defaultPath)
    • source: [view]
         // summary: forms a path using a shape (Silverlight)
         // newShape: Object: an SVG path string or a path object (see dojox.gfx.defaultPath)
    • summary
      forms a path using a shape (Silverlight)
  • dojox.gfx.silverlight.TextPath._setText

    • type
      Function
    • source: [view]
    • summary
  • dojox.gfx.silverlight.Surface

    • type
      Function
    • chains:
      • gs.Surface: (prototype)
      • gs.Surface: (call)
      • gs.Container._init: (call)
    • summary
      a surface object to be used for drawings (Silverlight)
    • source: [view]
         gs.Container._init.call(this);
  • dojox.gfx.silverlight.Surface.destroy

    • type
      Function
    • source: [view]
         window[this._onLoadName] = nullFunc;
         delete surfaces[this._nodeName];
         this.inherited(arguments);
    • summary
  • dojox.gfx.silverlight.Surface.setDimensions

    • type
      Function
    • parameters:
      • width: (typeof String)
        width of surface, e.g., &quot;100px&quot;
      • height: (typeof String)
        height of surface, e.g., &quot;100px&quot;
    • source: [view]
         this.width = g.normalizedLength(width); // in pixels
         this.height = g.normalizedLength(height); // in pixels
         var p = this.rawNode && this.rawNode.getHost();
         if(p){
          p.width = width;
          p.height = height;
         }
         return this; // self
    • summary
      sets the width and height of the rawNode
    • returns
      self
  • dojox.gfx.silverlight.Surface.getDimensions

    • type
      Function
    • source: [view]
         var p = this.rawNode && this.rawNode.getHost();
         var t = p ? {width: p.content.actualWidth, height: p.content.actualHeight} : null;
         if(t.width <= 0){ t.width = this.width; }
         if(t.height <= 0){ t.height = this.height; }
         return t; // Object
    • summary
      returns an object with properties &quot;width&quot; and &quot;height&quot;
    • returns
      Object
  • dojox.gfx.silverlight.Surface.width

    • summary
  • dojox.gfx.silverlight.Surface.height

    • summary
  • dojox.gfx.silverlight.Surface.setDimensions.width

    • type
      String
    • summary
      width of surface, e.g., &quot;100px&quot;
  • dojox.gfx.silverlight.Surface.setDimensions.height

    • type
      String
    • summary
      height of surface, e.g., &quot;100px&quot;
  • fontweight

    • type
      Object
    • summary
  • caps

    • type
      Object
    • summary
  • joins

    • type
      Object
    • summary
  • fonts

    • type
      Object
    • summary
  • a

    • summary
  • sl.Group.nodeType

    • summary
  • sl.Rect.nodeType

    • summary
  • sl.Ellipse.nodeType

    • summary
  • sl.Circle.nodeType

    • summary
  • sl.Line.nodeType

    • summary
  • sl.Polyline.nodeType

    • summary
  • sl.Image.nodeType

    • summary
  • sl.Text.nodeType

    • summary
  • sl.Path.nodeType

    • summary
  • sl.TextPath.nodeType

    • summary
  • sl.createSurface

    • summary
  • ev.target

    • summary
  • ev.ctrlKey

    • summary
  • ev.shiftKey

    • summary
  • ev.x

    • summary
  • ev.y

    • summary
  • ev.clientX

    • summary
  • ev.clientY

    • summary
  • g.equalSources

    • summary
  • __dojoSilverlightError

    • type
      Function
    • parameters:
      • sender: (typeof )
      • err: (typeof )
    • source: [view]
        var t = "Silverlight Error:\n" +
         "Code: " + err.ErrorCode + "\n" +
         "Type: " + err.ErrorType + "\n" +
         "Message: " + err.ErrorMessage + "\n";
        switch(err.ErrorType){
         case "ParserError":
          t += "XamlFile: " + err.xamlFile + "\n" +
           "Line: " + err.lineNumber + "\n" +
           "Position: " + err.charPosition + "\n";
          break;
         case "RuntimeError":
          t += "MethodName: " + err.methodName + "\n";
          if(err.lineNumber != 0){
           t +=
            "Line: " + err.lineNumber + "\n" +
            "Position: " + err.charPosition + "\n";
          }
          break;
        }
    • summary
  • fontweight.normal

    • summary
  • fontweight.bold

    • summary
  • caps.butt

    • summary
  • caps.round

    • summary
  • caps.square

    • summary
  • joins.bevel

    • summary
  • joins.round

    • summary
  • fonts.serif

    • summary
  • fonts.times

    • summary
  • fonts.sans-serif

    • summary
  • fonts.helvetica

    • summary
  • fonts.monotone

    • summary
  • fonts.courier

    • summary
  • dojox.gfx.silverlight

    • type
      Object
    • summary
  • dojox.gfx

    • type
      Object
    • summary
  • dojox

    • type
      Object
    • summary