#11940 closed defect (fixed)
dojox.Colorspace typos
Reported by: | bill | Owned by: | Tom Trenka |
---|---|---|---|
Priority: | high | Milestone: | 1.6 |
Component: | Dojox | Version: | 1.5 |
Keywords: | Cc: | ||
Blocked By: | Blocking: |
Description
I tried
dojox.color.Colorspace.convert({L: 1, a: 2, b: 3}, "Lab", "RGB");
and noticed the following apparent typos
- Shouldn't obj here be color?
this.convert=function(/* Object */color, /* string */from, /* string */to, /* Object? */kwArgs){ if(converters[from] && converters[from][to]){ return converters[from][to](obj, kwArgs); } console.warn("dojox.color.Colorspace::convert: Can't convert ", color, " from ", from, " to ", to, "."); };
- And here, looks like confusion between the variable name "p" and "primary":
this.matrix=function(/* String */to, /* Object */primary){ var wp=this.whitepoint(primary.whitepoint); var Xr = p.xr/p.yr, Yr = 1, Zr = (1-p.xr-p.yr)/p.yr; var Xg = p.xg/p.yg, Yg = 1, Zg = (1-p.xg-p.yg)/p.yg; var Xb = p.xb/p.yb, Yb = 1, Zr = (1-p.xb-p.yb)/p.yb; var m1 = [[ Xr, Yr, Zr ], [ Xg, Yg, Zg ], [ Xb, Yb, Zb ]]; var m2 = [[ wp.X, wp.Y, wp.Z ]]; var sm = dojox.math.matrix.multiply(m2, dojox.math.matrix.inverse(m1)); var Sr = sm[0][0], Sg = sm[0][1], Sb = sm[0][2]; var result=[ [Sr*Xr, Sr*Yr, Sr*Zr], [Sg*Xg, Sg*Yg, Sg*Zg], [Sb*Xb, Sb*Yb, Sb*Zb] ]; if(to=="RGB"){ return dojox.math.inverse(result); } return result; };
- Again in the above code
var Xb = p.xb/p.yb, Yb = 1, Zr = (1-p.xb-p.yb)/p.yb;
Probably wants to define Zb, rather than redefining Zr.
- Again in the above code
if(to=="RGB"){ return dojox.math.inverse(result); }
Should be
if(to=="RGB"){ return dojox.math.matrix.inverse(result); }
- mutliply
var rgb=dojox.math.matrix.mutliply([[ xyz.X, xyz.Y, xyz.Z ]], m);
should be
var rgb=dojox.math.matrix.multiply([[ xyz.X, xyz.Y, xyz.Z ]], m);
Attachments (1)
Change History (5)
comment:1 Changed 10 years ago by
Owner: | changed from Eugene Lazutkin to Tom Trenka |
---|
Changed 10 years ago by
Attachment: | ColorSpace.patch added |
---|
comment:2 Changed 10 years ago by
comment:3 Changed 9 years ago by
Resolution: | → fixed |
---|---|
Status: | new → closed |
Going to close this ticket, as dojox.color.Colorspace will probably be removed for the 2.x line of DTK (it was an old contribution from Cal Henderson, and is probably one of the least used things in DojoX).
comment:4 Changed 9 years ago by
Milestone: | tbd → 1.6 |
---|
Note: See
TracTickets for help on using
tickets.
fixed syntax errors but no idea if this code works on not