Color.st
changeset 2910 97a836c7e15c
parent 2889 143b466ea54b
child 2911 b0f0fc948830
equal deleted inserted replaced
2909:c8edb71fb275 2910:97a836c7e15c
  3280 
  3280 
  3281     "Created: 14.6.1996 / 20:13:22 / cg"
  3281     "Created: 14.6.1996 / 20:13:22 / cg"
  3282     "Modified: 11.7.1996 / 18:20:14 / cg"
  3282     "Modified: 11.7.1996 / 18:20:14 / cg"
  3283 ! !
  3283 ! !
  3284 
  3284 
       
  3285 !Color methodsFor:'AEG-Extensions'!
       
  3286 
       
  3287 device: aDevice
       
  3288 
       
  3289     device := aDevice
       
  3290 
       
  3291 !
       
  3292 
       
  3293 getBlue
       
  3294 
       
  3295     ^blue
       
  3296 !
       
  3297 
       
  3298 getGreen
       
  3299 
       
  3300     ^green
       
  3301 !
       
  3302 
       
  3303 getRed
       
  3304 
       
  3305     ^red
       
  3306 !
       
  3307 
       
  3308 magnifiedTo: extent
       
  3309 
       
  3310     "do nothing here, because of compatibility to Image"
       
  3311 !
       
  3312 
       
  3313 rgb3DByteArray
       
  3314     "return the 3d rgb byteValues packed into a byte array of length 3"
       
  3315 
       
  3316     ^Array with: (self red / 100) with: (self green / 100) with: (self blue / 100).
       
  3317 !
       
  3318 
       
  3319 rgbByteArray
       
  3320     "return the rgb byteValues packed into a byte array of length 3"
       
  3321 
       
  3322     ^ByteArray with: self redByte with: self greenByte with: self blueByte.
       
  3323 ! !
       
  3324 
  3285 !Color methodsFor:'ST-80 compatibility'!
  3325 !Color methodsFor:'ST-80 compatibility'!
  3286 
  3326 
  3287 asDevicePaintOn:aDevice
  3327 asDevicePaintOn:aDevice
  3288     "ST-80 compatibility: an alias for on:.
  3328     "ST-80 compatibility: an alias for on:.
  3289      create a new Color representing the same color as
  3329      create a new Color representing the same color as
  3804     "Modified: 22.4.1996 / 13:00:11 / cg"
  3844     "Modified: 22.4.1996 / 13:00:11 / cg"
  3805 ! !
  3845 ! !
  3806 
  3846 
  3807 !Color methodsFor:'copying'!
  3847 !Color methodsFor:'copying'!
  3808 
  3848 
       
  3849 deepCopyNamedInstvarsFrom:anOriginal using:aDictionary
       
  3850     "a helper for deepCopy; deep-copy instance variables from anOriginal,
       
  3851      using aDictionary to keep track of already copied objects.
       
  3852      Can be redefined in subclasses for partial copies"
       
  3853 
       
  3854     red := anOriginal scaledRed.
       
  3855     green := anOriginal scaledGreen.
       
  3856     blue := anOriginal scaledBlue.
       
  3857     colorId := anOriginal colorId.
       
  3858 
       
  3859 !
       
  3860 
  3809 postCopy
  3861 postCopy
  3810     "redefined to clear out any device handles in the copy"
  3862     "redefined to clear out any device handles in the copy"
  3811 
  3863 
  3812     device := colorId := ditherForm := replacementColor := nil
  3864     device := colorId := ditherForm := replacementColor := nil
  3813 
  3865 
  3814     "Modified: 17.1.1997 / 00:03:42 / cg"
  3866     "Modified: 17.1.1997 / 00:03:42 / cg"
       
  3867 !
       
  3868 
       
  3869 skipInstvarIndexInDeepCopy:index
       
  3870     index == 4 ifTrue:[
       
  3871         ^ true "/ skip device
       
  3872     ].
       
  3873     index == 5 ifTrue:[
       
  3874         ^ true "/ skip colorId
       
  3875     ].
       
  3876     index == 6 ifTrue:[
       
  3877         ^ true "/ skip ditherForm
       
  3878     ].
       
  3879     index == 7 ifTrue:[
       
  3880         ^ true "/ skip replacementColor
       
  3881     ].
       
  3882     ^ false
       
  3883 
       
  3884     "
       
  3885      (Color black onDevice:Screen current) deepCopy
       
  3886     "
  3815 ! !
  3887 ! !
  3816 
  3888 
  3817 !Color methodsFor:'getting a device color'!
  3889 !Color methodsFor:'getting a device color'!
  3818 
  3890 
  3819 exactOn:aDevice
  3891 exactOn:aDevice
  4638 ! !
  4710 ! !
  4639 
  4711 
  4640 !Color class methodsFor:'documentation'!
  4712 !Color class methodsFor:'documentation'!
  4641 
  4713 
  4642 version
  4714 version
  4643     ^ '$Header: /cvs/stx/stx/libview/Color.st,v 1.132 1999-09-08 15:54:28 cg Exp $'
  4715     ^ '$Header: /cvs/stx/stx/libview/Color.st,v 1.133 1999-09-15 12:57:54 cg Exp $'
  4644 ! !
  4716 ! !
  4645 Color initialize!
  4717 Color initialize!