equal
deleted
inserted
replaced
3090 ]. |
3090 ]. |
3091 scaledGray1 := clr1 scaledRed. |
3091 scaledGray1 := clr1 scaledRed. |
3092 scaledGray2 := clr2 scaledRed. |
3092 scaledGray2 := clr2 scaledRed. |
3093 |
3093 |
3094 scaledGrey := (MaxValue * fraction) rounded. |
3094 scaledGrey := (MaxValue * fraction) rounded. |
3095 |
|
3096 newFraction := (scaledGrey - scaledGray1) asFloat / (scaledGray2 - scaledGray1). |
|
3097 ] ifFalse:[ |
3095 ] ifFalse:[ |
3098 nGray := (1 bitShift:d) - 1. |
3096 nGray := (1 bitShift:d) - 1. |
3099 |
3097 |
3100 "/ scale greyValue into grey levels |
3098 "/ scale greyValue into grey levels |
3101 |
3099 |
3114 scaledGray1 := grayBelow * step. |
3112 scaledGray1 := grayBelow * step. |
3115 scaledGray2 := scaledGray1 + step. |
3113 scaledGray2 := scaledGray1 + step. |
3116 |
3114 |
3117 clr1 := Color scaledGray:scaledGray1. |
3115 clr1 := Color scaledGray:scaledGray1. |
3118 clr2 := Color scaledGray:scaledGray2. |
3116 clr2 := Color scaledGray:scaledGray2. |
3119 |
|
3120 "/ scale remainder in between low..high |
|
3121 newFraction := (scaledGrey - scaledGray1) asFloat / (scaledGray2 - scaledGray1). |
|
3122 |
|
3123 "/ dither between those two colors |
|
3124 ]. |
3117 ]. |
|
3118 |
|
3119 "/ scale remainder in between low..high |
|
3120 newFraction := (scaledGrey - scaledGray1) asFloat / (scaledGray2 - scaledGray1). |
3125 ]. |
3121 ]. |
3126 |
3122 |
3127 clr1 := clr1 exactOn:aDevice. |
3123 clr1 := clr1 exactOn:aDevice. |
3128 clr2 := clr2 exactOn:aDevice. |
3124 clr2 := clr2 exactOn:aDevice. |
3129 |
3125 |
3159 on:Display |
3155 on:Display |
3160 into:[:clr :form | clr notNil ifTrue:[clr inspect]. |
3156 into:[:clr :form | clr notNil ifTrue:[clr inspect]. |
3161 form notNil ifTrue:[(form magnifiedBy:16) inspect].] |
3157 form notNil ifTrue:[(form magnifiedBy:16) inspect].] |
3162 " |
3158 " |
3163 |
3159 |
3164 "Created: 3.5.1997 / 10:59:57 / cg" |
3160 "Created: / 03-05-1997 / 10:59:57 / cg" |
3165 "Modified: 3.5.1997 / 11:05:09 / cg" |
3161 "Modified: / 24-07-2011 / 07:18:00 / cg" |
3166 ! |
3162 ! |
3167 |
3163 |
3168 ditherRed:rV green:gV blue:bV on:aDevice into:aBlock |
3164 ditherRed:rV green:gV blue:bV on:aDevice into:aBlock |
3169 "get a dither form or colorId for an rgb value. |
3165 "get a dither form or colorId for an rgb value. |
3170 Returns 2 values (either color or ditherForm) through |
3166 Returns 2 values (either color or ditherForm) through |
4999 |
4995 |
5000 "Created: / 16.11.1995 / 20:16:42 / cg" |
4996 "Created: / 16.11.1995 / 20:16:42 / cg" |
5001 "Modified: / 8.9.1998 / 17:32:10 / cg" |
4997 "Modified: / 8.9.1998 / 17:32:10 / cg" |
5002 ! ! |
4998 ! ! |
5003 |
4999 |
5004 !Color methodsFor:'inspecting'! |
|
5005 |
|
5006 inspectorExtraAttributes |
|
5007 "extra (pseudo instvar) entries to be shown in an inspector." |
|
5008 |
|
5009 ^ Dictionary new |
|
5010 declareAllNewFrom:(super inspectorExtraAttributes ? #()); |
|
5011 add:'-rgb' -> [ self rgbValue hexPrintString ]; |
|
5012 add:'-html' -> [ self htmlPrintString ]; |
|
5013 yourself |
|
5014 |
|
5015 " |
|
5016 Color red inspect |
|
5017 " |
|
5018 |
|
5019 "Modified: / 27-01-2011 / 11:48:15 / cg" |
|
5020 ! ! |
|
5021 |
5000 |
5022 !Color methodsFor:'instance creation'! |
5001 !Color methodsFor:'instance creation'! |
5023 |
5002 |
5024 alpha:alphaValue |
5003 alpha:alphaValue |
5025 "return a new color with the same color, but different alpha as the receiver. |
5004 "return a new color with the same color, but different alpha as the receiver. |
5572 ! ! |
5551 ! ! |
5573 |
5552 |
5574 !Color class methodsFor:'documentation'! |
5553 !Color class methodsFor:'documentation'! |
5575 |
5554 |
5576 version |
5555 version |
5577 ^ '$Header: /cvs/stx/stx/libview/Color.st,v 1.220 2011-01-27 10:48:21 cg Exp $' |
5556 ^ '$Header: /cvs/stx/stx/libview/Color.st,v 1.221 2011-07-24 06:54:22 cg Exp $' |
5578 ! |
5557 ! |
5579 |
5558 |
5580 version_CVS |
5559 version_CVS |
5581 ^ '$Header: /cvs/stx/stx/libview/Color.st,v 1.220 2011-01-27 10:48:21 cg Exp $' |
5560 ^ '$Header: /cvs/stx/stx/libview/Color.st,v 1.221 2011-07-24 06:54:22 cg Exp $' |
5582 ! ! |
5561 ! ! |
5583 |
5562 |
5584 Color initialize! |
5563 Color initialize! |