Cuis-Smalltalk / Cuis-Smalltalk-Dev

Active development of Cuis Smalltalk
MIT License
435 stars 70 forks source link

ColorForm wrongly converted to string #167

Closed hilaire closed 4 years ago

hilaire commented 4 years ago

Theme current haloScaleIcon as8BitColorForm storeString.

In the returned string, the ColorForm>colorsFromArray: message does not exist. Replacing by message colors: does not work either.

hilaire commented 4 years ago

There is a mismatch between the way the color are stored in array and the way it is fetch in the colors: method

For example, bellow, newColors at: i put: (colorArray at: i) may needs to be updated. Or it could be the way a color is stored in a string.

colors: colorList
    "Set my color palette to the given collection."

    | colorArray colorCount newColors |
    colorList ifNil: [
        colors _ cachedDepth _ cachedColormap _ nil.
        ^ self].

    colorArray _ colorList asArray.
    colorCount _ colorArray size.
    newColors _ Array new: (1 bitShift: self depth).
    1 to: newColors size do: [:i |
        i <= colorCount
            ifTrue: [newColors at: i put: (colorArray at: i)]
            ifFalse: [newColors at: i put: `Color transparent` ]].

    colors _ newColors.
    cachedDepth _ nil.
    cachedColormap _ nil.
jvuletich commented 4 years ago

Fix now at the repo. Thanks for reporting!