Nicolas Cellier uploaded a new version of Graphics to project The Trunk:
http://source.squeak.org/trunk/Graphics-jmg.191.mcz ==================== Summary ==================== Name: Graphics-jmg.191 Author: jmg Time: 6 January 2012, 2:37:58.42 pm UUID: 64aae19a-1a36-a346-ae1c-48f25bf77127 Ancestors: Graphics-bf.190 asColorref was using the color's green element twice, instead of red, green, and blue. Also, Color did not have a symmetrical constructor to create a Color from a colorref. Finally, converting from a float to an integer by using asInteger, rather than round seemed like the wrong thing to do. I tested this by iterating through Color class>>indexedColors, and converting them to colorrefs, then creating a Color from the colorref, and comparing the original with the new color. Without rounding I received ~239 failures and with rounding I received ~21 (still to be expected as we are converting a float in the range 0.0 - 1.0 to an integer in the range 0 - 255, so there will still be some error). =============== Diff against Graphics-bf.190 =============== Item was added: + ----- Method: Color class>>fromColorref: (in category 'instance creation') ----- + fromColorref: aColorref + | red green blue | + red := aColorref bitAnd: 255. + green := (aColorref bitAnd: 65280) + >> 8. + blue := (aColorref bitAnd: 16711680) + >> 16. + ^ self r: red g: green b: blue range: 255.! Item was changed: ----- Method: Color>>asColorref (in category 'conversions') ----- asColorref "Convert the receiver into a colorref" + ^ (self red * 255) rounded + ((self green * 255) rounded << 8) + ((self blue * 255) rounded << 16)! - ^(self red * 255) asInteger + ((self green * 255) asInteger << 8) + ((self green * 255) asInteger << 16)! |
Holy smokes! This was my first ever open source contribution I think, or at least very near to my first. A blast from the past! Thanks for integrating it Nicolas. On Thu, Jan 9, 2014 at 5:57 PM, <[hidden email]> wrote: Nicolas Cellier uploaded a new version of Graphics to project The Trunk: |
Yeah, one year of retention in the inbox, see how we are cautious with first timers ;) Anyway congratulations2014/1/10 Jeff Gonis <[hidden email]>
|
2 years retention even! Just to be extra sure. On Thu, Jan 9, 2014 at 6:35 PM, Nicolas Cellier <[hidden email]> wrote:
|
Free forum by Nabble | Edit this page |