Color.st
author Claus Gittinger <cg@exept.de>
Fri, 28 Feb 1997 13:28:03 +0100
changeset 1390 4b519886451f
parent 1370 37dfdffdd4b6
child 1428 79251ddda7a1
permissions -rw-r--r--
added #almostSameAs:
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
1023
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
     1
"
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
     2
 COPYRIGHT (c) 1992 by Claus Gittinger
1348
acb4e4874e4d care for ColorValue (ColorValue cyan)
ca
parents: 1347
diff changeset
     3
              All Rights Reserved
1023
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
     4
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
     5
 This software is furnished under a license and may be used
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
     6
 only in accordance with the terms of that license and with the
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
     7
 inclusion of the above copyright notice.   This software may not
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
     8
 be provided or otherwise made available to, or used by, any
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
     9
 other person.  No title to or ownership of the software is
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
    10
 hereby transferred.
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
    11
"
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
    12
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
    13
Object subclass:#Color
1365
37a9e7ac4dbc moved color registration from Color class to per-device lobby
Claus Gittinger <cg@exept.de>
parents: 1348
diff changeset
    14
	instanceVariableNames:'red green blue device colorId ditherForm replacementColor
37a9e7ac4dbc moved color registration from Color class to per-device lobby
Claus Gittinger <cg@exept.de>
parents: 1348
diff changeset
    15
		writable'
37a9e7ac4dbc moved color registration from Color class to per-device lobby
Claus Gittinger <cg@exept.de>
parents: 1348
diff changeset
    16
	classVariableNames:'MaxValue Cells Black White LightGrey Grey DarkGrey Pseudo0
37a9e7ac4dbc moved color registration from Color class to per-device lobby
Claus Gittinger <cg@exept.de>
parents: 1348
diff changeset
    17
		Pseudo1 PseudoAll Red Green Blue RetryAllocation DitherBits
37a9e7ac4dbc moved color registration from Color class to per-device lobby
Claus Gittinger <cg@exept.de>
parents: 1348
diff changeset
    18
		ColorAllocationFailSignal InvalidColorNameSignal'
37a9e7ac4dbc moved color registration from Color class to per-device lobby
Claus Gittinger <cg@exept.de>
parents: 1348
diff changeset
    19
	poolDictionaries:''
37a9e7ac4dbc moved color registration from Color class to per-device lobby
Claus Gittinger <cg@exept.de>
parents: 1348
diff changeset
    20
	category:'Graphics-Support'
1023
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
    21
!
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
    22
1144
07f3de59864d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1023
diff changeset
    23
!Color class methodsFor:'documentation'!
1023
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
    24
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
    25
copyright
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
    26
"
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
    27
 COPYRIGHT (c) 1992 by Claus Gittinger
1348
acb4e4874e4d care for ColorValue (ColorValue cyan)
ca
parents: 1347
diff changeset
    28
              All Rights Reserved
1023
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
    29
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
    30
 This software is furnished under a license and may be used
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
    31
 only in accordance with the terms of that license and with the
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
    32
 inclusion of the above copyright notice.   This software may not
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
    33
 be provided or otherwise made available to, or used by, any
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
    34
 other person.  No title to or ownership of the software is
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
    35
 hereby transferred.
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
    36
"
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
    37
!
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
    38
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
    39
documentation
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
    40
"
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
    41
    Color represents colors in a device independent manner, main info I keep about
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
    42
    mySelf are the red, green and blue components scaled into 0 .. MaxValue.
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
    43
    The device specific color can be aquired by sending a color the 'on:aDevice' message,
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
    44
    which will return a color with the same rgb values as the receiver but specific
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
    45
    for that device.
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
    46
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
    47
    Colors can be pure or dithered, depending on the capabilities of the device. 
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
    48
    For plain colors, the colorId-instvar is a handle (usually lookup-table entry) for that
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
    49
    device. For dithered colors, the colorId is nil and ditherForm specifies the form
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
    50
    used to dither that color. The ditherForm can be either a depth-1 bitmap or a pixmap
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
    51
    with the devices depth. The plain colors needed by the ditherForm are found in its
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
    52
    colormap (as usual for bitmaps).
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
    53
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
    54
    The default algorithm for color allocation is to ask the display for colors as
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
    55
    new colors are created. When running out of colors, dithered colors will be used,
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
    56
    using existing nearest colors and a dither pattern to aproximate the color.
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
    57
    There could be situations, where no good colors are available for the dither, leading
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
    58
    to ugly looking dither colors.
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
    59
    This can be avoided by preallocating a set of colors over the complete range, which
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
    60
    makes certain that appropriate colors are later available for the dither process.
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
    61
    To do so, add a statement like: 'Color getColors5x5x5' to the startup.rc file.
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
    62
    (beside 5x5x5, there are various other size combinations available).
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
    63
    However, doing so may make things worse when displaying bitmap images, since this
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
    64
    preallocated table may steal colors from the image ...
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
    65
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
    66
    [Instance variables:]
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
    67
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
    68
      red             <Integer>       the red component (0..MaxValue)
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
    69
      green           <Integer>       the green component (0..MaxValue)
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
    70
      blue            <Integer>       the blue component (0..MaxValue)
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
    71
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
    72
      device          <Device>        the device I am on, or nil
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
    73
      colorId         <Object>        some device dependent identifier (or nil if dithered)
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
    74
      ditherForm      <Form>          the Form to dither this color (if non-nil)
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
    75
      writable        <Boolean>       true if this is for a writable color cell
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
    76
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
    77
    [Class variables:]
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
    78
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
    79
      MaxValue        <Integer>       r/g/b components are scaled relative to this maximum
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
    80
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
    81
      Lobby           <Registry>      all colors in use - keeps track of already allocated
1229
249c0d78fd34 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1224
diff changeset
    82
                                      colors for reuse and finalization.
249c0d78fd34 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1224
diff changeset
    83
                                      (dont use it: this will be moved to the device)
249c0d78fd34 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1224
diff changeset
    84
1023
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
    85
      Cells           <Registry>      keeps track of allocated writable color cells
1229
249c0d78fd34 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1224
diff changeset
    86
                                      (dont use it: this will be moved to the device)
1023
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
    87
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
    88
      FixColors       <Array>         preallocated colors for dithering on Display
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
    89
      NumRedFix       <Integer>       number of distinct red values in FixColors
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
    90
      NumGreenFix     <Integer>       number of distinct green values in FixColors
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
    91
      NumBlueFix      <Integer>       number of distinct blue values in FixColors
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
    92
    
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
    93
      Black           <Color>         for fast return of black
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
    94
      White           <Color>         for fast return of white
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
    95
      Grey            <Color>         for fast return of grey
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
    96
      LightGrey       <Color>         for fast return of lightGrey
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
    97
      DarkGrey        <Color>         for fast return of darkGrey
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
    98
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
    99
      Pseudo0         <Color>         a color with 0 as handle (for forms and bitblit)
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
   100
      Pseudo1         <Color>         a color with 1 as handle (for forms)
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
   101
      PseudoAll       <Color>         a color with allPlanes as handle (for bitblit)
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
   102
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
   103
      Red             <Color>         red, needed for dithering
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
   104
      Green           <Color>         green, for dithering
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
   105
      Blue            <Color>         blue, for dithering
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
   106
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
   107
      DitherColors    <Collection>    some preallocated colors for dithering
1229
249c0d78fd34 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1224
diff changeset
   108
                                      (kept, so they are available when needed)
1023
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
   109
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
   110
      RetryAllocation <Boolean>       this flag controls how a request for a
1229
249c0d78fd34 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1224
diff changeset
   111
                                      color should be handled which failed previously.
249c0d78fd34 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1224
diff changeset
   112
                                      I.e. a color is asked for, which was dithered
249c0d78fd34 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1224
diff changeset
   113
                                      the last time. Since it could happen, that in
249c0d78fd34 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1224
diff changeset
   114
                                      the meantime more colors became free, the request
249c0d78fd34 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1224
diff changeset
   115
                                      might succeed this time - however, your screen may
249c0d78fd34 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1224
diff changeset
   116
                                      look a bit funny, due to having both dithered and
249c0d78fd34 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1224
diff changeset
   117
                                      undithered versions around.
249c0d78fd34 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1224
diff changeset
   118
                                      The default is true, which means: do retry
1023
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
   119
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
   120
    compatibility issues:
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
   121
1229
249c0d78fd34 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1224
diff changeset
   122
        ST-80 seems to represent colors internally with scaled smallInteger
249c0d78fd34 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1224
diff changeset
   123
        components (this can be guessed from uses of
249c0d78fd34 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1224
diff changeset
   124
        scaledRed:scaledGreen:scaledBlue:). The main instance creation method is
249c0d78fd34 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1224
diff changeset
   125
        via 'ColorValue red:green:blue:', passing components in 0..1.
249c0d78fd34 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1224
diff changeset
   126
        In ST/X, component are internally represented as percent.
249c0d78fd34 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1224
diff changeset
   127
        For more compatibility (when subclassing color), these internals may
249c0d78fd34 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1224
diff changeset
   128
        change in the near future. For migration, a compatibility subclass
249c0d78fd34 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1224
diff changeset
   129
        called ColorValue is provided. 
249c0d78fd34 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1224
diff changeset
   130
        After the change, Color will be renamed to ColorValue and Color
249c0d78fd34 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1224
diff changeset
   131
        be made a subclass of ColorValue (offering the 0..100 interface for
249c0d78fd34 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1224
diff changeset
   132
        backward compatibility).
1023
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
   133
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
   134
    [see also:]
1229
249c0d78fd34 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1224
diff changeset
   135
        DeviceWorkstation 
249c0d78fd34 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1224
diff changeset
   136
        GraphicsContext DeviceDrawable Form Image Colormap
249c0d78fd34 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1224
diff changeset
   137
        Font Cursor
1023
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
   138
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
   139
    [author:]
1229
249c0d78fd34 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1224
diff changeset
   140
        Claus Gittinger
1023
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
   141
"
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
   142
! !
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
   143
1144
07f3de59864d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1023
diff changeset
   144
!Color class methodsFor:'initialization'!
1023
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
   145
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
   146
flushDeviceColors
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
   147
    "unassign all colors from their device"
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
   148
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
   149
    self allInstances do:[:aColor |
1348
acb4e4874e4d care for ColorValue (ColorValue cyan)
ca
parents: 1347
diff changeset
   150
        aColor restored
1023
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
   151
    ].
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
   152
1365
37a9e7ac4dbc moved color registration from Color class to per-device lobby
Claus Gittinger <cg@exept.de>
parents: 1348
diff changeset
   153
    "Modified: 24.2.1997 / 18:27:06 / cg"
1023
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
   154
!
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
   155
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
   156
getColors6x6x4
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
   157
    "preallocates a 6x6x4 (144) colorMap and later uses those colors only.
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
   158
     Doing so has the advantage that the system will never run out of colors,
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
   159
     however, colors may be either inexact or dithered."
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
   160
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
   161
    self getColorsRed:6 green:6 blue:4
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
   162
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
   163
    "
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
   164
     Color getColors6x6x4
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
   165
    "
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
   166
!
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
   167
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
   168
getColors6x6x5
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
   169
    "preallocates a 6x6x5 (180) colorMap and later uses those colors only.
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
   170
     Doing so has the advantage that the system will never run out of colors,
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
   171
     however, colors may be either inexact or dithered."
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
   172
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
   173
    self getColorsRed:6 green:6 blue:5
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
   174
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
   175
    "
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
   176
     Color getColors6x6x5
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
   177
    "
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
   178
!
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
   179
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
   180
getColors6x6x6
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
   181
    "preallocates a 6x6x6 (196) colorMap and later uses those colors only.
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
   182
     Doing so has the advantage that the system will never run out of colors,
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
   183
     however, colors may be either inexact or dithered."
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
   184
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
   185
    self getColorsRed:6 green:6 blue:6
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
   186
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
   187
    "
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
   188
     Color getColors6x6x6
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
   189
    "
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
   190
!
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
   191
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
   192
getColors6x7x4
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
   193
    "preallocates a 6x7x4 (168) colorMap and later uses those colors only.
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
   194
     Doing so has the advantage that the system will never run out of colors,
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
   195
     however, colors may be either inexact or dithered."
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
   196
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
   197
    self getColorsRed:6 green:7 blue:4
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
   198
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
   199
    "
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
   200
     Color getColors6x7x4
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
   201
    "
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
   202
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
   203
    "Created: 12.6.1996 / 17:41:57 / cg"
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
   204
!
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
   205
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
   206
getColors7x8x4
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
   207
    "preallocates a 7x8x4 (224) colorMap and later uses those colors only.
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
   208
     Doing so has the advantage that the system will never run out of colors,
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
   209
     however, colors may be either inexact or dithered."
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
   210
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
   211
    self getColorsRed:7 green:8 blue:4
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
   212
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
   213
    "
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
   214
     Color getColors7x8x4
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
   215
    "
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
   216
!
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
   217
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
   218
getColorsRed:nRed green:nGreen blue:nBlue
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
   219
    "preallocates a nR x nG x nB colorMap for later use in dithering.
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
   220
     Doing so has the advantage that the system will never run out of colors,
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
   221
     however, colors may be either inexact or dithered."
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
   222
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
   223
    self getColorsRed:nRed green:nGreen blue:nBlue on:Display
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
   224
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
   225
    "
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
   226
     Color getColorsRed:2 green:2 blue:2
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
   227
    "
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
   228
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
   229
    "Modified: 11.7.1996 / 17:58:09 / cg"
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
   230
!
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
   231
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
   232
getColorsRed:nRed green:nGreen blue:nBlue on:aDevice
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
   233
    "preallocates a nR x nG x nB colorMap for later use in dithering.
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
   234
     Doing so has the advantage that the system will never run out of colors,
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
   235
     however, colors may be either inexact or dithered."
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
   236
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
   237
    |nR "{Class: SmallInteger }"
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
   238
     nG "{Class: SmallInteger }"
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
   239
     nB "{Class: SmallInteger }"
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
   240
     dR dG dB red green blue dstIndex clr round
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
   241
     fixColors|
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
   242
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
   243
    aDevice visualType == #TrueColor ifTrue:[^ self].
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
   244
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
   245
    nR := nRed.
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
   246
    nG := nGreen.
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
   247
    nB := nBlue.
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
   248
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
   249
    dR := 100.0 / (nR - 1).
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
   250
    dG := 100.0 / (nG - 1).
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
   251
    dB := 100.0 / (nB - 1).
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
   252
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
   253
    fixColors := Array new:(nR * nG * nB).
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
   254
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
   255
    round := 0.
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
   256
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
   257
    dstIndex := 1.
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
   258
    1 to:nR do:[:sR |
1165
a5334c030820 new infoMessage scheme
Claus Gittinger <cg@exept.de>
parents: 1144
diff changeset
   259
        red := dR * (sR - 1).
a5334c030820 new infoMessage scheme
Claus Gittinger <cg@exept.de>
parents: 1144
diff changeset
   260
        1 to:nG do:[:sG |
a5334c030820 new infoMessage scheme
Claus Gittinger <cg@exept.de>
parents: 1144
diff changeset
   261
            green := dG * (sG - 1).
a5334c030820 new infoMessage scheme
Claus Gittinger <cg@exept.de>
parents: 1144
diff changeset
   262
            1 to:nB do:[:sB |
a5334c030820 new infoMessage scheme
Claus Gittinger <cg@exept.de>
parents: 1144
diff changeset
   263
                blue := dB * (sB - 1).
a5334c030820 new infoMessage scheme
Claus Gittinger <cg@exept.de>
parents: 1144
diff changeset
   264
                clr := (self red:red green:green blue:blue) exactOn:aDevice.
a5334c030820 new infoMessage scheme
Claus Gittinger <cg@exept.de>
parents: 1144
diff changeset
   265
                clr isNil ifTrue:[
a5334c030820 new infoMessage scheme
Claus Gittinger <cg@exept.de>
parents: 1144
diff changeset
   266
                    round == 0 ifTrue:[
a5334c030820 new infoMessage scheme
Claus Gittinger <cg@exept.de>
parents: 1144
diff changeset
   267
                        'Color [info]: scavenge to reclaim colors' infoPrintCR.
a5334c030820 new infoMessage scheme
Claus Gittinger <cg@exept.de>
parents: 1144
diff changeset
   268
                        ObjectMemory scavenge.
a5334c030820 new infoMessage scheme
Claus Gittinger <cg@exept.de>
parents: 1144
diff changeset
   269
                        round := 1.
a5334c030820 new infoMessage scheme
Claus Gittinger <cg@exept.de>
parents: 1144
diff changeset
   270
                        clr := (self red:red green:green blue:blue) exactOn:aDevice.
a5334c030820 new infoMessage scheme
Claus Gittinger <cg@exept.de>
parents: 1144
diff changeset
   271
                    ].
a5334c030820 new infoMessage scheme
Claus Gittinger <cg@exept.de>
parents: 1144
diff changeset
   272
                ].
a5334c030820 new infoMessage scheme
Claus Gittinger <cg@exept.de>
parents: 1144
diff changeset
   273
                clr isNil ifTrue:[
a5334c030820 new infoMessage scheme
Claus Gittinger <cg@exept.de>
parents: 1144
diff changeset
   274
                    round == 1 ifTrue:[
a5334c030820 new infoMessage scheme
Claus Gittinger <cg@exept.de>
parents: 1144
diff changeset
   275
                        'Color [info]: collect garbage to reclaim colors' infoPrintCR.
a5334c030820 new infoMessage scheme
Claus Gittinger <cg@exept.de>
parents: 1144
diff changeset
   276
                        ObjectMemory performLowSpaceCleanup.
a5334c030820 new infoMessage scheme
Claus Gittinger <cg@exept.de>
parents: 1144
diff changeset
   277
                        ObjectMemory garbageCollect.
a5334c030820 new infoMessage scheme
Claus Gittinger <cg@exept.de>
parents: 1144
diff changeset
   278
                        round := 2.
a5334c030820 new infoMessage scheme
Claus Gittinger <cg@exept.de>
parents: 1144
diff changeset
   279
                        clr := (self red:red green:green blue:blue) exactOn:aDevice.
a5334c030820 new infoMessage scheme
Claus Gittinger <cg@exept.de>
parents: 1144
diff changeset
   280
                   ].
a5334c030820 new infoMessage scheme
Claus Gittinger <cg@exept.de>
parents: 1144
diff changeset
   281
                ].
a5334c030820 new infoMessage scheme
Claus Gittinger <cg@exept.de>
parents: 1144
diff changeset
   282
                clr isNil ifTrue:[
a5334c030820 new infoMessage scheme
Claus Gittinger <cg@exept.de>
parents: 1144
diff changeset
   283
                    ColorAllocationFailSignal raiseErrorString:'failed to allocate fix color'.
a5334c030820 new infoMessage scheme
Claus Gittinger <cg@exept.de>
parents: 1144
diff changeset
   284
                    ^ self
a5334c030820 new infoMessage scheme
Claus Gittinger <cg@exept.de>
parents: 1144
diff changeset
   285
                ].
a5334c030820 new infoMessage scheme
Claus Gittinger <cg@exept.de>
parents: 1144
diff changeset
   286
                fixColors at:dstIndex put:clr.
a5334c030820 new infoMessage scheme
Claus Gittinger <cg@exept.de>
parents: 1144
diff changeset
   287
                dstIndex := dstIndex + 1
a5334c030820 new infoMessage scheme
Claus Gittinger <cg@exept.de>
parents: 1144
diff changeset
   288
            ]
a5334c030820 new infoMessage scheme
Claus Gittinger <cg@exept.de>
parents: 1144
diff changeset
   289
        ]
1023
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
   290
    ].
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
   291
    aDevice setFixColors:fixColors
1165
a5334c030820 new infoMessage scheme
Claus Gittinger <cg@exept.de>
parents: 1144
diff changeset
   292
                  numRed:nR numGreen:nG numBlue:nB
1023
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
   293
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
   294
    "
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
   295
     Color getColorsRed:2 green:2 blue:2 on:Display
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
   296
    "
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
   297
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
   298
    "Created: 11.7.1996 / 17:55:32 / cg"
1165
a5334c030820 new infoMessage scheme
Claus Gittinger <cg@exept.de>
parents: 1144
diff changeset
   299
    "Modified: 10.1.1997 / 15:37:13 / cg"
1023
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
   300
!
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
   301
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
   302
getPrimaryColorsOn:aDevice
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
   303
    "preallocate the primary colors.
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
   304
     Doing so during early startup prevents us from running out
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
   305
     of (at least those required) colors later.
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
   306
     This guarantees, that at least some colors are available
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
   307
     for dithering (although, with only black, white, red, green and blue,
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
   308
     dithered images look very poor)."
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
   309
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
   310
    |colors white black red green blue|
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
   311
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
   312
    (aDevice notNil and:[aDevice ditherColors isNil]) ifTrue:[
1348
acb4e4874e4d care for ColorValue (ColorValue cyan)
ca
parents: 1347
diff changeset
   313
        white := (self red:100 green:100 blue:100) exactOn:aDevice.
acb4e4874e4d care for ColorValue (ColorValue cyan)
ca
parents: 1347
diff changeset
   314
        black := (self red:0 green:0 blue:0) exactOn:aDevice.
acb4e4874e4d care for ColorValue (ColorValue cyan)
ca
parents: 1347
diff changeset
   315
acb4e4874e4d care for ColorValue (ColorValue cyan)
ca
parents: 1347
diff changeset
   316
        aDevice hasColors ifTrue:[
acb4e4874e4d care for ColorValue (ColorValue cyan)
ca
parents: 1347
diff changeset
   317
            red := (self red:100 green:0 blue:0) exactOn:aDevice.
acb4e4874e4d care for ColorValue (ColorValue cyan)
ca
parents: 1347
diff changeset
   318
            green := (self red:0 green:100 blue:0) exactOn:aDevice.
acb4e4874e4d care for ColorValue (ColorValue cyan)
ca
parents: 1347
diff changeset
   319
            blue := (self red:0 green:0 blue:100) exactOn:aDevice.
acb4e4874e4d care for ColorValue (ColorValue cyan)
ca
parents: 1347
diff changeset
   320
        ].
acb4e4874e4d care for ColorValue (ColorValue cyan)
ca
parents: 1347
diff changeset
   321
acb4e4874e4d care for ColorValue (ColorValue cyan)
ca
parents: 1347
diff changeset
   322
        aDevice == Display ifTrue:[
acb4e4874e4d care for ColorValue (ColorValue cyan)
ca
parents: 1347
diff changeset
   323
            "/ keep those around for the main display
acb4e4874e4d care for ColorValue (ColorValue cyan)
ca
parents: 1347
diff changeset
   324
            White := white.
acb4e4874e4d care for ColorValue (ColorValue cyan)
ca
parents: 1347
diff changeset
   325
            Black := black.
acb4e4874e4d care for ColorValue (ColorValue cyan)
ca
parents: 1347
diff changeset
   326
            Red := red.
acb4e4874e4d care for ColorValue (ColorValue cyan)
ca
parents: 1347
diff changeset
   327
            Green := green.
acb4e4874e4d care for ColorValue (ColorValue cyan)
ca
parents: 1347
diff changeset
   328
            Blue := blue
acb4e4874e4d care for ColorValue (ColorValue cyan)
ca
parents: 1347
diff changeset
   329
        ].
acb4e4874e4d care for ColorValue (ColorValue cyan)
ca
parents: 1347
diff changeset
   330
acb4e4874e4d care for ColorValue (ColorValue cyan)
ca
parents: 1347
diff changeset
   331
        aDevice visualType ~~ #TrueColor ifTrue:[
acb4e4874e4d care for ColorValue (ColorValue cyan)
ca
parents: 1347
diff changeset
   332
            aDevice hasColors ifTrue:[
acb4e4874e4d care for ColorValue (ColorValue cyan)
ca
parents: 1347
diff changeset
   333
acb4e4874e4d care for ColorValue (ColorValue cyan)
ca
parents: 1347
diff changeset
   334
                "preallocate some colors for dithering 
acb4e4874e4d care for ColorValue (ColorValue cyan)
ca
parents: 1347
diff changeset
   335
                 - otherwise, they may not be available when we need them ...
acb4e4874e4d care for ColorValue (ColorValue cyan)
ca
parents: 1347
diff changeset
   336
                 these are: black, white, grey50,
acb4e4874e4d care for ColorValue (ColorValue cyan)
ca
parents: 1347
diff changeset
   337
                            red, green, blue, yellow, cyan and magenta.
acb4e4874e4d care for ColorValue (ColorValue cyan)
ca
parents: 1347
diff changeset
   338
                "
acb4e4874e4d care for ColorValue (ColorValue cyan)
ca
parents: 1347
diff changeset
   339
acb4e4874e4d care for ColorValue (ColorValue cyan)
ca
parents: 1347
diff changeset
   340
                colors := OrderedCollection new.
acb4e4874e4d care for ColorValue (ColorValue cyan)
ca
parents: 1347
diff changeset
   341
                colors add:((self gray:50) exactOn:aDevice).
acb4e4874e4d care for ColorValue (ColorValue cyan)
ca
parents: 1347
diff changeset
   342
acb4e4874e4d care for ColorValue (ColorValue cyan)
ca
parents: 1347
diff changeset
   343
                colors add:white; add:black; add:red; add:green; add:blue.
acb4e4874e4d care for ColorValue (ColorValue cyan)
ca
parents: 1347
diff changeset
   344
acb4e4874e4d care for ColorValue (ColorValue cyan)
ca
parents: 1347
diff changeset
   345
                colors add:((self red:100 green:100 blue:0) exactOn:aDevice).
acb4e4874e4d care for ColorValue (ColorValue cyan)
ca
parents: 1347
diff changeset
   346
                colors add:((self red:100 green:0 blue:100) exactOn:aDevice).
acb4e4874e4d care for ColorValue (ColorValue cyan)
ca
parents: 1347
diff changeset
   347
                colors add:((self red:0 green:100 blue:100) exactOn:aDevice).
acb4e4874e4d care for ColorValue (ColorValue cyan)
ca
parents: 1347
diff changeset
   348
acb4e4874e4d care for ColorValue (ColorValue cyan)
ca
parents: 1347
diff changeset
   349
                colors := colors select:[:clr | clr notNil].
acb4e4874e4d care for ColorValue (ColorValue cyan)
ca
parents: 1347
diff changeset
   350
            ].
acb4e4874e4d care for ColorValue (ColorValue cyan)
ca
parents: 1347
diff changeset
   351
acb4e4874e4d care for ColorValue (ColorValue cyan)
ca
parents: 1347
diff changeset
   352
            aDevice hasGreyscales ifTrue:[
acb4e4874e4d care for ColorValue (ColorValue cyan)
ca
parents: 1347
diff changeset
   353
                aDevice hasColors ifFalse:[
acb4e4874e4d care for ColorValue (ColorValue cyan)
ca
parents: 1347
diff changeset
   354
                    colors := OrderedCollection new.
acb4e4874e4d care for ColorValue (ColorValue cyan)
ca
parents: 1347
diff changeset
   355
                    colors add:((self gray:50) exactOn:aDevice).
acb4e4874e4d care for ColorValue (ColorValue cyan)
ca
parents: 1347
diff changeset
   356
                    colors add:white; add:black.
acb4e4874e4d care for ColorValue (ColorValue cyan)
ca
parents: 1347
diff changeset
   357
acb4e4874e4d care for ColorValue (ColorValue cyan)
ca
parents: 1347
diff changeset
   358
                ].
acb4e4874e4d care for ColorValue (ColorValue cyan)
ca
parents: 1347
diff changeset
   359
                colors add:((self gray:25) exactOn:aDevice).
acb4e4874e4d care for ColorValue (ColorValue cyan)
ca
parents: 1347
diff changeset
   360
                colors add:((self gray:33) exactOn:aDevice).
acb4e4874e4d care for ColorValue (ColorValue cyan)
ca
parents: 1347
diff changeset
   361
                colors add:((self gray:67) exactOn:aDevice).
acb4e4874e4d care for ColorValue (ColorValue cyan)
ca
parents: 1347
diff changeset
   362
                colors add:((self gray:75) exactOn:aDevice).
acb4e4874e4d care for ColorValue (ColorValue cyan)
ca
parents: 1347
diff changeset
   363
acb4e4874e4d care for ColorValue (ColorValue cyan)
ca
parents: 1347
diff changeset
   364
                colors := colors select:[:clr | clr notNil].
acb4e4874e4d care for ColorValue (ColorValue cyan)
ca
parents: 1347
diff changeset
   365
            ].
acb4e4874e4d care for ColorValue (ColorValue cyan)
ca
parents: 1347
diff changeset
   366
acb4e4874e4d care for ColorValue (ColorValue cyan)
ca
parents: 1347
diff changeset
   367
            colors notNil ifTrue:[  
acb4e4874e4d care for ColorValue (ColorValue cyan)
ca
parents: 1347
diff changeset
   368
                aDevice setDitherColors:(colors asArray).
acb4e4874e4d care for ColorValue (ColorValue cyan)
ca
parents: 1347
diff changeset
   369
            ]
acb4e4874e4d care for ColorValue (ColorValue cyan)
ca
parents: 1347
diff changeset
   370
        ]
1023
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
   371
    ]
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
   372
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
   373
    "Created: 11.7.1996 / 18:09:28 / cg"
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
   374
    "Modified: 11.7.1996 / 18:27:39 / cg"
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
   375
!
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
   376
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
   377
initialize
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
   378
    "setup tracker of known colors and initialize classvars with
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
   379
     heavily used colors"
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
   380
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
   381
    ColorAllocationFailSignal isNil ifTrue:[
1269
f0777b2cc08a use a signal for invalid color names
Claus Gittinger <cg@exept.de>
parents: 1239
diff changeset
   382
        ColorAllocationFailSignal := ErrorSignal newSignalMayProceed:true.
f0777b2cc08a use a signal for invalid color names
Claus Gittinger <cg@exept.de>
parents: 1239
diff changeset
   383
        ColorAllocationFailSignal nameClass:self message:#colorAllocationFailSignal.
f0777b2cc08a use a signal for invalid color names
Claus Gittinger <cg@exept.de>
parents: 1239
diff changeset
   384
        ColorAllocationFailSignal notifierString:'color allocation failed'.
f0777b2cc08a use a signal for invalid color names
Claus Gittinger <cg@exept.de>
parents: 1239
diff changeset
   385
f0777b2cc08a use a signal for invalid color names
Claus Gittinger <cg@exept.de>
parents: 1239
diff changeset
   386
        InvalidColorNameSignal := ErrorSignal newSignalMayProceed:true.
f0777b2cc08a use a signal for invalid color names
Claus Gittinger <cg@exept.de>
parents: 1239
diff changeset
   387
        InvalidColorNameSignal nameClass:self message:#invalidColorNameSignal.
f0777b2cc08a use a signal for invalid color names
Claus Gittinger <cg@exept.de>
parents: 1239
diff changeset
   388
        InvalidColorNameSignal notifierString:'invalid color name'.
1023
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
   389
    ].
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
   390
1365
37a9e7ac4dbc moved color registration from Color class to per-device lobby
Claus Gittinger <cg@exept.de>
parents: 1348
diff changeset
   391
    MaxValue := 16rFFFF.
37a9e7ac4dbc moved color registration from Color class to per-device lobby
Claus Gittinger <cg@exept.de>
parents: 1348
diff changeset
   392
37a9e7ac4dbc moved color registration from Color class to per-device lobby
Claus Gittinger <cg@exept.de>
parents: 1348
diff changeset
   393
    "want to be informed when returning from snapshot"
37a9e7ac4dbc moved color registration from Color class to per-device lobby
Claus Gittinger <cg@exept.de>
parents: 1348
diff changeset
   394
    ObjectMemory addDependent:self.
37a9e7ac4dbc moved color registration from Color class to per-device lobby
Claus Gittinger <cg@exept.de>
parents: 1348
diff changeset
   395
37a9e7ac4dbc moved color registration from Color class to per-device lobby
Claus Gittinger <cg@exept.de>
parents: 1348
diff changeset
   396
    RetryAllocation := true.
37a9e7ac4dbc moved color registration from Color class to per-device lobby
Claus Gittinger <cg@exept.de>
parents: 1348
diff changeset
   397
37a9e7ac4dbc moved color registration from Color class to per-device lobby
Claus Gittinger <cg@exept.de>
parents: 1348
diff changeset
   398
    DitherBits := self ditherBits.
37a9e7ac4dbc moved color registration from Color class to per-device lobby
Claus Gittinger <cg@exept.de>
parents: 1348
diff changeset
   399
37a9e7ac4dbc moved color registration from Color class to per-device lobby
Claus Gittinger <cg@exept.de>
parents: 1348
diff changeset
   400
    "
37a9e7ac4dbc moved color registration from Color class to per-device lobby
Claus Gittinger <cg@exept.de>
parents: 1348
diff changeset
   401
     Color initialize
37a9e7ac4dbc moved color registration from Color class to per-device lobby
Claus Gittinger <cg@exept.de>
parents: 1348
diff changeset
   402
    "
37a9e7ac4dbc moved color registration from Color class to per-device lobby
Claus Gittinger <cg@exept.de>
parents: 1348
diff changeset
   403
1370
37dfdffdd4b6 getPrimaryColors now invoked from device
Claus Gittinger <cg@exept.de>
parents: 1368
diff changeset
   404
    "Modified: 24.2.1997 / 22:08:35 / cg"
1023
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
   405
!
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
   406
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
   407
update:something with:aParameter from:changedObject
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
   408
    "handle image restarts and flush any device resource handles"
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
   409
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
   410
    (something == #restarted) ifTrue:[
1348
acb4e4874e4d care for ColorValue (ColorValue cyan)
ca
parents: 1347
diff changeset
   411
        self flushDeviceColors
1023
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
   412
    ].
1370
37dfdffdd4b6 getPrimaryColors now invoked from device
Claus Gittinger <cg@exept.de>
parents: 1368
diff changeset
   413
1023
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
   414
    (something == #returnFromSnapshot) ifTrue:[
1348
acb4e4874e4d care for ColorValue (ColorValue cyan)
ca
parents: 1347
diff changeset
   415
        Display visualType == #TrueColor ifTrue:[
acb4e4874e4d care for ColorValue (ColorValue cyan)
ca
parents: 1347
diff changeset
   416
            Display releaseFixColors
acb4e4874e4d care for ColorValue (ColorValue cyan)
ca
parents: 1347
diff changeset
   417
        ] ifFalse:[
acb4e4874e4d care for ColorValue (ColorValue cyan)
ca
parents: 1347
diff changeset
   418
            Display fixColors notNil ifTrue:[
acb4e4874e4d care for ColorValue (ColorValue cyan)
ca
parents: 1347
diff changeset
   419
                ColorAllocationFailSignal handle:[:ex |
acb4e4874e4d care for ColorValue (ColorValue cyan)
ca
parents: 1347
diff changeset
   420
                    ex return
acb4e4874e4d care for ColorValue (ColorValue cyan)
ca
parents: 1347
diff changeset
   421
                ] do:[
acb4e4874e4d care for ColorValue (ColorValue cyan)
ca
parents: 1347
diff changeset
   422
                    |nR nG nB|
acb4e4874e4d care for ColorValue (ColorValue cyan)
ca
parents: 1347
diff changeset
   423
acb4e4874e4d care for ColorValue (ColorValue cyan)
ca
parents: 1347
diff changeset
   424
                    nR := Display numFixRed.
acb4e4874e4d care for ColorValue (ColorValue cyan)
ca
parents: 1347
diff changeset
   425
                    nG := Display numFixGreen.
acb4e4874e4d care for ColorValue (ColorValue cyan)
ca
parents: 1347
diff changeset
   426
                    nB := Display numFixBlue.
acb4e4874e4d care for ColorValue (ColorValue cyan)
ca
parents: 1347
diff changeset
   427
                    Display releaseFixColors.
acb4e4874e4d care for ColorValue (ColorValue cyan)
ca
parents: 1347
diff changeset
   428
                    self getColorsRed:nR
acb4e4874e4d care for ColorValue (ColorValue cyan)
ca
parents: 1347
diff changeset
   429
                                green:nG
acb4e4874e4d care for ColorValue (ColorValue cyan)
ca
parents: 1347
diff changeset
   430
                                 blue:nB
acb4e4874e4d care for ColorValue (ColorValue cyan)
ca
parents: 1347
diff changeset
   431
                                   on:Display
acb4e4874e4d care for ColorValue (ColorValue cyan)
ca
parents: 1347
diff changeset
   432
                ]
acb4e4874e4d care for ColorValue (ColorValue cyan)
ca
parents: 1347
diff changeset
   433
            ]
acb4e4874e4d care for ColorValue (ColorValue cyan)
ca
parents: 1347
diff changeset
   434
        ]
1023
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
   435
    ]
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
   436
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
   437
    "Created: 15.6.1996 / 15:14:03 / cg"
1370
37dfdffdd4b6 getPrimaryColors now invoked from device
Claus Gittinger <cg@exept.de>
parents: 1368
diff changeset
   438
    "Modified: 24.2.1997 / 22:08:05 / cg"
1023
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
   439
! !
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
   440
1144
07f3de59864d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1023
diff changeset
   441
!Color class methodsFor:'instance creation'!
1023
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
   442
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
   443
allColor
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
   444
    "return a special color which, when used for bit-blitting will
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
   445
     behave like a all-1-color (i.e. have a device-pixel value of all-1s)"
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
   446
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
   447
    PseudoAll isNil ifTrue:[
1238
b363894182d0 prepare for replacement colors
Claus Gittinger <cg@exept.de>
parents: 1237
diff changeset
   448
        PseudoAll := self basicNew setColorId:-1
1023
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
   449
    ].
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
   450
    ^ PseudoAll
1238
b363894182d0 prepare for replacement colors
Claus Gittinger <cg@exept.de>
parents: 1237
diff changeset
   451
b363894182d0 prepare for replacement colors
Claus Gittinger <cg@exept.de>
parents: 1237
diff changeset
   452
    "Modified: 17.1.1997 / 00:05:36 / cg"
1023
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
   453
!
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
   454
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
   455
brightness:brightness
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
   456
    "create a gray color with given brightness (0..1).
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
   457
     ST-80 compatibility."
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
   458
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
   459
    ^ self scaledGray:(brightness * MaxValue)
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
   460
!
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
   461
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
   462
colorId:id
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
   463
    "return a color for a specific colorid without associating it to a
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
   464
     specific device. Use this only for bitmaps which want 0- or 1-color,
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
   465
     or for bitblits if you want to manipulate a specific colorplane."
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
   466
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
   467
    id == 0 ifTrue:[
1238
b363894182d0 prepare for replacement colors
Claus Gittinger <cg@exept.de>
parents: 1237
diff changeset
   468
        ^ self noColor
1023
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
   469
    ].
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
   470
    id == 1 ifTrue:[
1238
b363894182d0 prepare for replacement colors
Claus Gittinger <cg@exept.de>
parents: 1237
diff changeset
   471
        Pseudo1 isNil ifTrue:[
b363894182d0 prepare for replacement colors
Claus Gittinger <cg@exept.de>
parents: 1237
diff changeset
   472
            Pseudo1 := self basicNew setColorId:1
b363894182d0 prepare for replacement colors
Claus Gittinger <cg@exept.de>
parents: 1237
diff changeset
   473
        ].
b363894182d0 prepare for replacement colors
Claus Gittinger <cg@exept.de>
parents: 1237
diff changeset
   474
        ^ Pseudo1
1023
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
   475
    ].
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
   476
    id == -1 ifTrue:[
1238
b363894182d0 prepare for replacement colors
Claus Gittinger <cg@exept.de>
parents: 1237
diff changeset
   477
        ^ self allColor
1023
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
   478
    ].
1365
37a9e7ac4dbc moved color registration from Color class to per-device lobby
Claus Gittinger <cg@exept.de>
parents: 1348
diff changeset
   479
1238
b363894182d0 prepare for replacement colors
Claus Gittinger <cg@exept.de>
parents: 1237
diff changeset
   480
    ^ self basicNew setColorId:id
b363894182d0 prepare for replacement colors
Claus Gittinger <cg@exept.de>
parents: 1237
diff changeset
   481
1365
37a9e7ac4dbc moved color registration from Color class to per-device lobby
Claus Gittinger <cg@exept.de>
parents: 1348
diff changeset
   482
    "Modified: 24.2.1997 / 18:16:30 / cg"
1023
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
   483
!
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
   484
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
   485
cyan:c magenta:m yellow:y
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
   486
    "return a color from cyan, magenta and yellow values.
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
   487
     all values are given in percent (0..100)"
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
   488
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
   489
    ^ self
1348
acb4e4874e4d care for ColorValue (ColorValue cyan)
ca
parents: 1347
diff changeset
   490
        redPercent:(100 - c)
acb4e4874e4d care for ColorValue (ColorValue cyan)
ca
parents: 1347
diff changeset
   491
        greenPercent:(100 - m)
acb4e4874e4d care for ColorValue (ColorValue cyan)
ca
parents: 1347
diff changeset
   492
        bluePercent:(100 - y)
1023
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
   493
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
   494
    "
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
   495
     Color cyan:100 magenta:0 yellow:0      - cyan    
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
   496
     Color cyan:100 magenta:100 yellow:0    - blue    
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
   497
     Color cyan:100 magenta:0 yellow:100    - green    
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
   498
     Color cyan:100 magenta:100 yellow:100  - black  
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
   499
    "
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
   500
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
   501
    "Modified: 11.6.1996 / 18:29:15 / cg"
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
   502
!
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
   503
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
   504
fromUser
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
   505
    "let user point on a screen pixel.
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
   506
     Return an instance for that pixels color"
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
   507
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
   508
    |p img|
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
   509
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
   510
    p := Screen current pointFromUser.
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
   511
    img := Image fromScreen:(p corner:p+1).
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
   512
    ^ img at:0@0
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
   513
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
   514
    "
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
   515
     Color fromUser
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
   516
    "
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
   517
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
   518
    "Modified: 31.8.1995 / 01:34:22 / claus"
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
   519
!
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
   520
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
   521
hue:h light:l saturation:s
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
   522
    "return a color from hue, light and saturation values.
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
   523
     Hue is in degrees (0..360); light and sturation are
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
   524
     in percent (0..100)"
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
   525
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
   526
    self withRGBFromHue:h light:l saturation:s do:[:r :g :b |
1348
acb4e4874e4d care for ColorValue (ColorValue cyan)
ca
parents: 1347
diff changeset
   527
        ^ self redPercent:r greenPercent:g bluePercent:b
1023
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
   528
    ]
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
   529
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
   530
    "
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
   531
     Color hue:0 light:50 saturation:100     - red
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
   532
     Color hue:60 light:50 saturation:100    - yellow
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
   533
     Color hue:120 light:50 saturation:100   - green
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
   534
     Color hue:120 light:75 saturation:100   - bright green
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
   535
     Color hue:120 light:25 saturation:100   - dark green
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
   536
     Color hue:120 light:50 saturation:50    - greyish dark green
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
   537
     Color hue:120 light:50 saturation:0     - b&w television dark green
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
   538
    "
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
   539
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
   540
    "Modified: 23.4.1996 / 13:22:22 / cg"
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
   541
!
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
   542
1233
c6796bddc7d1 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1229
diff changeset
   543
name:colorName
1023
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
   544
    "Return a named color (either exact or dithered).
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
   545
     Report an error, if aString is not a valid color name.
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
   546
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
   547
     We hereby only guarantee that the 8 basic colors are supported
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
   548
     on every device (X uses the Xcolor database, so it supports more
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
   549
     names - other devices use a builtIn name table containing only the
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
   550
     common names) - use with special names (such as 'mediumGoldenRod'
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
   551
     is not recommended). Better use: #name:ifIllegal: and provide a fallBack."
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
   552
1233
c6796bddc7d1 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1229
diff changeset
   553
    ^ self 
c6796bddc7d1 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1229
diff changeset
   554
        name:colorName 
1269
f0777b2cc08a use a signal for invalid color names
Claus Gittinger <cg@exept.de>
parents: 1239
diff changeset
   555
        ifIllegal:[InvalidColorNameSignal
f0777b2cc08a use a signal for invalid color names
Claus Gittinger <cg@exept.de>
parents: 1239
diff changeset
   556
                        raiseRequestWith:colorName
f0777b2cc08a use a signal for invalid color names
Claus Gittinger <cg@exept.de>
parents: 1239
diff changeset
   557
                        errorString:'invalid colorName: ']
1023
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
   558
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
   559
    "
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
   560
     Color name:'brown'
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
   561
     Color name:'foo'
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
   562
     Color name:'snow'
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
   563
    "
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
   564
1269
f0777b2cc08a use a signal for invalid color names
Claus Gittinger <cg@exept.de>
parents: 1239
diff changeset
   565
    "Modified: 24.1.1997 / 13:39:25 / cg"
1023
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
   566
!
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
   567
1233
c6796bddc7d1 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1229
diff changeset
   568
name:colorName ifIllegal:errorBlock
1023
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
   569
    "Return a named color (either exact or dithered).
1233
c6796bddc7d1 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1229
diff changeset
   570
     If aString is not a valid color name, 
c6796bddc7d1 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1229
diff changeset
   571
     return the result from evaluating errorBlock."
c6796bddc7d1 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1229
diff changeset
   572
c6796bddc7d1 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1229
diff changeset
   573
    |r g b|
c6796bddc7d1 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1229
diff changeset
   574
c6796bddc7d1 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1229
diff changeset
   575
    Display
c6796bddc7d1 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1229
diff changeset
   576
        getScaledRGBFromName:colorName 
c6796bddc7d1 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1229
diff changeset
   577
        into:[:rr :gg :bb |
c6796bddc7d1 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1229
diff changeset
   578
            r := rr.
c6796bddc7d1 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1229
diff changeset
   579
            g := gg.
c6796bddc7d1 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1229
diff changeset
   580
            b := bb
c6796bddc7d1 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1229
diff changeset
   581
        ].
c6796bddc7d1 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1229
diff changeset
   582
c6796bddc7d1 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1229
diff changeset
   583
    r notNil ifTrue:[
1348
acb4e4874e4d care for ColorValue (ColorValue cyan)
ca
parents: 1347
diff changeset
   584
        ^ here scaledRed:r scaledGreen:g scaledBlue:b
1233
c6796bddc7d1 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1229
diff changeset
   585
    ].
c6796bddc7d1 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1229
diff changeset
   586
    ^ errorBlock value
1023
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
   587
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
   588
    "
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
   589
     Color name:'brown' ifIllegal:[Color black]
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
   590
     Color name:'foo' ifIllegal:[Color black]
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
   591
    "
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
   592
1233
c6796bddc7d1 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1229
diff changeset
   593
    "Modified: 16.1.1997 / 22:59:24 / cg"
1023
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
   594
!
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
   595
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
   596
noColor
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
   597
    "return a special color which, when used for bit-blitting will
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
   598
     behave like a 0-color (i.e. have a device-pixel value of all-0s)"
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
   599
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
   600
     Pseudo0 isNil ifTrue:[
1238
b363894182d0 prepare for replacement colors
Claus Gittinger <cg@exept.de>
parents: 1237
diff changeset
   601
         Pseudo0 := self basicNew setColorId:0
1023
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
   602
     ].
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
   603
     ^ Pseudo0
1238
b363894182d0 prepare for replacement colors
Claus Gittinger <cg@exept.de>
parents: 1237
diff changeset
   604
b363894182d0 prepare for replacement colors
Claus Gittinger <cg@exept.de>
parents: 1237
diff changeset
   605
    "Modified: 17.1.1997 / 00:06:49 / cg"
1023
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
   606
!
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
   607
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
   608
red:r green:g blue:b
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
   609
    "return a color from red, green and blue values;
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
   610
     the arguments, r, g and b are interpreted as percent (0..100)"
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
   611
1348
acb4e4874e4d care for ColorValue (ColorValue cyan)
ca
parents: 1347
diff changeset
   612
    ^ here scaledRed:(r * MaxValue // 100)
acb4e4874e4d care for ColorValue (ColorValue cyan)
ca
parents: 1347
diff changeset
   613
           scaledGreen:(g * MaxValue // 100)
acb4e4874e4d care for ColorValue (ColorValue cyan)
ca
parents: 1347
diff changeset
   614
           scaledBlue:(b * MaxValue // 100)
1023
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
   615
!
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
   616
1237
15848ece8b95 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1235
diff changeset
   617
redByte:r greenByte:g blueByte:b
15848ece8b95 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1235
diff changeset
   618
    "return a color from red, green and blue values;
15848ece8b95 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1235
diff changeset
   619
     the arguments, r, g and b are interpreted as byte values (0..255)"
15848ece8b95 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1235
diff changeset
   620
1348
acb4e4874e4d care for ColorValue (ColorValue cyan)
ca
parents: 1347
diff changeset
   621
    ^ here scaledRed:(r * MaxValue // 255)
1237
15848ece8b95 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1235
diff changeset
   622
           scaledGreen:(g * MaxValue // 255)
15848ece8b95 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1235
diff changeset
   623
           scaledBlue:(b * MaxValue // 255)
15848ece8b95 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1235
diff changeset
   624
15848ece8b95 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1235
diff changeset
   625
    "
15848ece8b95 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1235
diff changeset
   626
     (Color redByte:255 greenByte:0 blueByte:0) inspect
15848ece8b95 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1235
diff changeset
   627
     (Color redByte:255 greenByte:255 blueByte:255) inspect
15848ece8b95 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1235
diff changeset
   628
     (Color redByte:0 greenByte:0 blueByte:0) inspect
15848ece8b95 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1235
diff changeset
   629
    "
15848ece8b95 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1235
diff changeset
   630
15848ece8b95 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1235
diff changeset
   631
    "Modified: 16.1.1997 / 23:32:43 / cg"
15848ece8b95 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1235
diff changeset
   632
!
15848ece8b95 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1235
diff changeset
   633
1348
acb4e4874e4d care for ColorValue (ColorValue cyan)
ca
parents: 1347
diff changeset
   634
redPercent:r greenPercent:g bluePercent:b
acb4e4874e4d care for ColorValue (ColorValue cyan)
ca
parents: 1347
diff changeset
   635
    "return a color from red, green and blue values;
acb4e4874e4d care for ColorValue (ColorValue cyan)
ca
parents: 1347
diff changeset
   636
     the arguments, r, g and b are interpreted as percent (0..100)"
acb4e4874e4d care for ColorValue (ColorValue cyan)
ca
parents: 1347
diff changeset
   637
acb4e4874e4d care for ColorValue (ColorValue cyan)
ca
parents: 1347
diff changeset
   638
    ^ here scaledRed:(r * MaxValue // 100)
acb4e4874e4d care for ColorValue (ColorValue cyan)
ca
parents: 1347
diff changeset
   639
           scaledGreen:(g * MaxValue // 100)
acb4e4874e4d care for ColorValue (ColorValue cyan)
ca
parents: 1347
diff changeset
   640
           scaledBlue:(b * MaxValue // 100)
acb4e4874e4d care for ColorValue (ColorValue cyan)
ca
parents: 1347
diff changeset
   641
!
acb4e4874e4d care for ColorValue (ColorValue cyan)
ca
parents: 1347
diff changeset
   642
1023
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
   643
scaledGray:aGrayValue
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
   644
    "return a gray color with a scaled gray value (0..MaxValue)"
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
   645
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
   646
    ^ self scaledRed:aGrayValue scaledGreen:aGrayValue scaledBlue:aGrayValue
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
   647
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
   648
    "Modified: 11.6.1996 / 16:31:42 / cg"
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
   649
!
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
   650
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
   651
scaledRed:r scaledGreen:g scaledBlue:b
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
   652
    "return a color from red, green and blue values;
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
   653
     the arguments, r, g and b are interpreted as (0..MaxValue)"
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
   654
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
   655
    |newColor|
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
   656
1365
37a9e7ac4dbc moved color registration from Color class to per-device lobby
Claus Gittinger <cg@exept.de>
parents: 1348
diff changeset
   657
"/    "look if already known"
37a9e7ac4dbc moved color registration from Color class to per-device lobby
Claus Gittinger <cg@exept.de>
parents: 1348
diff changeset
   658
"/
37a9e7ac4dbc moved color registration from Color class to per-device lobby
Claus Gittinger <cg@exept.de>
parents: 1348
diff changeset
   659
"/    aDevice deviceColors do:[:aColor |
37a9e7ac4dbc moved color registration from Color class to per-device lobby
Claus Gittinger <cg@exept.de>
parents: 1348
diff changeset
   660
"/        (r == aColor scaledRed) ifTrue:[
37a9e7ac4dbc moved color registration from Color class to per-device lobby
Claus Gittinger <cg@exept.de>
parents: 1348
diff changeset
   661
"/            (g == aColor scaledGreen) ifTrue:[
37a9e7ac4dbc moved color registration from Color class to per-device lobby
Claus Gittinger <cg@exept.de>
parents: 1348
diff changeset
   662
"/                (b == aColor scaledBlue) ifTrue:[
37a9e7ac4dbc moved color registration from Color class to per-device lobby
Claus Gittinger <cg@exept.de>
parents: 1348
diff changeset
   663
"/                    ^ aColor
37a9e7ac4dbc moved color registration from Color class to per-device lobby
Claus Gittinger <cg@exept.de>
parents: 1348
diff changeset
   664
"/                ]
37a9e7ac4dbc moved color registration from Color class to per-device lobby
Claus Gittinger <cg@exept.de>
parents: 1348
diff changeset
   665
"/            ]
37a9e7ac4dbc moved color registration from Color class to per-device lobby
Claus Gittinger <cg@exept.de>
parents: 1348
diff changeset
   666
"/        ]
37a9e7ac4dbc moved color registration from Color class to per-device lobby
Claus Gittinger <cg@exept.de>
parents: 1348
diff changeset
   667
"/    ].
1023
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
   668
    newColor := self basicNew setScaledRed:r scaledGreen:g scaledBlue:b device:nil.
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
   669
    ^ newColor
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
   670
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
   671
    "
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
   672
     (Color red:100 green:0 blue:0) inspect
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
   673
     (Color red:100 green:50 blue:50) inspect
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
   674
     (Color red:50 green:0 blue:0) inspect
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
   675
    "
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
   676
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
   677
    "Modified: 2.5.1996 / 13:40:51 / stefan"
1365
37a9e7ac4dbc moved color registration from Color class to per-device lobby
Claus Gittinger <cg@exept.de>
parents: 1348
diff changeset
   678
    "Modified: 24.2.1997 / 18:18:47 / cg"
1023
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
   679
!
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
   680
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
   681
variableColorOn:aDevice
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
   682
    "return a variable color (i.e. allocate a writable colorcell) on
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
   683
     aDevice. The returned color is not shared and its rgb components
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
   684
     are initially undefined. The components can be set to any value
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
   685
     using Color>>red:green:blue. Care should be taken, since this call
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
   686
     fails on static color or b&w displays (i.e. it depends on the device
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
   687
     being a pseudocolor device using colormaps).
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
   688
     Returns nil, if no more colorCells are available, or the display
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
   689
     uses a fix colormap (i.e. is a directColor or staticColor pr b&w device).
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
   690
     Because of this, you should not write your application to depend on
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
   691
     writable colors to be available (i.e. add fallBack code to redraw
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
   692
     things in another color)"
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
   693
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
   694
    |c lutIndex|
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
   695
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
   696
    lutIndex := aDevice colorCell.
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
   697
    lutIndex isNil ifTrue:[^ nil].
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
   698
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
   699
    c := self new.
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
   700
    c setDevice:aDevice colorId:lutIndex.
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
   701
    c setWritable:true.
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
   702
    Cells isNil ifTrue:[
1348
acb4e4874e4d care for ColorValue (ColorValue cyan)
ca
parents: 1347
diff changeset
   703
        Cells := Registry new.
1023
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
   704
    ].
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
   705
    Cells register:c.
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
   706
    ^ c
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
   707
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
   708
    "
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
   709
     |l cell|
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
   710
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
   711
     l := Label new.
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
   712
     l label:('hello' asText allBold).
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
   713
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
   714
     cell := Color variableColorOn:(Screen current).
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
   715
     l foregroundColor:cell.
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
   716
     [
1348
acb4e4874e4d care for ColorValue (ColorValue cyan)
ca
parents: 1347
diff changeset
   717
        1 to:40 do:[:i|
acb4e4874e4d care for ColorValue (ColorValue cyan)
ca
parents: 1347
diff changeset
   718
            i odd ifTrue:[
acb4e4874e4d care for ColorValue (ColorValue cyan)
ca
parents: 1347
diff changeset
   719
                cell red:100 green:0 blue:0
acb4e4874e4d care for ColorValue (ColorValue cyan)
ca
parents: 1347
diff changeset
   720
            ] ifFalse:[
acb4e4874e4d care for ColorValue (ColorValue cyan)
ca
parents: 1347
diff changeset
   721
                cell red:0 green:0 blue:0
acb4e4874e4d care for ColorValue (ColorValue cyan)
ca
parents: 1347
diff changeset
   722
            ].
acb4e4874e4d care for ColorValue (ColorValue cyan)
ca
parents: 1347
diff changeset
   723
            Display flush.
acb4e4874e4d care for ColorValue (ColorValue cyan)
ca
parents: 1347
diff changeset
   724
            (Delay forSeconds:0.4) wait
acb4e4874e4d care for ColorValue (ColorValue cyan)
ca
parents: 1347
diff changeset
   725
        ].
acb4e4874e4d care for ColorValue (ColorValue cyan)
ca
parents: 1347
diff changeset
   726
        l destroy.
1023
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
   727
     ] fork.
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
   728
     l open
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
   729
    "
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
   730
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
   731
    "Modified: 13.5.1996 / 12:41:53 / cg"
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
   732
! !
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
   733
1144
07f3de59864d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1023
diff changeset
   734
!Color class methodsFor:'Signal constants'!
1023
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
   735
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
   736
colorAllocationFailSignal
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
   737
    "return the signal raised when a color allocation failed."
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
   738
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
   739
    ^ ColorAllocationFailSignal
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
   740
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
   741
    "Created: 12.6.1996 / 17:44:49 / cg"
1269
f0777b2cc08a use a signal for invalid color names
Claus Gittinger <cg@exept.de>
parents: 1239
diff changeset
   742
!
f0777b2cc08a use a signal for invalid color names
Claus Gittinger <cg@exept.de>
parents: 1239
diff changeset
   743
f0777b2cc08a use a signal for invalid color names
Claus Gittinger <cg@exept.de>
parents: 1239
diff changeset
   744
invalidColorNameSignal
f0777b2cc08a use a signal for invalid color names
Claus Gittinger <cg@exept.de>
parents: 1239
diff changeset
   745
    "return the signal raised when an invalid color name is encountered"
f0777b2cc08a use a signal for invalid color names
Claus Gittinger <cg@exept.de>
parents: 1239
diff changeset
   746
f0777b2cc08a use a signal for invalid color names
Claus Gittinger <cg@exept.de>
parents: 1239
diff changeset
   747
    ^ InvalidColorNameSignal
f0777b2cc08a use a signal for invalid color names
Claus Gittinger <cg@exept.de>
parents: 1239
diff changeset
   748
f0777b2cc08a use a signal for invalid color names
Claus Gittinger <cg@exept.de>
parents: 1239
diff changeset
   749
    "Created: 24.1.1997 / 13:36:25 / cg"
1023
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
   750
! !
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
   751
1144
07f3de59864d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1023
diff changeset
   752
!Color class methodsFor:'accessing'!
1023
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
   753
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
   754
allocatedColorsOn:aDevice
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
   755
    "return a collection of colors available on aDevice"
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
   756
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
   757
    |colors|
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
   758
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
   759
    colors := OrderedCollection new.
1365
37a9e7ac4dbc moved color registration from Color class to per-device lobby
Claus Gittinger <cg@exept.de>
parents: 1348
diff changeset
   760
    aDevice deviceColors do:[:clr |
37a9e7ac4dbc moved color registration from Color class to per-device lobby
Claus Gittinger <cg@exept.de>
parents: 1348
diff changeset
   761
        clr colorId notNil ifTrue:[
1348
acb4e4874e4d care for ColorValue (ColorValue cyan)
ca
parents: 1347
diff changeset
   762
            colors add:clr
1365
37a9e7ac4dbc moved color registration from Color class to per-device lobby
Claus Gittinger <cg@exept.de>
parents: 1348
diff changeset
   763
        ] ifFalse:[
37a9e7ac4dbc moved color registration from Color class to per-device lobby
Claus Gittinger <cg@exept.de>
parents: 1348
diff changeset
   764
            'color - oops' printCR.
1348
acb4e4874e4d care for ColorValue (ColorValue cyan)
ca
parents: 1347
diff changeset
   765
        ]
1023
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
   766
    ].
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
   767
    ^ colors asArray
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
   768
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
   769
    "
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
   770
     Color allocatedColorsOn:Display
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
   771
    "
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
   772
1365
37a9e7ac4dbc moved color registration from Color class to per-device lobby
Claus Gittinger <cg@exept.de>
parents: 1348
diff changeset
   773
    "Modified: 24.2.1997 / 18:16:14 / cg"
1023
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
   774
! !
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
   775
1224
2a2270ec4236 added #releaseResourcesOnDevice:, to allow cleanup when
Claus Gittinger <cg@exept.de>
parents: 1205
diff changeset
   776
!Color class methodsFor:'cleanup'!
2a2270ec4236 added #releaseResourcesOnDevice:, to allow cleanup when
Claus Gittinger <cg@exept.de>
parents: 1205
diff changeset
   777
2a2270ec4236 added #releaseResourcesOnDevice:, to allow cleanup when
Claus Gittinger <cg@exept.de>
parents: 1205
diff changeset
   778
releaseResourcesOnDevice:aDevice
2a2270ec4236 added #releaseResourcesOnDevice:, to allow cleanup when
Claus Gittinger <cg@exept.de>
parents: 1205
diff changeset
   779
    "this is sent when a display connection is closed,
2a2270ec4236 added #releaseResourcesOnDevice:, to allow cleanup when
Claus Gittinger <cg@exept.de>
parents: 1205
diff changeset
   780
     to release all cached Colors from that device"
2a2270ec4236 added #releaseResourcesOnDevice:, to allow cleanup when
Claus Gittinger <cg@exept.de>
parents: 1205
diff changeset
   781
1365
37a9e7ac4dbc moved color registration from Color class to per-device lobby
Claus Gittinger <cg@exept.de>
parents: 1348
diff changeset
   782
    aDevice releaseDeviceColors
37a9e7ac4dbc moved color registration from Color class to per-device lobby
Claus Gittinger <cg@exept.de>
parents: 1348
diff changeset
   783
    "/ Lobby unregisterAllForWhich:[:aColor | aColor graphicsDevice == aDevice]
37a9e7ac4dbc moved color registration from Color class to per-device lobby
Claus Gittinger <cg@exept.de>
parents: 1348
diff changeset
   784
1224
2a2270ec4236 added #releaseResourcesOnDevice:, to allow cleanup when
Claus Gittinger <cg@exept.de>
parents: 1205
diff changeset
   785
    "Created: 16.1.1997 / 16:44:20 / cg"
1365
37a9e7ac4dbc moved color registration from Color class to per-device lobby
Claus Gittinger <cg@exept.de>
parents: 1348
diff changeset
   786
    "Modified: 24.2.1997 / 18:18:22 / cg"
1224
2a2270ec4236 added #releaseResourcesOnDevice:, to allow cleanup when
Claus Gittinger <cg@exept.de>
parents: 1205
diff changeset
   787
! !
2a2270ec4236 added #releaseResourcesOnDevice:, to allow cleanup when
Claus Gittinger <cg@exept.de>
parents: 1205
diff changeset
   788
1144
07f3de59864d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1023
diff changeset
   789
!Color class methodsFor:'color space conversions'!
1023
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
   790
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
   791
withHLSFromRed:r green:g blue:b do:aBlock
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
   792
    "compute hls form rgb, evaluate aBlock with h,l and s as arguments"
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
   793
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
   794
    |max min r1 g1 b1 delta h l s|
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
   795
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
   796
    "compute hls; h in 0..360; l 0..100; s 0..100"
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
   797
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
   798
    r1 := r / 100.   "scale to  0..1"
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
   799
    g1 := g / 100.
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
   800
    b1 := b / 100.
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
   801
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
   802
    max := (r1 max:g1) max:b1.
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
   803
    min := (r1 min:g1) min:b1.
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
   804
    l := (max + min) / 2.
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
   805
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
   806
    max = min ifTrue:[
1348
acb4e4874e4d care for ColorValue (ColorValue cyan)
ca
parents: 1347
diff changeset
   807
        "achromatic, r=g=b"
acb4e4874e4d care for ColorValue (ColorValue cyan)
ca
parents: 1347
diff changeset
   808
acb4e4874e4d care for ColorValue (ColorValue cyan)
ca
parents: 1347
diff changeset
   809
        s := 0.
acb4e4874e4d care for ColorValue (ColorValue cyan)
ca
parents: 1347
diff changeset
   810
        h := nil
1023
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
   811
    ] ifFalse:[
1348
acb4e4874e4d care for ColorValue (ColorValue cyan)
ca
parents: 1347
diff changeset
   812
        l < 0.5 ifTrue:[
acb4e4874e4d care for ColorValue (ColorValue cyan)
ca
parents: 1347
diff changeset
   813
            s := (max - min) / (max + min)
acb4e4874e4d care for ColorValue (ColorValue cyan)
ca
parents: 1347
diff changeset
   814
        ] ifFalse:[
acb4e4874e4d care for ColorValue (ColorValue cyan)
ca
parents: 1347
diff changeset
   815
            s := (max - min) / (2 - max - min)
acb4e4874e4d care for ColorValue (ColorValue cyan)
ca
parents: 1347
diff changeset
   816
        ].
acb4e4874e4d care for ColorValue (ColorValue cyan)
ca
parents: 1347
diff changeset
   817
acb4e4874e4d care for ColorValue (ColorValue cyan)
ca
parents: 1347
diff changeset
   818
        "calc hue"
acb4e4874e4d care for ColorValue (ColorValue cyan)
ca
parents: 1347
diff changeset
   819
acb4e4874e4d care for ColorValue (ColorValue cyan)
ca
parents: 1347
diff changeset
   820
        delta := max - min.
acb4e4874e4d care for ColorValue (ColorValue cyan)
ca
parents: 1347
diff changeset
   821
        r1 = max ifTrue:[
acb4e4874e4d care for ColorValue (ColorValue cyan)
ca
parents: 1347
diff changeset
   822
            h := (g1 - b1) / delta
acb4e4874e4d care for ColorValue (ColorValue cyan)
ca
parents: 1347
diff changeset
   823
        ] ifFalse:[
acb4e4874e4d care for ColorValue (ColorValue cyan)
ca
parents: 1347
diff changeset
   824
            g1 = max ifTrue:[
acb4e4874e4d care for ColorValue (ColorValue cyan)
ca
parents: 1347
diff changeset
   825
                h := 2 + ((b1 - r1) / delta)
acb4e4874e4d care for ColorValue (ColorValue cyan)
ca
parents: 1347
diff changeset
   826
            ] ifFalse:[
acb4e4874e4d care for ColorValue (ColorValue cyan)
ca
parents: 1347
diff changeset
   827
                h := 4 + ((r1 - g1) / delta)
acb4e4874e4d care for ColorValue (ColorValue cyan)
ca
parents: 1347
diff changeset
   828
            ]
acb4e4874e4d care for ColorValue (ColorValue cyan)
ca
parents: 1347
diff changeset
   829
        ].
acb4e4874e4d care for ColorValue (ColorValue cyan)
ca
parents: 1347
diff changeset
   830
        h := h * 60.
acb4e4874e4d care for ColorValue (ColorValue cyan)
ca
parents: 1347
diff changeset
   831
        h < 0 ifTrue:[
acb4e4874e4d care for ColorValue (ColorValue cyan)
ca
parents: 1347
diff changeset
   832
            h := h + 360
acb4e4874e4d care for ColorValue (ColorValue cyan)
ca
parents: 1347
diff changeset
   833
        ].
1023
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
   834
    ].
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
   835
    aBlock value:h value:(l * 100) value:(s * 100)
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
   836
!
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
   837
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
   838
withHLSFromScaledRed:r scaledGreen:g scaledBlue:b do:aBlock
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
   839
    "compute hls form rgb, evaluate aBlock with h,l and s as arguments"
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
   840
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
   841
    ^ self withHLSFromRed:(r * 100.0 / MaxValue)
1348
acb4e4874e4d care for ColorValue (ColorValue cyan)
ca
parents: 1347
diff changeset
   842
                    green:(g * 100.0 / MaxValue) 
acb4e4874e4d care for ColorValue (ColorValue cyan)
ca
parents: 1347
diff changeset
   843
                     blue:(b * 100.0 / MaxValue)
acb4e4874e4d care for ColorValue (ColorValue cyan)
ca
parents: 1347
diff changeset
   844
                       do:aBlock
1023
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
   845
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
   846
    "Created: 11.6.1996 / 17:23:47 / cg"
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
   847
!
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
   848
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
   849
withRGBFromHue:h light:l saturation:s do:aBlock
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
   850
    "compute rgb form hls, evaluate aBlock with r,g and b as arguments"
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
   851
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
   852
    |valueFunc s1 l1 r g b m1 m2|
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
   853
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
   854
    valueFunc := [:n1 :n2 :hIn |
1348
acb4e4874e4d care for ColorValue (ColorValue cyan)
ca
parents: 1347
diff changeset
   855
        |hue|
acb4e4874e4d care for ColorValue (ColorValue cyan)
ca
parents: 1347
diff changeset
   856
acb4e4874e4d care for ColorValue (ColorValue cyan)
ca
parents: 1347
diff changeset
   857
        hue := hIn.
acb4e4874e4d care for ColorValue (ColorValue cyan)
ca
parents: 1347
diff changeset
   858
        hue > 360 ifTrue:[
acb4e4874e4d care for ColorValue (ColorValue cyan)
ca
parents: 1347
diff changeset
   859
            hue := hue - 360
acb4e4874e4d care for ColorValue (ColorValue cyan)
ca
parents: 1347
diff changeset
   860
        ] ifFalse:[
acb4e4874e4d care for ColorValue (ColorValue cyan)
ca
parents: 1347
diff changeset
   861
            hue < 0 ifTrue:[
acb4e4874e4d care for ColorValue (ColorValue cyan)
ca
parents: 1347
diff changeset
   862
                hue := hue + 360
acb4e4874e4d care for ColorValue (ColorValue cyan)
ca
parents: 1347
diff changeset
   863
            ].
acb4e4874e4d care for ColorValue (ColorValue cyan)
ca
parents: 1347
diff changeset
   864
        ].
acb4e4874e4d care for ColorValue (ColorValue cyan)
ca
parents: 1347
diff changeset
   865
        hue < 60 ifTrue:[
acb4e4874e4d care for ColorValue (ColorValue cyan)
ca
parents: 1347
diff changeset
   866
            n1 + ((n2 - n1) * hue / 60)
acb4e4874e4d care for ColorValue (ColorValue cyan)
ca
parents: 1347
diff changeset
   867
        ] ifFalse:[
acb4e4874e4d care for ColorValue (ColorValue cyan)
ca
parents: 1347
diff changeset
   868
            hue < 180 ifTrue:[
acb4e4874e4d care for ColorValue (ColorValue cyan)
ca
parents: 1347
diff changeset
   869
                n2
acb4e4874e4d care for ColorValue (ColorValue cyan)
ca
parents: 1347
diff changeset
   870
            ] ifFalse:[
acb4e4874e4d care for ColorValue (ColorValue cyan)
ca
parents: 1347
diff changeset
   871
                hue < 240 ifTrue:[
acb4e4874e4d care for ColorValue (ColorValue cyan)
ca
parents: 1347
diff changeset
   872
                    n1 + ((n2 - n1) * (240 - hue) / 60)
acb4e4874e4d care for ColorValue (ColorValue cyan)
ca
parents: 1347
diff changeset
   873
                ] ifFalse:[
acb4e4874e4d care for ColorValue (ColorValue cyan)
ca
parents: 1347
diff changeset
   874
                    n1
acb4e4874e4d care for ColorValue (ColorValue cyan)
ca
parents: 1347
diff changeset
   875
                ]
acb4e4874e4d care for ColorValue (ColorValue cyan)
ca
parents: 1347
diff changeset
   876
            ]
acb4e4874e4d care for ColorValue (ColorValue cyan)
ca
parents: 1347
diff changeset
   877
        ]
1023
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
   878
    ].
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
   879
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
   880
    "compute hls; h in 0..360; l 0..100; s 0..100"
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
   881
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
   882
    s1 := s / 100.0.   "scale to  0..1"
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
   883
    l1 := l / 100.0.
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
   884
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
   885
    l1 <= 0.5 ifTrue:[
1348
acb4e4874e4d care for ColorValue (ColorValue cyan)
ca
parents: 1347
diff changeset
   886
        m2 := l1 * (1 + s1)
1023
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
   887
    ] ifFalse:[
1348
acb4e4874e4d care for ColorValue (ColorValue cyan)
ca
parents: 1347
diff changeset
   888
        m2 := l1 + s1 - (l1 * s1)
1023
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
   889
    ].
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
   890
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
   891
    m1 := 2 * l1 - m2.
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
   892
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
   893
    s1 = 0 ifTrue:[
1348
acb4e4874e4d care for ColorValue (ColorValue cyan)
ca
parents: 1347
diff changeset
   894
        "achromatic, ignore hue"
acb4e4874e4d care for ColorValue (ColorValue cyan)
ca
parents: 1347
diff changeset
   895
        r := g := b := l1
1023
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
   896
    ] ifFalse:[
1348
acb4e4874e4d care for ColorValue (ColorValue cyan)
ca
parents: 1347
diff changeset
   897
        r := valueFunc value:m1 value:m2 value:h + 120.
acb4e4874e4d care for ColorValue (ColorValue cyan)
ca
parents: 1347
diff changeset
   898
        g := valueFunc value:m1 value:m2 value:h.
acb4e4874e4d care for ColorValue (ColorValue cyan)
ca
parents: 1347
diff changeset
   899
        b := valueFunc value:m1 value:m2 value:h - 120.
1023
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
   900
    ].
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
   901
    aBlock value:r*100 value:g*100 value:b*100
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
   902
! !
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
   903
1144
07f3de59864d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1023
diff changeset
   904
!Color class methodsFor:'constant colors'!
1023
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
   905
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
   906
black
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
   907
    "return the black color"
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
   908
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
   909
    Black isNil ifTrue:[
1348
acb4e4874e4d care for ColorValue (ColorValue cyan)
ca
parents: 1347
diff changeset
   910
        Black := (self red:0 green:0 blue:0) exactOn:Display
1023
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
   911
    ].
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
   912
    ^ Black
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
   913
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
   914
    "
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
   915
     Color black inspect
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
   916
    "
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
   917
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
   918
    "Modified: 11.6.1996 / 15:55:31 / cg"
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
   919
!
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
   920
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
   921
blue
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
   922
    "return the blue color"
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
   923
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
   924
    Blue isNil ifTrue:[
1348
acb4e4874e4d care for ColorValue (ColorValue cyan)
ca
parents: 1347
diff changeset
   925
        Blue := self redPercent:0 greenPercent:0 bluePercent:100
1023
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
   926
    ].
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
   927
    ^ Blue
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
   928
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
   929
    "
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
   930
     Color blue inspect
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
   931
    "
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
   932
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
   933
    "Modified: 23.4.1996 / 13:15:51 / cg"
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
   934
!
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
   935
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
   936
cyan
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
   937
    "return the cyan color - ST-80 compatibility"
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
   938
1348
acb4e4874e4d care for ColorValue (ColorValue cyan)
ca
parents: 1347
diff changeset
   939
    ^ self redPercent:0 greenPercent:100 bluePercent:100
1023
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
   940
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
   941
    "
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
   942
     Color cyan inspect
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
   943
    "
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
   944
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
   945
    "Modified: 23.4.1996 / 13:16:07 / cg"
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
   946
!
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
   947
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
   948
darkGray
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
   949
    "return the dark grey color (English version ;-)"
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
   950
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
   951
    DarkGrey isNil ifTrue:[
1368
cb5fbbcf568f checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1365
diff changeset
   952
        DarkGrey := self grayPercent:33
1023
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
   953
    ].
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
   954
    ^ DarkGrey
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
   955
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
   956
    "
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
   957
     Color darkGray inspect
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
   958
    "
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
   959
1368
cb5fbbcf568f checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1365
diff changeset
   960
    "Modified: 24.2.1997 / 21:33:11 / cg"
1023
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
   961
!
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
   962
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
   963
darkGrey
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
   964
    "return the darkGrey color (US version ;-)"
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
   965
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
   966
    ^ self darkGray
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
   967
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
   968
    "
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
   969
     Color darkGrey inspect
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
   970
    "
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
   971
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
   972
    "Modified: 28.5.1996 / 20:47:14 / cg"
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
   973
!
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
   974
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
   975
gray
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
   976
    "return a medium grey color (US version ;-)"
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
   977
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
   978
    Grey isNil ifTrue:[
1368
cb5fbbcf568f checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1365
diff changeset
   979
        Grey := self grayPercent:50
1023
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
   980
    ].
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
   981
    ^ Grey
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
   982
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
   983
    "
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
   984
     Color gray inspect
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
   985
    "
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
   986
1368
cb5fbbcf568f checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1365
diff changeset
   987
    "Modified: 24.2.1997 / 21:33:19 / cg"
1023
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
   988
!
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
   989
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
   990
gray:gray
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
   991
    "return a gray color (US version). 
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
   992
     The argument, gray is interpreted as percent (0..100)."
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
   993
1348
acb4e4874e4d care for ColorValue (ColorValue cyan)
ca
parents: 1347
diff changeset
   994
    ^ self redPercent:gray greenPercent:gray bluePercent:gray
acb4e4874e4d care for ColorValue (ColorValue cyan)
ca
parents: 1347
diff changeset
   995
acb4e4874e4d care for ColorValue (ColorValue cyan)
ca
parents: 1347
diff changeset
   996
    "
acb4e4874e4d care for ColorValue (ColorValue cyan)
ca
parents: 1347
diff changeset
   997
     Color gray:25
acb4e4874e4d care for ColorValue (ColorValue cyan)
ca
parents: 1347
diff changeset
   998
    "
acb4e4874e4d care for ColorValue (ColorValue cyan)
ca
parents: 1347
diff changeset
   999
acb4e4874e4d care for ColorValue (ColorValue cyan)
ca
parents: 1347
diff changeset
  1000
    "Modified: 28.5.1996 / 20:49:51 / cg"
acb4e4874e4d care for ColorValue (ColorValue cyan)
ca
parents: 1347
diff changeset
  1001
!
acb4e4874e4d care for ColorValue (ColorValue cyan)
ca
parents: 1347
diff changeset
  1002
acb4e4874e4d care for ColorValue (ColorValue cyan)
ca
parents: 1347
diff changeset
  1003
grayPercent:gray
acb4e4874e4d care for ColorValue (ColorValue cyan)
ca
parents: 1347
diff changeset
  1004
    "return a gray color (US version). 
acb4e4874e4d care for ColorValue (ColorValue cyan)
ca
parents: 1347
diff changeset
  1005
     The argument, gray is interpreted as percent (0..100)."
acb4e4874e4d care for ColorValue (ColorValue cyan)
ca
parents: 1347
diff changeset
  1006
acb4e4874e4d care for ColorValue (ColorValue cyan)
ca
parents: 1347
diff changeset
  1007
    ^ self redPercent:gray greenPercent:gray bluePercent:gray
1023
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
  1008
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
  1009
    "
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
  1010
     Color gray:25
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
  1011
    "
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
  1012
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
  1013
    "Modified: 28.5.1996 / 20:49:51 / cg"
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
  1014
!
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
  1015
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
  1016
green
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
  1017
    "return green"
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
  1018
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
  1019
    Green isNil ifTrue:[
1348
acb4e4874e4d care for ColorValue (ColorValue cyan)
ca
parents: 1347
diff changeset
  1020
        Green := self redPercent:0 greenPercent:100 bluePercent:0
1023
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
  1021
    ].
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
  1022
    ^ Green
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
  1023
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
  1024
    "
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
  1025
     Color green inspect
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
  1026
    "
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
  1027
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
  1028
    "Modified: 23.4.1996 / 13:23:08 / cg"
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
  1029
!
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
  1030
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
  1031
grey
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
  1032
    "return the grey color (English version ;-)"
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
  1033
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
  1034
    ^ self gray
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
  1035
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
  1036
    "
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
  1037
     Color grey inspect
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
  1038
    "
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
  1039
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
  1040
    "Modified: 28.5.1996 / 20:48:26 / cg"
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
  1041
!
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
  1042
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
  1043
grey:grey
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
  1044
    "return a grey color (English version). 
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
  1045
     The argument, grey is interpreted as percent (0..100)."
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
  1046
1368
cb5fbbcf568f checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1365
diff changeset
  1047
    ^ self grayPercent:grey
1023
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
  1048
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
  1049
    "
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
  1050
     Color grey:25
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
  1051
     Color grey:12.5
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
  1052
    "
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
  1053
1368
cb5fbbcf568f checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1365
diff changeset
  1054
    "Modified: 24.2.1997 / 21:33:28 / cg"
1023
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
  1055
!
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
  1056
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
  1057
lightGray
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
  1058
    "return the lightGrey color (US version ;-)"
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
  1059
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
  1060
    LightGrey isNil ifTrue:[
1368
cb5fbbcf568f checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1365
diff changeset
  1061
        LightGrey := self grayPercent:67
1023
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
  1062
    ].
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
  1063
    ^ LightGrey
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
  1064
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
  1065
    "
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
  1066
     Color lightGray inspect
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
  1067
    "
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
  1068
1368
cb5fbbcf568f checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1365
diff changeset
  1069
    "Modified: 24.2.1997 / 21:33:41 / cg"
1023
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
  1070
!
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
  1071
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
  1072
lightGrey
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
  1073
    "return the lightGrey color (English version ;-)"
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
  1074
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
  1075
    ^ self lightGray
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
  1076
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
  1077
    "
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
  1078
     Color lightGrey inspect
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
  1079
    "
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
  1080
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
  1081
    "Modified: 28.5.1996 / 20:51:11 / cg"
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
  1082
!
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
  1083
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
  1084
magenta
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
  1085
    "return the magenta color - ST-80 compatibility"
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
  1086
1348
acb4e4874e4d care for ColorValue (ColorValue cyan)
ca
parents: 1347
diff changeset
  1087
    ^ self redPercent:100 greenPercent:0 bluePercent:100
1023
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
  1088
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
  1089
    "
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
  1090
     Color magenta inspect
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
  1091
    "
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
  1092
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
  1093
    "Modified: 23.4.1996 / 13:23:41 / cg"
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
  1094
!
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
  1095
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
  1096
mediumGray
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
  1097
    "return medium-grey color (US version ;-)"
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
  1098
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
  1099
    ^ self gray
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
  1100
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
  1101
    "
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
  1102
     Color mediumGray inspect
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
  1103
    "
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
  1104
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
  1105
    "Created: 23.4.1996 / 13:24:17 / cg"
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
  1106
    "Modified: 28.5.1996 / 20:51:21 / cg"
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
  1107
!
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
  1108
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
  1109
mediumGrey
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
  1110
    "return medium-grey color (English version ;-)"
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
  1111
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
  1112
    ^ self gray
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
  1113
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
  1114
    "
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
  1115
     Color mediumGrey inspect
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
  1116
    "
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
  1117
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
  1118
    "Modified: 28.5.1996 / 20:51:24 / cg"
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
  1119
!
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
  1120
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
  1121
orange
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
  1122
    "return the orange color - ST-80 compatibility"
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
  1123
1348
acb4e4874e4d care for ColorValue (ColorValue cyan)
ca
parents: 1347
diff changeset
  1124
     ^ self redPercent:75 greenPercent:50 bluePercent:0
1023
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
  1125
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
  1126
    "Modified: 23.4.1996 / 13:29:32 / cg"
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
  1127
!
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
  1128
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
  1129
pink 
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
  1130
    "return the pink color - ST-80 compatibility"
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
  1131
1348
acb4e4874e4d care for ColorValue (ColorValue cyan)
ca
parents: 1347
diff changeset
  1132
     ^ self redPercent:100 greenPercent:0 bluePercent:100
1023
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
  1133
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
  1134
    "Modified: 23.4.1996 / 13:29:38 / cg"
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
  1135
!
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
  1136
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
  1137
red
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
  1138
    "return the red color"
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
  1139
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
  1140
    Red isNil ifTrue:[
1348
acb4e4874e4d care for ColorValue (ColorValue cyan)
ca
parents: 1347
diff changeset
  1141
        Red := self redPercent:100 greenPercent:0 bluePercent:0.
1023
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
  1142
    ].
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
  1143
    ^ Red
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
  1144
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
  1145
    "Modified: 23.4.1996 / 13:29:44 / cg"
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
  1146
!
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
  1147
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
  1148
veryDarkGray
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
  1149
    "return a very dark-grey color (US version ;-)"
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
  1150
1368
cb5fbbcf568f checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1365
diff changeset
  1151
    ^ self grayPercent:13
1023
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
  1152
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
  1153
    "Created: 23.4.1996 / 13:33:14 / cg"
1368
cb5fbbcf568f checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1365
diff changeset
  1154
    "Modified: 24.2.1997 / 21:33:52 / cg"
1023
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
  1155
!
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
  1156
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
  1157
veryDarkGrey
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
  1158
    "return a very dark-grey color (English version ;-)"
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
  1159
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
  1160
    ^ self veryDarkGray
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
  1161
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
  1162
    "Modified: 28.5.1996 / 20:52:49 / cg"
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
  1163
!
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
  1164
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
  1165
veryLightGray
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
  1166
    "return a very light-grey color (US version ;-)"
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
  1167
1368
cb5fbbcf568f checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1365
diff changeset
  1168
    ^ self grayPercent:87
1023
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
  1169
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
  1170
    "Created: 23.4.1996 / 13:33:46 / cg"
1368
cb5fbbcf568f checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1365
diff changeset
  1171
    "Modified: 24.2.1997 / 21:33:58 / cg"
1023
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
  1172
!
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
  1173
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
  1174
veryLightGrey
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
  1175
    "return a very light-grey color (English version ;-)"
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
  1176
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
  1177
    ^ self veryLightGray
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
  1178
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
  1179
    "Modified: 28.5.1996 / 20:52:03 / cg"
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
  1180
!
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
  1181
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
  1182
white
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
  1183
    "return the white-color"
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
  1184
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
  1185
    White isNil ifTrue:[
1348
acb4e4874e4d care for ColorValue (ColorValue cyan)
ca
parents: 1347
diff changeset
  1186
        White := (self redPercent:100 greenPercent:100 bluePercent:100) exactOn:Display
1023
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
  1187
    ].
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
  1188
    ^ White
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
  1189
!
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
  1190
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
  1191
yellow
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
  1192
    "return the yellow color - ST-80 compatibility"
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
  1193
1348
acb4e4874e4d care for ColorValue (ColorValue cyan)
ca
parents: 1347
diff changeset
  1194
    ^ self redPercent:100 greenPercent:100 bluePercent:0
1023
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
  1195
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
  1196
    "Modified: 23.4.1996 / 13:33:56 / cg"
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
  1197
! !
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
  1198
1233
c6796bddc7d1 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1229
diff changeset
  1199
!Color class methodsFor:'obsolete'!
c6796bddc7d1 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1229
diff changeset
  1200
c6796bddc7d1 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1229
diff changeset
  1201
nameOrDither:colorName
c6796bddc7d1 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1229
diff changeset
  1202
    "return a named color - if the exact color is not available,
c6796bddc7d1 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1229
diff changeset
  1203
     return a dithered color. Report an error, if the colorname is 
c6796bddc7d1 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1229
diff changeset
  1204
     illegal."
c6796bddc7d1 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1229
diff changeset
  1205
c6796bddc7d1 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1229
diff changeset
  1206
    self obsoleteMethodWarning:'use #name:'.
c6796bddc7d1 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1229
diff changeset
  1207
    ^ self name:colorName
c6796bddc7d1 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1229
diff changeset
  1208
c6796bddc7d1 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1229
diff changeset
  1209
    "Modified: 16.1.1997 / 23:01:03 / cg"
c6796bddc7d1 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1229
diff changeset
  1210
!
c6796bddc7d1 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1229
diff changeset
  1211
c6796bddc7d1 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1229
diff changeset
  1212
nameOrDither:colorName ifIllegal:errorBlock
c6796bddc7d1 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1229
diff changeset
  1213
    "return a named color - if the exact color is not available,
c6796bddc7d1 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1229
diff changeset
  1214
     return a dithered color. If the colorname is illegal, return
c6796bddc7d1 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1229
diff changeset
  1215
     the value of evaluating errorBlock."
c6796bddc7d1 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1229
diff changeset
  1216
c6796bddc7d1 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1229
diff changeset
  1217
    self obsoleteMethodWarning:'use #name:ifIllegal:'.
c6796bddc7d1 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1229
diff changeset
  1218
    ^ self name:colorName ifIllegal:errorBlock
c6796bddc7d1 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1229
diff changeset
  1219
c6796bddc7d1 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1229
diff changeset
  1220
    "Modified: 16.1.1997 / 23:01:32 / cg"
c6796bddc7d1 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1229
diff changeset
  1221
!
c6796bddc7d1 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1229
diff changeset
  1222
c6796bddc7d1 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1229
diff changeset
  1223
nameOrNearest:colorName
c6796bddc7d1 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1229
diff changeset
  1224
    "return a named color - or its nearest match"
c6796bddc7d1 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1229
diff changeset
  1225
c6796bddc7d1 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1229
diff changeset
  1226
    self obsoleteMethodWarning:'use #name:'.
c6796bddc7d1 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1229
diff changeset
  1227
    ^ self name:colorName
c6796bddc7d1 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1229
diff changeset
  1228
c6796bddc7d1 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1229
diff changeset
  1229
    "Modified: 16.1.1997 / 23:02:18 / cg"
c6796bddc7d1 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1229
diff changeset
  1230
! !
c6796bddc7d1 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1229
diff changeset
  1231
1144
07f3de59864d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1023
diff changeset
  1232
!Color class methodsFor:'private'!
1023
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
  1233
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
  1234
colorNearRed:r green:g blue:b on:aDevice
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
  1235
    "return a device color on aDevice with rgb values
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
  1236
     almost matching. If there is one, nil otherwise.
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
  1237
     This is tried as a last chance before dithering.
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
  1238
     The algorithm needs rework, the color components
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
  1239
     should be weighted according some theory :-)"
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
  1240
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
  1241
    |bestColor minDelta diff rr rg rb dRed|
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
  1242
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
  1243
"/    rr := (r * 3.0) rounded / 3.0.
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
  1244
"/    rg := (g * 3.0) rounded / 3.0.
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
  1245
"/    rb := (b * 3.0) rounded / 3.0.
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
  1246
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
  1247
    rr := r rounded.                "round to 1%"
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
  1248
    rg := (g * 2.0) rounded / 2.0.  "round to 0.5%"
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
  1249
    rb := (b / 2) rounded * 2.      "round to 2%"
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
  1250
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
  1251
    minDelta := 100*100*100.
1365
37a9e7ac4dbc moved color registration from Color class to per-device lobby
Claus Gittinger <cg@exept.de>
parents: 1348
diff changeset
  1252
    aDevice deviceColors do:[:aColor |
37a9e7ac4dbc moved color registration from Color class to per-device lobby
Claus Gittinger <cg@exept.de>
parents: 1348
diff changeset
  1253
        dRed := rr - aColor red.
37a9e7ac4dbc moved color registration from Color class to per-device lobby
Claus Gittinger <cg@exept.de>
parents: 1348
diff changeset
  1254
        dRed < 10 ifTrue:[
37a9e7ac4dbc moved color registration from Color class to per-device lobby
Claus Gittinger <cg@exept.de>
parents: 1348
diff changeset
  1255
            diff := dRed asInteger squared
37a9e7ac4dbc moved color registration from Color class to per-device lobby
Claus Gittinger <cg@exept.de>
parents: 1348
diff changeset
  1256
                    + (rg - aColor green) asInteger squared
37a9e7ac4dbc moved color registration from Color class to per-device lobby
Claus Gittinger <cg@exept.de>
parents: 1348
diff changeset
  1257
                    + (rb - aColor blue) asInteger squared.
37a9e7ac4dbc moved color registration from Color class to per-device lobby
Claus Gittinger <cg@exept.de>
parents: 1348
diff changeset
  1258
37a9e7ac4dbc moved color registration from Color class to per-device lobby
Claus Gittinger <cg@exept.de>
parents: 1348
diff changeset
  1259
            diff < minDelta ifTrue:[
37a9e7ac4dbc moved color registration from Color class to per-device lobby
Claus Gittinger <cg@exept.de>
parents: 1348
diff changeset
  1260
                diff = 0 ifTrue:[
37a9e7ac4dbc moved color registration from Color class to per-device lobby
Claus Gittinger <cg@exept.de>
parents: 1348
diff changeset
  1261
                    "got it"
37a9e7ac4dbc moved color registration from Color class to per-device lobby
Claus Gittinger <cg@exept.de>
parents: 1348
diff changeset
  1262
                    ^ aColor
37a9e7ac4dbc moved color registration from Color class to per-device lobby
Claus Gittinger <cg@exept.de>
parents: 1348
diff changeset
  1263
                ].
37a9e7ac4dbc moved color registration from Color class to per-device lobby
Claus Gittinger <cg@exept.de>
parents: 1348
diff changeset
  1264
                bestColor := aColor.
37a9e7ac4dbc moved color registration from Color class to per-device lobby
Claus Gittinger <cg@exept.de>
parents: 1348
diff changeset
  1265
                minDelta := diff
37a9e7ac4dbc moved color registration from Color class to per-device lobby
Claus Gittinger <cg@exept.de>
parents: 1348
diff changeset
  1266
            ]
1348
acb4e4874e4d care for ColorValue (ColorValue cyan)
ca
parents: 1347
diff changeset
  1267
        ]
1023
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
  1268
    ].
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
  1269
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
  1270
    "allow an error of 10% per component"
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
  1271
    minDelta < (100+100+100) ifTrue:[ ^ bestColor ].
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
  1272
    ^ nil
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
  1273
1365
37a9e7ac4dbc moved color registration from Color class to per-device lobby
Claus Gittinger <cg@exept.de>
parents: 1348
diff changeset
  1274
    "Modified: 24.2.1997 / 18:17:24 / cg"
1023
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
  1275
!
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
  1276
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
  1277
ditherBits
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
  1278
    "return a dither pattern for x/64; x in 1..63"
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
  1279
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
  1280
    ^ #(
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
  1281
1348
acb4e4874e4d care for ColorValue (ColorValue cyan)
ca
parents: 1347
diff changeset
  1282
        "/ 1in64
acb4e4874e4d care for ColorValue (ColorValue cyan)
ca
parents: 1347
diff changeset
  1283
acb4e4874e4d care for ColorValue (ColorValue cyan)
ca
parents: 1347
diff changeset
  1284
          #[2r10000000
acb4e4874e4d care for ColorValue (ColorValue cyan)
ca
parents: 1347
diff changeset
  1285
            2r00000000
acb4e4874e4d care for ColorValue (ColorValue cyan)
ca
parents: 1347
diff changeset
  1286
            2r00000000
acb4e4874e4d care for ColorValue (ColorValue cyan)
ca
parents: 1347
diff changeset
  1287
            2r00000000
acb4e4874e4d care for ColorValue (ColorValue cyan)
ca
parents: 1347
diff changeset
  1288
            2r00000000
acb4e4874e4d care for ColorValue (ColorValue cyan)
ca
parents: 1347
diff changeset
  1289
            2r00000000
acb4e4874e4d care for ColorValue (ColorValue cyan)
ca
parents: 1347
diff changeset
  1290
            2r00000000
acb4e4874e4d care for ColorValue (ColorValue cyan)
ca
parents: 1347
diff changeset
  1291
            2r00000000]
acb4e4874e4d care for ColorValue (ColorValue cyan)
ca
parents: 1347
diff changeset
  1292
acb4e4874e4d care for ColorValue (ColorValue cyan)
ca
parents: 1347
diff changeset
  1293
        "/ 2in64
acb4e4874e4d care for ColorValue (ColorValue cyan)
ca
parents: 1347
diff changeset
  1294
acb4e4874e4d care for ColorValue (ColorValue cyan)
ca
parents: 1347
diff changeset
  1295
          #[2r10000000
acb4e4874e4d care for ColorValue (ColorValue cyan)
ca
parents: 1347
diff changeset
  1296
            2r00000000
acb4e4874e4d care for ColorValue (ColorValue cyan)
ca
parents: 1347
diff changeset
  1297
            2r00000000
acb4e4874e4d care for ColorValue (ColorValue cyan)
ca
parents: 1347
diff changeset
  1298
            2r00000000
acb4e4874e4d care for ColorValue (ColorValue cyan)
ca
parents: 1347
diff changeset
  1299
            2r00001000
acb4e4874e4d care for ColorValue (ColorValue cyan)
ca
parents: 1347
diff changeset
  1300
            2r00000000
acb4e4874e4d care for ColorValue (ColorValue cyan)
ca
parents: 1347
diff changeset
  1301
            2r00000000
acb4e4874e4d care for ColorValue (ColorValue cyan)
ca
parents: 1347
diff changeset
  1302
            2r00000000]
acb4e4874e4d care for ColorValue (ColorValue cyan)
ca
parents: 1347
diff changeset
  1303
acb4e4874e4d care for ColorValue (ColorValue cyan)
ca
parents: 1347
diff changeset
  1304
        "/ 3in64
acb4e4874e4d care for ColorValue (ColorValue cyan)
ca
parents: 1347
diff changeset
  1305
acb4e4874e4d care for ColorValue (ColorValue cyan)
ca
parents: 1347
diff changeset
  1306
          #[2r10000000
acb4e4874e4d care for ColorValue (ColorValue cyan)
ca
parents: 1347
diff changeset
  1307
            2r00000000
acb4e4874e4d care for ColorValue (ColorValue cyan)
ca
parents: 1347
diff changeset
  1308
            2r00000000
acb4e4874e4d care for ColorValue (ColorValue cyan)
ca
parents: 1347
diff changeset
  1309
            2r00000000
acb4e4874e4d care for ColorValue (ColorValue cyan)
ca
parents: 1347
diff changeset
  1310
            2r10001000
acb4e4874e4d care for ColorValue (ColorValue cyan)
ca
parents: 1347
diff changeset
  1311
            2r00000000
acb4e4874e4d care for ColorValue (ColorValue cyan)
ca
parents: 1347
diff changeset
  1312
            2r00000000
acb4e4874e4d care for ColorValue (ColorValue cyan)
ca
parents: 1347
diff changeset
  1313
            2r00000000]
acb4e4874e4d care for ColorValue (ColorValue cyan)
ca
parents: 1347
diff changeset
  1314
acb4e4874e4d care for ColorValue (ColorValue cyan)
ca
parents: 1347
diff changeset
  1315
        "/ 4in64
acb4e4874e4d care for ColorValue (ColorValue cyan)
ca
parents: 1347
diff changeset
  1316
acb4e4874e4d care for ColorValue (ColorValue cyan)
ca
parents: 1347
diff changeset
  1317
          #[2r10001000
acb4e4874e4d care for ColorValue (ColorValue cyan)
ca
parents: 1347
diff changeset
  1318
            2r00000000
acb4e4874e4d care for ColorValue (ColorValue cyan)
ca
parents: 1347
diff changeset
  1319
            2r00000000
acb4e4874e4d care for ColorValue (ColorValue cyan)
ca
parents: 1347
diff changeset
  1320
            2r00000000
acb4e4874e4d care for ColorValue (ColorValue cyan)
ca
parents: 1347
diff changeset
  1321
            2r10001000
acb4e4874e4d care for ColorValue (ColorValue cyan)
ca
parents: 1347
diff changeset
  1322
            2r00000000
acb4e4874e4d care for ColorValue (ColorValue cyan)
ca
parents: 1347
diff changeset
  1323
            2r00000000
acb4e4874e4d care for ColorValue (ColorValue cyan)
ca
parents: 1347
diff changeset
  1324
            2r00000000]
acb4e4874e4d care for ColorValue (ColorValue cyan)
ca
parents: 1347
diff changeset
  1325
acb4e4874e4d care for ColorValue (ColorValue cyan)
ca
parents: 1347
diff changeset
  1326
        "/ 5in64
acb4e4874e4d care for ColorValue (ColorValue cyan)
ca
parents: 1347
diff changeset
  1327
acb4e4874e4d care for ColorValue (ColorValue cyan)
ca
parents: 1347
diff changeset
  1328
          #[2r10001000
acb4e4874e4d care for ColorValue (ColorValue cyan)
ca
parents: 1347
diff changeset
  1329
            2r00000000
acb4e4874e4d care for ColorValue (ColorValue cyan)
ca
parents: 1347
diff changeset
  1330
            2r00000000
acb4e4874e4d care for ColorValue (ColorValue cyan)
ca
parents: 1347
diff changeset
  1331
            2r00000000
acb4e4874e4d care for ColorValue (ColorValue cyan)
ca
parents: 1347
diff changeset
  1332
            2r10001000
acb4e4874e4d care for ColorValue (ColorValue cyan)
ca
parents: 1347
diff changeset
  1333
            2r00000000
acb4e4874e4d care for ColorValue (ColorValue cyan)
ca
parents: 1347
diff changeset
  1334
            2r00000010
acb4e4874e4d care for ColorValue (ColorValue cyan)
ca
parents: 1347
diff changeset
  1335
            2r00000000]
acb4e4874e4d care for ColorValue (ColorValue cyan)
ca
parents: 1347
diff changeset
  1336
acb4e4874e4d care for ColorValue (ColorValue cyan)
ca
parents: 1347
diff changeset
  1337
        "/ 6in64
acb4e4874e4d care for ColorValue (ColorValue cyan)
ca
parents: 1347
diff changeset
  1338
acb4e4874e4d care for ColorValue (ColorValue cyan)
ca
parents: 1347
diff changeset
  1339
          #[2r10001000
acb4e4874e4d care for ColorValue (ColorValue cyan)
ca
parents: 1347
diff changeset
  1340
            2r00000000
acb4e4874e4d care for ColorValue (ColorValue cyan)
ca
parents: 1347
diff changeset
  1341
            2r00100000
acb4e4874e4d care for ColorValue (ColorValue cyan)
ca
parents: 1347
diff changeset
  1342
            2r00000000
acb4e4874e4d care for ColorValue (ColorValue cyan)
ca
parents: 1347
diff changeset
  1343
            2r10001000
acb4e4874e4d care for ColorValue (ColorValue cyan)
ca
parents: 1347
diff changeset
  1344
            2r00000000
acb4e4874e4d care for ColorValue (ColorValue cyan)
ca
parents: 1347
diff changeset
  1345
            2r00000010
acb4e4874e4d care for ColorValue (ColorValue cyan)
ca
parents: 1347
diff changeset
  1346
            2r00000000]
acb4e4874e4d care for ColorValue (ColorValue cyan)
ca
parents: 1347
diff changeset
  1347
acb4e4874e4d care for ColorValue (ColorValue cyan)
ca
parents: 1347
diff changeset
  1348
        "/ 7in64
acb4e4874e4d care for ColorValue (ColorValue cyan)
ca
parents: 1347
diff changeset
  1349
acb4e4874e4d care for ColorValue (ColorValue cyan)
ca
parents: 1347
diff changeset
  1350
          #[2r10001000
acb4e4874e4d care for ColorValue (ColorValue cyan)
ca
parents: 1347
diff changeset
  1351
            2r00000000
acb4e4874e4d care for ColorValue (ColorValue cyan)
ca
parents: 1347
diff changeset
  1352
            2r00100010
acb4e4874e4d care for ColorValue (ColorValue cyan)
ca
parents: 1347
diff changeset
  1353
            2r00000000
acb4e4874e4d care for ColorValue (ColorValue cyan)
ca
parents: 1347
diff changeset
  1354
            2r10001000
acb4e4874e4d care for ColorValue (ColorValue cyan)
ca
parents: 1347
diff changeset
  1355
            2r00000000
acb4e4874e4d care for ColorValue (ColorValue cyan)
ca
parents: 1347
diff changeset
  1356
            2r00000010
acb4e4874e4d care for ColorValue (ColorValue cyan)
ca
parents: 1347
diff changeset
  1357
            2r00000000]
acb4e4874e4d care for ColorValue (ColorValue cyan)
ca
parents: 1347
diff changeset
  1358
acb4e4874e4d care for ColorValue (ColorValue cyan)
ca
parents: 1347
diff changeset
  1359
        "/ 8in64
acb4e4874e4d care for ColorValue (ColorValue cyan)
ca
parents: 1347
diff changeset
  1360
acb4e4874e4d care for ColorValue (ColorValue cyan)
ca
parents: 1347
diff changeset
  1361
          #[2r10001000
acb4e4874e4d care for ColorValue (ColorValue cyan)
ca
parents: 1347
diff changeset
  1362
            2r00000000
acb4e4874e4d care for ColorValue (ColorValue cyan)
ca
parents: 1347
diff changeset
  1363
            2r00100010
acb4e4874e4d care for ColorValue (ColorValue cyan)
ca
parents: 1347
diff changeset
  1364
            2r00000000
acb4e4874e4d care for ColorValue (ColorValue cyan)
ca
parents: 1347
diff changeset
  1365
            2r10001000
acb4e4874e4d care for ColorValue (ColorValue cyan)
ca
parents: 1347
diff changeset
  1366
            2r00000000
acb4e4874e4d care for ColorValue (ColorValue cyan)
ca
parents: 1347
diff changeset
  1367
            2r00100010
acb4e4874e4d care for ColorValue (ColorValue cyan)
ca
parents: 1347
diff changeset
  1368
            2r00000000]
acb4e4874e4d care for ColorValue (ColorValue cyan)
ca
parents: 1347
diff changeset
  1369
acb4e4874e4d care for ColorValue (ColorValue cyan)
ca
parents: 1347
diff changeset
  1370
        "/ 9in64
acb4e4874e4d care for ColorValue (ColorValue cyan)
ca
parents: 1347
diff changeset
  1371
acb4e4874e4d care for ColorValue (ColorValue cyan)
ca
parents: 1347
diff changeset
  1372
          #[2r10001000
acb4e4874e4d care for ColorValue (ColorValue cyan)
ca
parents: 1347
diff changeset
  1373
            2r00000000
acb4e4874e4d care for ColorValue (ColorValue cyan)
ca
parents: 1347
diff changeset
  1374
            2r00100010
acb4e4874e4d care for ColorValue (ColorValue cyan)
ca
parents: 1347
diff changeset
  1375
            2r00000000
acb4e4874e4d care for ColorValue (ColorValue cyan)
ca
parents: 1347
diff changeset
  1376
            2r10001000
acb4e4874e4d care for ColorValue (ColorValue cyan)
ca
parents: 1347
diff changeset
  1377
            2r00000000
acb4e4874e4d care for ColorValue (ColorValue cyan)
ca
parents: 1347
diff changeset
  1378
            2r10100010
acb4e4874e4d care for ColorValue (ColorValue cyan)
ca
parents: 1347
diff changeset
  1379
            2r00000000]
acb4e4874e4d care for ColorValue (ColorValue cyan)
ca
parents: 1347
diff changeset
  1380
acb4e4874e4d care for ColorValue (ColorValue cyan)
ca
parents: 1347
diff changeset
  1381
        "/ 10in64
acb4e4874e4d care for ColorValue (ColorValue cyan)
ca
parents: 1347
diff changeset
  1382
acb4e4874e4d care for ColorValue (ColorValue cyan)
ca
parents: 1347
diff changeset
  1383
          #[2r10001000
acb4e4874e4d care for ColorValue (ColorValue cyan)
ca
parents: 1347
diff changeset
  1384
            2r00000000
acb4e4874e4d care for ColorValue (ColorValue cyan)
ca
parents: 1347
diff changeset
  1385
            2r00101010
acb4e4874e4d care for ColorValue (ColorValue cyan)
ca
parents: 1347
diff changeset
  1386
            2r00000000
acb4e4874e4d care for ColorValue (ColorValue cyan)
ca
parents: 1347
diff changeset
  1387
            2r10001000
acb4e4874e4d care for ColorValue (ColorValue cyan)
ca
parents: 1347
diff changeset
  1388
            2r00000000
acb4e4874e4d care for ColorValue (ColorValue cyan)
ca
parents: 1347
diff changeset
  1389
            2r10100010
acb4e4874e4d care for ColorValue (ColorValue cyan)
ca
parents: 1347
diff changeset
  1390
            2r00000000]
acb4e4874e4d care for ColorValue (ColorValue cyan)
ca
parents: 1347
diff changeset
  1391
acb4e4874e4d care for ColorValue (ColorValue cyan)
ca
parents: 1347
diff changeset
  1392
        "/ 11in64
acb4e4874e4d care for ColorValue (ColorValue cyan)
ca
parents: 1347
diff changeset
  1393
acb4e4874e4d care for ColorValue (ColorValue cyan)
ca
parents: 1347
diff changeset
  1394
          #[2r10001000
acb4e4874e4d care for ColorValue (ColorValue cyan)
ca
parents: 1347
diff changeset
  1395
            2r00000000
acb4e4874e4d care for ColorValue (ColorValue cyan)
ca
parents: 1347
diff changeset
  1396
            2r00101010
acb4e4874e4d care for ColorValue (ColorValue cyan)
ca
parents: 1347
diff changeset
  1397
            2r00000000
acb4e4874e4d care for ColorValue (ColorValue cyan)
ca
parents: 1347
diff changeset
  1398
            2r10001000
acb4e4874e4d care for ColorValue (ColorValue cyan)
ca
parents: 1347
diff changeset
  1399
            2r00000000
acb4e4874e4d care for ColorValue (ColorValue cyan)
ca
parents: 1347
diff changeset
  1400
            2r10101010
acb4e4874e4d care for ColorValue (ColorValue cyan)
ca
parents: 1347
diff changeset
  1401
            2r00000000]
acb4e4874e4d care for ColorValue (ColorValue cyan)
ca
parents: 1347
diff changeset
  1402
acb4e4874e4d care for ColorValue (ColorValue cyan)
ca
parents: 1347
diff changeset
  1403
        "/ 12in64
acb4e4874e4d care for ColorValue (ColorValue cyan)
ca
parents: 1347
diff changeset
  1404
acb4e4874e4d care for ColorValue (ColorValue cyan)
ca
parents: 1347
diff changeset
  1405
          #[2r10001000
acb4e4874e4d care for ColorValue (ColorValue cyan)
ca
parents: 1347
diff changeset
  1406
            2r00000000
acb4e4874e4d care for ColorValue (ColorValue cyan)
ca
parents: 1347
diff changeset
  1407
            2r10101010
acb4e4874e4d care for ColorValue (ColorValue cyan)
ca
parents: 1347
diff changeset
  1408
            2r00000000
acb4e4874e4d care for ColorValue (ColorValue cyan)
ca
parents: 1347
diff changeset
  1409
            2r10001000
acb4e4874e4d care for ColorValue (ColorValue cyan)
ca
parents: 1347
diff changeset
  1410
            2r00000000
acb4e4874e4d care for ColorValue (ColorValue cyan)
ca
parents: 1347
diff changeset
  1411
            2r10101010
acb4e4874e4d care for ColorValue (ColorValue cyan)
ca
parents: 1347
diff changeset
  1412
            2r00000000]
acb4e4874e4d care for ColorValue (ColorValue cyan)
ca
parents: 1347
diff changeset
  1413
acb4e4874e4d care for ColorValue (ColorValue cyan)
ca
parents: 1347
diff changeset
  1414
        "/ 13in64
acb4e4874e4d care for ColorValue (ColorValue cyan)
ca
parents: 1347
diff changeset
  1415
acb4e4874e4d care for ColorValue (ColorValue cyan)
ca
parents: 1347
diff changeset
  1416
          #[2r10001000
acb4e4874e4d care for ColorValue (ColorValue cyan)
ca
parents: 1347
diff changeset
  1417
            2r00000000
acb4e4874e4d care for ColorValue (ColorValue cyan)
ca
parents: 1347
diff changeset
  1418
            2r10101010
acb4e4874e4d care for ColorValue (ColorValue cyan)
ca
parents: 1347
diff changeset
  1419
            2r00000000
acb4e4874e4d care for ColorValue (ColorValue cyan)
ca
parents: 1347
diff changeset
  1420
            2r10101000
acb4e4874e4d care for ColorValue (ColorValue cyan)
ca
parents: 1347
diff changeset
  1421
            2r00000000
acb4e4874e4d care for ColorValue (ColorValue cyan)
ca
parents: 1347
diff changeset
  1422
            2r10101010
acb4e4874e4d care for ColorValue (ColorValue cyan)
ca
parents: 1347
diff changeset
  1423
            2r00000000]
acb4e4874e4d care for ColorValue (ColorValue cyan)
ca
parents: 1347
diff changeset
  1424
acb4e4874e4d care for ColorValue (ColorValue cyan)
ca
parents: 1347
diff changeset
  1425
        "/ 14in64
acb4e4874e4d care for ColorValue (ColorValue cyan)
ca
parents: 1347
diff changeset
  1426
acb4e4874e4d care for ColorValue (ColorValue cyan)
ca
parents: 1347
diff changeset
  1427
          #[2r10001010
acb4e4874e4d care for ColorValue (ColorValue cyan)
ca
parents: 1347
diff changeset
  1428
            2r00000000
acb4e4874e4d care for ColorValue (ColorValue cyan)
ca
parents: 1347
diff changeset
  1429
            2r10101010
acb4e4874e4d care for ColorValue (ColorValue cyan)
ca
parents: 1347
diff changeset
  1430
            2r00000000
acb4e4874e4d care for ColorValue (ColorValue cyan)
ca
parents: 1347
diff changeset
  1431
            2r10101000
acb4e4874e4d care for ColorValue (ColorValue cyan)
ca
parents: 1347
diff changeset
  1432
            2r00000000
acb4e4874e4d care for ColorValue (ColorValue cyan)
ca
parents: 1347
diff changeset
  1433
            2r10101010
acb4e4874e4d care for ColorValue (ColorValue cyan)
ca
parents: 1347
diff changeset
  1434
            2r00000000]
acb4e4874e4d care for ColorValue (ColorValue cyan)
ca
parents: 1347
diff changeset
  1435
acb4e4874e4d care for ColorValue (ColorValue cyan)
ca
parents: 1347
diff changeset
  1436
        "/ 15in64
acb4e4874e4d care for ColorValue (ColorValue cyan)
ca
parents: 1347
diff changeset
  1437
acb4e4874e4d care for ColorValue (ColorValue cyan)
ca
parents: 1347
diff changeset
  1438
          #[2r10001010
acb4e4874e4d care for ColorValue (ColorValue cyan)
ca
parents: 1347
diff changeset
  1439
            2r00000000
acb4e4874e4d care for ColorValue (ColorValue cyan)
ca
parents: 1347
diff changeset
  1440
            2r10101010
acb4e4874e4d care for ColorValue (ColorValue cyan)
ca
parents: 1347
diff changeset
  1441
            2r00000000
acb4e4874e4d care for ColorValue (ColorValue cyan)
ca
parents: 1347
diff changeset
  1442
            2r10101010
acb4e4874e4d care for ColorValue (ColorValue cyan)
ca
parents: 1347
diff changeset
  1443
            2r00000000
acb4e4874e4d care for ColorValue (ColorValue cyan)
ca
parents: 1347
diff changeset
  1444
            2r10101010
acb4e4874e4d care for ColorValue (ColorValue cyan)
ca
parents: 1347
diff changeset
  1445
            2r00000000]
acb4e4874e4d care for ColorValue (ColorValue cyan)
ca
parents: 1347
diff changeset
  1446
acb4e4874e4d care for ColorValue (ColorValue cyan)
ca
parents: 1347
diff changeset
  1447
        "/ 16in64
acb4e4874e4d care for ColorValue (ColorValue cyan)
ca
parents: 1347
diff changeset
  1448
acb4e4874e4d care for ColorValue (ColorValue cyan)
ca
parents: 1347
diff changeset
  1449
          #[2r10101010
acb4e4874e4d care for ColorValue (ColorValue cyan)
ca
parents: 1347
diff changeset
  1450
            2r00000000
acb4e4874e4d care for ColorValue (ColorValue cyan)
ca
parents: 1347
diff changeset
  1451
            2r10101010
acb4e4874e4d care for ColorValue (ColorValue cyan)
ca
parents: 1347
diff changeset
  1452
            2r00000000
acb4e4874e4d care for ColorValue (ColorValue cyan)
ca
parents: 1347
diff changeset
  1453
            2r10101010
acb4e4874e4d care for ColorValue (ColorValue cyan)
ca
parents: 1347
diff changeset
  1454
            2r00000000
acb4e4874e4d care for ColorValue (ColorValue cyan)
ca
parents: 1347
diff changeset
  1455
            2r10101010
acb4e4874e4d care for ColorValue (ColorValue cyan)
ca
parents: 1347
diff changeset
  1456
            2r00000000]
acb4e4874e4d care for ColorValue (ColorValue cyan)
ca
parents: 1347
diff changeset
  1457
acb4e4874e4d care for ColorValue (ColorValue cyan)
ca
parents: 1347
diff changeset
  1458
        "/ 17in64
acb4e4874e4d care for ColorValue (ColorValue cyan)
ca
parents: 1347
diff changeset
  1459
acb4e4874e4d care for ColorValue (ColorValue cyan)
ca
parents: 1347
diff changeset
  1460
          #[2r10101010
acb4e4874e4d care for ColorValue (ColorValue cyan)
ca
parents: 1347
diff changeset
  1461
            2r01000000
acb4e4874e4d care for ColorValue (ColorValue cyan)
ca
parents: 1347
diff changeset
  1462
            2r10101010
acb4e4874e4d care for ColorValue (ColorValue cyan)
ca
parents: 1347
diff changeset
  1463
            2r00000000
acb4e4874e4d care for ColorValue (ColorValue cyan)
ca
parents: 1347
diff changeset
  1464
            2r10101010
acb4e4874e4d care for ColorValue (ColorValue cyan)
ca
parents: 1347
diff changeset
  1465
            2r00000000
acb4e4874e4d care for ColorValue (ColorValue cyan)
ca
parents: 1347
diff changeset
  1466
            2r10101010
acb4e4874e4d care for ColorValue (ColorValue cyan)
ca
parents: 1347
diff changeset
  1467
            2r00000000]
acb4e4874e4d care for ColorValue (ColorValue cyan)
ca
parents: 1347
diff changeset
  1468
acb4e4874e4d care for ColorValue (ColorValue cyan)
ca
parents: 1347
diff changeset
  1469
        "/ 18in64
acb4e4874e4d care for ColorValue (ColorValue cyan)
ca
parents: 1347
diff changeset
  1470
acb4e4874e4d care for ColorValue (ColorValue cyan)
ca
parents: 1347
diff changeset
  1471
          #[2r10101010
acb4e4874e4d care for ColorValue (ColorValue cyan)
ca
parents: 1347
diff changeset
  1472
            2r01000000
acb4e4874e4d care for ColorValue (ColorValue cyan)
ca
parents: 1347
diff changeset
  1473
            2r10101010
acb4e4874e4d care for ColorValue (ColorValue cyan)
ca
parents: 1347
diff changeset
  1474
            2r00000000
acb4e4874e4d care for ColorValue (ColorValue cyan)
ca
parents: 1347
diff changeset
  1475
            2r10101010
acb4e4874e4d care for ColorValue (ColorValue cyan)
ca
parents: 1347
diff changeset
  1476
            2r00000100
acb4e4874e4d care for ColorValue (ColorValue cyan)
ca
parents: 1347
diff changeset
  1477
            2r10101010
acb4e4874e4d care for ColorValue (ColorValue cyan)
ca
parents: 1347
diff changeset
  1478
            2r00000000]
acb4e4874e4d care for ColorValue (ColorValue cyan)
ca
parents: 1347
diff changeset
  1479
acb4e4874e4d care for ColorValue (ColorValue cyan)
ca
parents: 1347
diff changeset
  1480
        "/ 19in64
acb4e4874e4d care for ColorValue (ColorValue cyan)
ca
parents: 1347
diff changeset
  1481
acb4e4874e4d care for ColorValue (ColorValue cyan)
ca
parents: 1347
diff changeset
  1482
          #[2r10101010
acb4e4874e4d care for ColorValue (ColorValue cyan)
ca
parents: 1347
diff changeset
  1483
            2r01000000
acb4e4874e4d care for ColorValue (ColorValue cyan)
ca
parents: 1347
diff changeset
  1484
            2r10101010
acb4e4874e4d care for ColorValue (ColorValue cyan)
ca
parents: 1347
diff changeset
  1485
            2r00000000
acb4e4874e4d care for ColorValue (ColorValue cyan)
ca
parents: 1347
diff changeset
  1486
            2r10101010
acb4e4874e4d care for ColorValue (ColorValue cyan)
ca
parents: 1347
diff changeset
  1487
            2r01000100
acb4e4874e4d care for ColorValue (ColorValue cyan)
ca
parents: 1347
diff changeset
  1488
            2r10101010
acb4e4874e4d care for ColorValue (ColorValue cyan)
ca
parents: 1347
diff changeset
  1489
            2r00000000]
acb4e4874e4d care for ColorValue (ColorValue cyan)
ca
parents: 1347
diff changeset
  1490
acb4e4874e4d care for ColorValue (ColorValue cyan)
ca
parents: 1347
diff changeset
  1491
        "/ 20in64
acb4e4874e4d care for ColorValue (ColorValue cyan)
ca
parents: 1347
diff changeset
  1492
acb4e4874e4d care for ColorValue (ColorValue cyan)
ca
parents: 1347
diff changeset
  1493
          #[2r10101010
acb4e4874e4d care for ColorValue (ColorValue cyan)
ca
parents: 1347
diff changeset
  1494
            2r01000100
acb4e4874e4d care for ColorValue (ColorValue cyan)
ca
parents: 1347
diff changeset
  1495
            2r10101010
acb4e4874e4d care for ColorValue (ColorValue cyan)
ca
parents: 1347
diff changeset
  1496
            2r00000000
acb4e4874e4d care for ColorValue (ColorValue cyan)
ca
parents: 1347
diff changeset
  1497
            2r10101010
acb4e4874e4d care for ColorValue (ColorValue cyan)
ca
parents: 1347
diff changeset
  1498
            2r01000100
acb4e4874e4d care for ColorValue (ColorValue cyan)
ca
parents: 1347
diff changeset
  1499
            2r10101010
acb4e4874e4d care for ColorValue (ColorValue cyan)
ca
parents: 1347
diff changeset
  1500
            2r00000000]
acb4e4874e4d care for ColorValue (ColorValue cyan)
ca
parents: 1347
diff changeset
  1501
acb4e4874e4d care for ColorValue (ColorValue cyan)
ca
parents: 1347
diff changeset
  1502
        "/ 21in64
acb4e4874e4d care for ColorValue (ColorValue cyan)
ca
parents: 1347
diff changeset
  1503
acb4e4874e4d care for ColorValue (ColorValue cyan)
ca
parents: 1347
diff changeset
  1504
          #[2r10101010
acb4e4874e4d care for ColorValue (ColorValue cyan)
ca
parents: 1347
diff changeset
  1505
            2r01000100
acb4e4874e4d care for ColorValue (ColorValue cyan)
ca
parents: 1347
diff changeset
  1506
            2r10101010
acb4e4874e4d care for ColorValue (ColorValue cyan)
ca
parents: 1347
diff changeset
  1507
            2r00000000
acb4e4874e4d care for ColorValue (ColorValue cyan)
ca
parents: 1347
diff changeset
  1508
            2r10101010
acb4e4874e4d care for ColorValue (ColorValue cyan)
ca
parents: 1347
diff changeset
  1509
            2r01000100
acb4e4874e4d care for ColorValue (ColorValue cyan)
ca
parents: 1347
diff changeset
  1510
            2r10101010
acb4e4874e4d care for ColorValue (ColorValue cyan)
ca
parents: 1347
diff changeset
  1511
            2r00000001]
acb4e4874e4d care for ColorValue (ColorValue cyan)
ca
parents: 1347
diff changeset
  1512
acb4e4874e4d care for ColorValue (ColorValue cyan)
ca
parents: 1347
diff changeset
  1513
        "/ 22in64
acb4e4874e4d care for ColorValue (ColorValue cyan)
ca
parents: 1347
diff changeset
  1514
acb4e4874e4d care for ColorValue (ColorValue cyan)
ca
parents: 1347
diff changeset
  1515
          #[2r10101010
acb4e4874e4d care for ColorValue (ColorValue cyan)
ca
parents: 1347
diff changeset
  1516
            2r01000100
acb4e4874e4d care for ColorValue (ColorValue cyan)
ca
parents: 1347
diff changeset
  1517
            2r10101010
acb4e4874e4d care for ColorValue (ColorValue cyan)
ca
parents: 1347
diff changeset
  1518
            2r00010000
acb4e4874e4d care for ColorValue (ColorValue cyan)
ca
parents: 1347
diff changeset
  1519
            2r10101010
acb4e4874e4d care for ColorValue (ColorValue cyan)
ca
parents: 1347
diff changeset
  1520
            2r01000100
acb4e4874e4d care for ColorValue (ColorValue cyan)
ca
parents: 1347
diff changeset
  1521
            2r10101010
acb4e4874e4d care for ColorValue (ColorValue cyan)
ca
parents: 1347
diff changeset
  1522
            2r00000001]
acb4e4874e4d care for ColorValue (ColorValue cyan)
ca
parents: 1347
diff changeset
  1523
acb4e4874e4d care for ColorValue (ColorValue cyan)
ca
parents: 1347
diff changeset
  1524
        "/ 23in64
acb4e4874e4d care for ColorValue (ColorValue cyan)
ca
parents: 1347
diff changeset
  1525
acb4e4874e4d care for ColorValue (ColorValue cyan)
ca
parents: 1347
diff changeset
  1526
          #[2r10101010
acb4e4874e4d care for ColorValue (ColorValue cyan)
ca
parents: 1347
diff changeset
  1527
            2r01000100
acb4e4874e4d care for ColorValue (ColorValue cyan)
ca
parents: 1347
diff changeset
  1528
            2r10101010
acb4e4874e4d care for ColorValue (ColorValue cyan)
ca
parents: 1347
diff changeset
  1529
            2r00010001
acb4e4874e4d care for ColorValue (ColorValue cyan)
ca
parents: 1347
diff changeset
  1530
            2r10101010
acb4e4874e4d care for ColorValue (ColorValue cyan)
ca
parents: 1347
diff changeset
  1531
            2r01000100
acb4e4874e4d care for ColorValue (ColorValue cyan)
ca
parents: 1347
diff changeset
  1532
            2r10101010
acb4e4874e4d care for ColorValue (ColorValue cyan)
ca
parents: 1347
diff changeset
  1533
            2r00000001]
acb4e4874e4d care for ColorValue (ColorValue cyan)
ca
parents: 1347
diff changeset
  1534
acb4e4874e4d care for ColorValue (ColorValue cyan)
ca
parents: 1347
diff changeset
  1535
        "/ 24in64
acb4e4874e4d care for ColorValue (ColorValue cyan)
ca
parents: 1347
diff changeset
  1536
acb4e4874e4d care for ColorValue (ColorValue cyan)
ca
parents: 1347
diff changeset
  1537
          #[2r10101010
acb4e4874e4d care for ColorValue (ColorValue cyan)
ca
parents: 1347
diff changeset
  1538
            2r01000100
acb4e4874e4d care for ColorValue (ColorValue cyan)
ca
parents: 1347
diff changeset
  1539
            2r10101010
acb4e4874e4d care for ColorValue (ColorValue cyan)
ca
parents: 1347
diff changeset
  1540
            2r00010001
acb4e4874e4d care for ColorValue (ColorValue cyan)
ca
parents: 1347
diff changeset
  1541
            2r10101010
acb4e4874e4d care for ColorValue (ColorValue cyan)
ca
parents: 1347
diff changeset
  1542
            2r01000100
acb4e4874e4d care for ColorValue (ColorValue cyan)
ca
parents: 1347
diff changeset
  1543
            2r10101010
acb4e4874e4d care for ColorValue (ColorValue cyan)
ca
parents: 1347
diff changeset
  1544
            2r00010001]
acb4e4874e4d care for ColorValue (ColorValue cyan)
ca
parents: 1347
diff changeset
  1545
acb4e4874e4d care for ColorValue (ColorValue cyan)
ca
parents: 1347
diff changeset
  1546
        "/ 25in64
acb4e4874e4d care for ColorValue (ColorValue cyan)
ca
parents: 1347
diff changeset
  1547
acb4e4874e4d care for ColorValue (ColorValue cyan)
ca
parents: 1347
diff changeset
  1548
          #[2r10101010
acb4e4874e4d care for ColorValue (ColorValue cyan)
ca
parents: 1347
diff changeset
  1549
            2r01000100
acb4e4874e4d care for ColorValue (ColorValue cyan)
ca
parents: 1347
diff changeset
  1550
            2r10101010
acb4e4874e4d care for ColorValue (ColorValue cyan)
ca
parents: 1347
diff changeset
  1551
            2r00010001
acb4e4874e4d care for ColorValue (ColorValue cyan)
ca
parents: 1347
diff changeset
  1552
            2r10101010
acb4e4874e4d care for ColorValue (ColorValue cyan)
ca
parents: 1347
diff changeset
  1553
            2r01000100
acb4e4874e4d care for ColorValue (ColorValue cyan)
ca
parents: 1347
diff changeset
  1554
            2r10101010
acb4e4874e4d care for ColorValue (ColorValue cyan)
ca
parents: 1347
diff changeset
  1555
            2r01010001]
acb4e4874e4d care for ColorValue (ColorValue cyan)
ca
parents: 1347
diff changeset
  1556
acb4e4874e4d care for ColorValue (ColorValue cyan)
ca
parents: 1347
diff changeset
  1557
        "/ 26in64
acb4e4874e4d care for ColorValue (ColorValue cyan)
ca
parents: 1347
diff changeset
  1558
acb4e4874e4d care for ColorValue (ColorValue cyan)
ca
parents: 1347
diff changeset
  1559
          #[2r10101010
acb4e4874e4d care for ColorValue (ColorValue cyan)
ca
parents: 1347
diff changeset
  1560
            2r01000100
acb4e4874e4d care for ColorValue (ColorValue cyan)
ca
parents: 1347
diff changeset
  1561
            2r10101010
acb4e4874e4d care for ColorValue (ColorValue cyan)
ca
parents: 1347
diff changeset
  1562
            2r00010101
acb4e4874e4d care for ColorValue (ColorValue cyan)
ca
parents: 1347
diff changeset
  1563
            2r10101010
acb4e4874e4d care for ColorValue (ColorValue cyan)
ca
parents: 1347
diff changeset
  1564
            2r01000100
acb4e4874e4d care for ColorValue (ColorValue cyan)
ca
parents: 1347
diff changeset
  1565
            2r10101010
acb4e4874e4d care for ColorValue (ColorValue cyan)
ca
parents: 1347
diff changeset
  1566
            2r01010001]
acb4e4874e4d care for ColorValue (ColorValue cyan)
ca
parents: 1347
diff changeset
  1567
acb4e4874e4d care for ColorValue (ColorValue cyan)
ca
parents: 1347
diff changeset
  1568
        "/ 27in64
acb4e4874e4d care for ColorValue (ColorValue cyan)
ca
parents: 1347
diff changeset
  1569
acb4e4874e4d care for ColorValue (ColorValue cyan)
ca
parents: 1347
diff changeset
  1570
          #[2r10101010
acb4e4874e4d care for ColorValue (ColorValue cyan)
ca
parents: 1347
diff changeset
  1571
            2r01000100
acb4e4874e4d care for ColorValue (ColorValue cyan)
ca
parents: 1347
diff changeset
  1572
            2r10101010
acb4e4874e4d care for ColorValue (ColorValue cyan)
ca
parents: 1347
diff changeset
  1573
            2r00010101
acb4e4874e4d care for ColorValue (ColorValue cyan)
ca
parents: 1347
diff changeset
  1574
            2r10101010
acb4e4874e4d care for ColorValue (ColorValue cyan)
ca
parents: 1347
diff changeset
  1575
            2r01000100
acb4e4874e4d care for ColorValue (ColorValue cyan)
ca
parents: 1347
diff changeset
  1576
            2r10101010
acb4e4874e4d care for ColorValue (ColorValue cyan)
ca
parents: 1347
diff changeset
  1577
            2r01010101]
acb4e4874e4d care for ColorValue (ColorValue cyan)
ca
parents: 1347
diff changeset
  1578
acb4e4874e4d care for ColorValue (ColorValue cyan)
ca
parents: 1347
diff changeset
  1579
        "/ 28in64
acb4e4874e4d care for ColorValue (ColorValue cyan)
ca
parents: 1347
diff changeset
  1580
acb4e4874e4d care for ColorValue (ColorValue cyan)
ca
parents: 1347
diff changeset
  1581
          #[2r10101010
acb4e4874e4d care for ColorValue (ColorValue cyan)
ca
parents: 1347
diff changeset
  1582
            2r01000100
acb4e4874e4d care for ColorValue (ColorValue cyan)
ca
parents: 1347
diff changeset
  1583
            2r10101010
acb4e4874e4d care for ColorValue (ColorValue cyan)
ca
parents: 1347
diff changeset
  1584
            2r01010101
acb4e4874e4d care for ColorValue (ColorValue cyan)
ca
parents: 1347
diff changeset
  1585
            2r10101010
acb4e4874e4d care for ColorValue (ColorValue cyan)
ca
parents: 1347
diff changeset
  1586
            2r01000100
acb4e4874e4d care for ColorValue (ColorValue cyan)
ca
parents: 1347
diff changeset
  1587
            2r10101010
acb4e4874e4d care for ColorValue (ColorValue cyan)
ca
parents: 1347
diff changeset
  1588
            2r01010101]
acb4e4874e4d care for ColorValue (ColorValue cyan)
ca
parents: 1347
diff changeset
  1589
acb4e4874e4d care for ColorValue (ColorValue cyan)
ca
parents: 1347
diff changeset
  1590
        "/ 29in64
acb4e4874e4d care for ColorValue (ColorValue cyan)
ca
parents: 1347
diff changeset
  1591
acb4e4874e4d care for ColorValue (ColorValue cyan)
ca
parents: 1347
diff changeset
  1592
          #[2r10101010
acb4e4874e4d care for ColorValue (ColorValue cyan)
ca
parents: 1347
diff changeset
  1593
            2r01000100
acb4e4874e4d care for ColorValue (ColorValue cyan)
ca
parents: 1347
diff changeset
  1594
            2r10101010
acb4e4874e4d care for ColorValue (ColorValue cyan)
ca
parents: 1347
diff changeset
  1595
            2r01010101
acb4e4874e4d care for ColorValue (ColorValue cyan)
ca
parents: 1347
diff changeset
  1596
            2r10101010
acb4e4874e4d care for ColorValue (ColorValue cyan)
ca
parents: 1347
diff changeset
  1597
            2r01010100
acb4e4874e4d care for ColorValue (ColorValue cyan)
ca
parents: 1347
diff changeset
  1598
            2r10101010
acb4e4874e4d care for ColorValue (ColorValue cyan)
ca
parents: 1347
diff changeset
  1599
            2r01010101]
acb4e4874e4d care for ColorValue (ColorValue cyan)
ca
parents: 1347
diff changeset
  1600
acb4e4874e4d care for ColorValue (ColorValue cyan)
ca
parents: 1347
diff changeset
  1601
        "/ 30in64
acb4e4874e4d care for ColorValue (ColorValue cyan)
ca
parents: 1347
diff changeset
  1602
acb4e4874e4d care for ColorValue (ColorValue cyan)
ca
parents: 1347
diff changeset
  1603
          #[2r10101010
acb4e4874e4d care for ColorValue (ColorValue cyan)
ca
parents: 1347
diff changeset
  1604
            2r01000101
acb4e4874e4d care for ColorValue (ColorValue cyan)
ca
parents: 1347
diff changeset
  1605
            2r10101010
acb4e4874e4d care for ColorValue (ColorValue cyan)
ca
parents: 1347
diff changeset
  1606
            2r01010101
acb4e4874e4d care for ColorValue (ColorValue cyan)
ca
parents: 1347
diff changeset
  1607
            2r10101010
acb4e4874e4d care for ColorValue (ColorValue cyan)
ca
parents: 1347
diff changeset
  1608
            2r01010100
acb4e4874e4d care for ColorValue (ColorValue cyan)
ca
parents: 1347
diff changeset
  1609
            2r10101010
acb4e4874e4d care for ColorValue (ColorValue cyan)
ca
parents: 1347
diff changeset
  1610
            2r01010101]
acb4e4874e4d care for ColorValue (ColorValue cyan)
ca
parents: 1347
diff changeset
  1611
acb4e4874e4d care for ColorValue (ColorValue cyan)
ca
parents: 1347
diff changeset
  1612
        "/ 31in64
acb4e4874e4d care for ColorValue (ColorValue cyan)
ca
parents: 1347
diff changeset
  1613
acb4e4874e4d care for ColorValue (ColorValue cyan)
ca
parents: 1347
diff changeset
  1614
          #[2r10101010
acb4e4874e4d care for ColorValue (ColorValue cyan)
ca
parents: 1347
diff changeset
  1615
            2r01000101
acb4e4874e4d care for ColorValue (ColorValue cyan)
ca
parents: 1347
diff changeset
  1616
            2r10101010
acb4e4874e4d care for ColorValue (ColorValue cyan)
ca
parents: 1347
diff changeset
  1617
            2r01010101
acb4e4874e4d care for ColorValue (ColorValue cyan)
ca
parents: 1347
diff changeset
  1618
            2r10101010
acb4e4874e4d care for ColorValue (ColorValue cyan)
ca
parents: 1347
diff changeset
  1619
            2r01010101
acb4e4874e4d care for ColorValue (ColorValue cyan)
ca
parents: 1347
diff changeset
  1620
            2r10101010
acb4e4874e4d care for ColorValue (ColorValue cyan)
ca
parents: 1347
diff changeset
  1621
            2r01010101]
acb4e4874e4d care for ColorValue (ColorValue cyan)
ca
parents: 1347
diff changeset
  1622
acb4e4874e4d care for ColorValue (ColorValue cyan)
ca
parents: 1347
diff changeset
  1623
        "/ 32in64
acb4e4874e4d care for ColorValue (ColorValue cyan)
ca
parents: 1347
diff changeset
  1624
acb4e4874e4d care for ColorValue (ColorValue cyan)
ca
parents: 1347
diff changeset
  1625
          #[2r10101010
acb4e4874e4d care for ColorValue (ColorValue cyan)
ca
parents: 1347
diff changeset
  1626
            2r01010101
acb4e4874e4d care for ColorValue (ColorValue cyan)
ca
parents: 1347
diff changeset
  1627
            2r10101010
acb4e4874e4d care for ColorValue (ColorValue cyan)
ca
parents: 1347
diff changeset
  1628
            2r01010101
acb4e4874e4d care for ColorValue (ColorValue cyan)
ca
parents: 1347
diff changeset
  1629
            2r10101010
acb4e4874e4d care for ColorValue (ColorValue cyan)
ca
parents: 1347
diff changeset
  1630
            2r01010101
acb4e4874e4d care for ColorValue (ColorValue cyan)
ca
parents: 1347
diff changeset
  1631
            2r10101010
acb4e4874e4d care for ColorValue (ColorValue cyan)
ca
parents: 1347
diff changeset
  1632
            2r01010101]
acb4e4874e4d care for ColorValue (ColorValue cyan)
ca
parents: 1347
diff changeset
  1633
acb4e4874e4d care for ColorValue (ColorValue cyan)
ca
parents: 1347
diff changeset
  1634
        "/ 33in64
acb4e4874e4d care for ColorValue (ColorValue cyan)
ca
parents: 1347
diff changeset
  1635
acb4e4874e4d care for ColorValue (ColorValue cyan)
ca
parents: 1347
diff changeset
  1636
          #[2r11101010
acb4e4874e4d care for ColorValue (ColorValue cyan)
ca
parents: 1347
diff changeset
  1637
            2r01010101
acb4e4874e4d care for ColorValue (ColorValue cyan)
ca
parents: 1347
diff changeset
  1638
            2r10101010
acb4e4874e4d care for ColorValue (ColorValue cyan)
ca
parents: 1347
diff changeset
  1639
            2r01010101
acb4e4874e4d care for ColorValue (ColorValue cyan)
ca
parents: 1347
diff changeset
  1640
            2r10101010
acb4e4874e4d care for ColorValue (ColorValue cyan)
ca
parents: 1347
diff changeset
  1641
            2r01010101
acb4e4874e4d care for ColorValue (ColorValue cyan)
ca
parents: 1347
diff changeset
  1642
            2r10101010
acb4e4874e4d care for ColorValue (ColorValue cyan)
ca
parents: 1347
diff changeset
  1643
            2r01010101]
acb4e4874e4d care for ColorValue (ColorValue cyan)
ca
parents: 1347
diff changeset
  1644
acb4e4874e4d care for ColorValue (ColorValue cyan)
ca
parents: 1347
diff changeset
  1645
        "/ 34in64
acb4e4874e4d care for ColorValue (ColorValue cyan)
ca
parents: 1347
diff changeset
  1646
acb4e4874e4d care for ColorValue (ColorValue cyan)
ca
parents: 1347
diff changeset
  1647
          #[2r11101010
acb4e4874e4d care for ColorValue (ColorValue cyan)
ca
parents: 1347
diff changeset
  1648
            2r01010101
acb4e4874e4d care for ColorValue (ColorValue cyan)
ca
parents: 1347
diff changeset
  1649
            2r10101010
acb4e4874e4d care for ColorValue (ColorValue cyan)
ca
parents: 1347
diff changeset
  1650
            2r01010101
acb4e4874e4d care for ColorValue (ColorValue cyan)
ca
parents: 1347
diff changeset
  1651
            2r10101110
acb4e4874e4d care for ColorValue (ColorValue cyan)
ca
parents: 1347
diff changeset
  1652
            2r01010101
acb4e4874e4d care for ColorValue (ColorValue cyan)
ca
parents: 1347
diff changeset
  1653
            2r10101010
acb4e4874e4d care for ColorValue (ColorValue cyan)
ca
parents: 1347
diff changeset
  1654
            2r01010101]
acb4e4874e4d care for ColorValue (ColorValue cyan)
ca
parents: 1347
diff changeset
  1655
acb4e4874e4d care for ColorValue (ColorValue cyan)
ca
parents: 1347
diff changeset
  1656
        "/ 35in64
acb4e4874e4d care for ColorValue (ColorValue cyan)
ca
parents: 1347
diff changeset
  1657
acb4e4874e4d care for ColorValue (ColorValue cyan)
ca
parents: 1347
diff changeset
  1658
          #[2r11101010
acb4e4874e4d care for ColorValue (ColorValue cyan)
ca
parents: 1347
diff changeset
  1659
            2r01010101
acb4e4874e4d care for ColorValue (ColorValue cyan)
ca
parents: 1347
diff changeset
  1660
            2r10101010
acb4e4874e4d care for ColorValue (ColorValue cyan)
ca
parents: 1347
diff changeset
  1661
            2r01010101
acb4e4874e4d care for ColorValue (ColorValue cyan)
ca
parents: 1347
diff changeset
  1662
            2r11101110
acb4e4874e4d care for ColorValue (ColorValue cyan)
ca
parents: 1347
diff changeset
  1663
            2r01010101
acb4e4874e4d care for ColorValue (ColorValue cyan)
ca
parents: 1347
diff changeset
  1664
            2r10101010
acb4e4874e4d care for ColorValue (ColorValue cyan)
ca
parents: 1347
diff changeset
  1665
            2r01010101]
acb4e4874e4d care for ColorValue (ColorValue cyan)
ca
parents: 1347
diff changeset
  1666
acb4e4874e4d care for ColorValue (ColorValue cyan)
ca
parents: 1347
diff changeset
  1667
        "/ 36in64
acb4e4874e4d care for ColorValue (ColorValue cyan)
ca
parents: 1347
diff changeset
  1668
acb4e4874e4d care for ColorValue (ColorValue cyan)
ca
parents: 1347
diff changeset
  1669
          #[2r11101110
acb4e4874e4d care for ColorValue (ColorValue cyan)
ca
parents: 1347
diff changeset
  1670
            2r01010101
acb4e4874e4d care for ColorValue (ColorValue cyan)
ca
parents: 1347
diff changeset
  1671
            2r10101010
acb4e4874e4d care for ColorValue (ColorValue cyan)
ca
parents: 1347
diff changeset
  1672
            2r01010101
acb4e4874e4d care for ColorValue (ColorValue cyan)
ca
parents: 1347
diff changeset
  1673
            2r11101110
acb4e4874e4d care for ColorValue (ColorValue cyan)
ca
parents: 1347
diff changeset
  1674
            2r01010101
acb4e4874e4d care for ColorValue (ColorValue cyan)
ca
parents: 1347
diff changeset
  1675
            2r10101010
acb4e4874e4d care for ColorValue (ColorValue cyan)
ca
parents: 1347
diff changeset
  1676
            2r01010101]
acb4e4874e4d care for ColorValue (ColorValue cyan)
ca
parents: 1347
diff changeset
  1677
acb4e4874e4d care for ColorValue (ColorValue cyan)
ca
parents: 1347
diff changeset
  1678
        "/ 37in64
acb4e4874e4d care for ColorValue (ColorValue cyan)
ca
parents: 1347
diff changeset
  1679
acb4e4874e4d care for ColorValue (ColorValue cyan)
ca
parents: 1347
diff changeset
  1680
          #[2r11101110
acb4e4874e4d care for ColorValue (ColorValue cyan)
ca
parents: 1347
diff changeset
  1681
            2r01010101
acb4e4874e4d care for ColorValue (ColorValue cyan)
ca
parents: 1347
diff changeset
  1682
            2r10101010
acb4e4874e4d care for ColorValue (ColorValue cyan)
ca
parents: 1347
diff changeset
  1683
            2r01010101
acb4e4874e4d care for ColorValue (ColorValue cyan)
ca
parents: 1347
diff changeset
  1684
            2r11101110
acb4e4874e4d care for ColorValue (ColorValue cyan)
ca
parents: 1347
diff changeset
  1685
            2r01010101
acb4e4874e4d care for ColorValue (ColorValue cyan)
ca
parents: 1347
diff changeset
  1686
            2r10101011
acb4e4874e4d care for ColorValue (ColorValue cyan)
ca
parents: 1347
diff changeset
  1687
            2r01010101]
acb4e4874e4d care for ColorValue (ColorValue cyan)
ca
parents: 1347
diff changeset
  1688
acb4e4874e4d care for ColorValue (ColorValue cyan)
ca
parents: 1347
diff changeset
  1689
        "/ 38in64
acb4e4874e4d care for ColorValue (ColorValue cyan)
ca
parents: 1347
diff changeset
  1690
acb4e4874e4d care for ColorValue (ColorValue cyan)
ca
parents: 1347
diff changeset
  1691
          #[2r11101110
acb4e4874e4d care for ColorValue (ColorValue cyan)
ca
parents: 1347
diff changeset
  1692
            2r01010101
acb4e4874e4d care for ColorValue (ColorValue cyan)
ca
parents: 1347
diff changeset
  1693
            2r10111010
acb4e4874e4d care for ColorValue (ColorValue cyan)
ca
parents: 1347
diff changeset
  1694
            2r01010101
acb4e4874e4d care for ColorValue (ColorValue cyan)
ca
parents: 1347
diff changeset
  1695
            2r11101110
acb4e4874e4d care for ColorValue (ColorValue cyan)
ca
parents: 1347
diff changeset
  1696
            2r01010101
acb4e4874e4d care for ColorValue (ColorValue cyan)
ca
parents: 1347
diff changeset
  1697
            2r10101011
acb4e4874e4d care for ColorValue (ColorValue cyan)
ca
parents: 1347
diff changeset
  1698
            2r01010101]
acb4e4874e4d care for ColorValue (ColorValue cyan)
ca
parents: 1347
diff changeset
  1699
acb4e4874e4d care for ColorValue (ColorValue cyan)
ca
parents: 1347
diff changeset
  1700
        "/ 39in64
acb4e4874e4d care for ColorValue (ColorValue cyan)
ca
parents: 1347
diff changeset
  1701
acb4e4874e4d care for ColorValue (ColorValue cyan)
ca
parents: 1347
diff changeset
  1702
          #[2r11101110
acb4e4874e4d care for ColorValue (ColorValue cyan)
ca
parents: 1347
diff changeset
  1703
            2r01010101
acb4e4874e4d care for ColorValue (ColorValue cyan)
ca
parents: 1347
diff changeset
  1704
            2r10111011
acb4e4874e4d care for ColorValue (ColorValue cyan)
ca
parents: 1347
diff changeset
  1705
            2r01010101
acb4e4874e4d care for ColorValue (ColorValue cyan)
ca
parents: 1347
diff changeset
  1706
            2r11101110
acb4e4874e4d care for ColorValue (ColorValue cyan)
ca
parents: 1347
diff changeset
  1707
            2r01010101
acb4e4874e4d care for ColorValue (ColorValue cyan)
ca
parents: 1347
diff changeset
  1708
            2r10101011
acb4e4874e4d care for ColorValue (ColorValue cyan)
ca
parents: 1347
diff changeset
  1709
            2r01010101]
acb4e4874e4d care for ColorValue (ColorValue cyan)
ca
parents: 1347
diff changeset
  1710
acb4e4874e4d care for ColorValue (ColorValue cyan)
ca
parents: 1347
diff changeset
  1711
        "/ 40in64
acb4e4874e4d care for ColorValue (ColorValue cyan)
ca
parents: 1347
diff changeset
  1712
acb4e4874e4d care for ColorValue (ColorValue cyan)
ca
parents: 1347
diff changeset
  1713
          #[2r11101110
acb4e4874e4d care for ColorValue (ColorValue cyan)
ca
parents: 1347
diff changeset
  1714
            2r01010101
acb4e4874e4d care for ColorValue (ColorValue cyan)
ca
parents: 1347
diff changeset
  1715
            2r10111011
acb4e4874e4d care for ColorValue (ColorValue cyan)
ca
parents: 1347
diff changeset
  1716
            2r01010101
acb4e4874e4d care for ColorValue (ColorValue cyan)
ca
parents: 1347
diff changeset
  1717
            2r11101110
acb4e4874e4d care for ColorValue (ColorValue cyan)
ca
parents: 1347
diff changeset
  1718
            2r01010101
acb4e4874e4d care for ColorValue (ColorValue cyan)
ca
parents: 1347
diff changeset
  1719
            2r10111011
acb4e4874e4d care for ColorValue (ColorValue cyan)
ca
parents: 1347
diff changeset
  1720
            2r01010101]
acb4e4874e4d care for ColorValue (ColorValue cyan)
ca
parents: 1347
diff changeset
  1721
acb4e4874e4d care for ColorValue (ColorValue cyan)
ca
parents: 1347
diff changeset
  1722
        "/ 41in64
acb4e4874e4d care for ColorValue (ColorValue cyan)
ca
parents: 1347
diff changeset
  1723
acb4e4874e4d care for ColorValue (ColorValue cyan)
ca
parents: 1347
diff changeset
  1724
          #[2r11101110
acb4e4874e4d care for ColorValue (ColorValue cyan)
ca
parents: 1347
diff changeset
  1725
            2r01010101
acb4e4874e4d care for ColorValue (ColorValue cyan)
ca
parents: 1347
diff changeset
  1726
            2r10111011
acb4e4874e4d care for ColorValue (ColorValue cyan)
ca
parents: 1347
diff changeset
  1727
            2r01010101
acb4e4874e4d care for ColorValue (ColorValue cyan)
ca
parents: 1347
diff changeset
  1728
            2r11101110
acb4e4874e4d care for ColorValue (ColorValue cyan)
ca
parents: 1347
diff changeset
  1729
            2r01010101
acb4e4874e4d care for ColorValue (ColorValue cyan)
ca
parents: 1347
diff changeset
  1730
            2r11111011
acb4e4874e4d care for ColorValue (ColorValue cyan)
ca
parents: 1347
diff changeset
  1731
            2r01010101]
acb4e4874e4d care for ColorValue (ColorValue cyan)
ca
parents: 1347
diff changeset
  1732
acb4e4874e4d care for ColorValue (ColorValue cyan)
ca
parents: 1347
diff changeset
  1733
        "/ 42in64
acb4e4874e4d care for ColorValue (ColorValue cyan)
ca
parents: 1347
diff changeset
  1734
acb4e4874e4d care for ColorValue (ColorValue cyan)
ca
parents: 1347
diff changeset
  1735
          #[2r11101110
acb4e4874e4d care for ColorValue (ColorValue cyan)
ca
parents: 1347
diff changeset
  1736
            2r01010101
acb4e4874e4d care for ColorValue (ColorValue cyan)
ca
parents: 1347
diff changeset
  1737
            2r10111111
acb4e4874e4d care for ColorValue (ColorValue cyan)
ca
parents: 1347
diff changeset
  1738
            2r01010101
acb4e4874e4d care for ColorValue (ColorValue cyan)
ca
parents: 1347
diff changeset
  1739
            2r11101110
acb4e4874e4d care for ColorValue (ColorValue cyan)
ca
parents: 1347
diff changeset
  1740
            2r01010101
acb4e4874e4d care for ColorValue (ColorValue cyan)
ca
parents: 1347
diff changeset
  1741
            2r11111011
acb4e4874e4d care for ColorValue (ColorValue cyan)
ca
parents: 1347
diff changeset
  1742
            2r01010101]
acb4e4874e4d care for ColorValue (ColorValue cyan)
ca
parents: 1347
diff changeset
  1743
acb4e4874e4d care for ColorValue (ColorValue cyan)
ca
parents: 1347
diff changeset
  1744
        "/ 43in64
acb4e4874e4d care for ColorValue (ColorValue cyan)
ca
parents: 1347
diff changeset
  1745
acb4e4874e4d care for ColorValue (ColorValue cyan)
ca
parents: 1347
diff changeset
  1746
          #[2r11101110
acb4e4874e4d care for ColorValue (ColorValue cyan)
ca
parents: 1347
diff changeset
  1747
            2r01010101
acb4e4874e4d care for ColorValue (ColorValue cyan)
ca
parents: 1347
diff changeset
  1748
            2r10111111
acb4e4874e4d care for ColorValue (ColorValue cyan)
ca
parents: 1347
diff changeset
  1749
            2r01010101
acb4e4874e4d care for ColorValue (ColorValue cyan)
ca
parents: 1347
diff changeset
  1750
            2r11101110
acb4e4874e4d care for ColorValue (ColorValue cyan)
ca
parents: 1347
diff changeset
  1751
            2r01010101
acb4e4874e4d care for ColorValue (ColorValue cyan)
ca
parents: 1347
diff changeset
  1752
            2r11111111
acb4e4874e4d care for ColorValue (ColorValue cyan)
ca
parents: 1347
diff changeset
  1753
            2r01010101]
acb4e4874e4d care for ColorValue (ColorValue cyan)
ca
parents: 1347
diff changeset
  1754
acb4e4874e4d care for ColorValue (ColorValue cyan)
ca
parents: 1347
diff changeset
  1755
        "/ 44in64
acb4e4874e4d care for ColorValue (ColorValue cyan)
ca
parents: 1347
diff changeset
  1756
acb4e4874e4d care for ColorValue (ColorValue cyan)
ca
parents: 1347
diff changeset
  1757
          #[2r11101110
acb4e4874e4d care for ColorValue (ColorValue cyan)
ca
parents: 1347
diff changeset
  1758
            2r01010101
acb4e4874e4d care for ColorValue (ColorValue cyan)
ca
parents: 1347
diff changeset
  1759
            2r11111111
acb4e4874e4d care for ColorValue (ColorValue cyan)
ca
parents: 1347
diff changeset
  1760
            2r01010101
acb4e4874e4d care for ColorValue (ColorValue cyan)
ca
parents: 1347
diff changeset
  1761
            2r11101110
acb4e4874e4d care for ColorValue (ColorValue cyan)
ca
parents: 1347
diff changeset
  1762
            2r01010101
acb4e4874e4d care for ColorValue (ColorValue cyan)
ca
parents: 1347
diff changeset
  1763
            2r11111111
acb4e4874e4d care for ColorValue (ColorValue cyan)
ca
parents: 1347
diff changeset
  1764
            2r01010101]
acb4e4874e4d care for ColorValue (ColorValue cyan)
ca
parents: 1347
diff changeset
  1765
acb4e4874e4d care for ColorValue (ColorValue cyan)
ca
parents: 1347
diff changeset
  1766
        "/ 45in64
acb4e4874e4d care for ColorValue (ColorValue cyan)
ca
parents: 1347
diff changeset
  1767
acb4e4874e4d care for ColorValue (ColorValue cyan)
ca
parents: 1347
diff changeset
  1768
          #[2r11101110
acb4e4874e4d care for ColorValue (ColorValue cyan)
ca
parents: 1347
diff changeset
  1769
            2r01010101
acb4e4874e4d care for ColorValue (ColorValue cyan)
ca
parents: 1347
diff changeset
  1770
            2r11111111
acb4e4874e4d care for ColorValue (ColorValue cyan)
ca
parents: 1347
diff changeset
  1771
            2r01010101
acb4e4874e4d care for ColorValue (ColorValue cyan)
ca
parents: 1347
diff changeset
  1772
            2r11111110
acb4e4874e4d care for ColorValue (ColorValue cyan)
ca
parents: 1347
diff changeset
  1773
            2r01010101
acb4e4874e4d care for ColorValue (ColorValue cyan)
ca
parents: 1347
diff changeset
  1774
            2r11111111
acb4e4874e4d care for ColorValue (ColorValue cyan)
ca
parents: 1347
diff changeset
  1775
            2r01010101]
acb4e4874e4d care for ColorValue (ColorValue cyan)
ca
parents: 1347
diff changeset
  1776
acb4e4874e4d care for ColorValue (ColorValue cyan)
ca
parents: 1347
diff changeset
  1777
        "/ 46in64
acb4e4874e4d care for ColorValue (ColorValue cyan)
ca
parents: 1347
diff changeset
  1778
acb4e4874e4d care for ColorValue (ColorValue cyan)
ca
parents: 1347
diff changeset
  1779
          #[2r11101111
acb4e4874e4d care for ColorValue (ColorValue cyan)
ca
parents: 1347
diff changeset
  1780
            2r01010101
acb4e4874e4d care for ColorValue (ColorValue cyan)
ca
parents: 1347
diff changeset
  1781
            2r11111111
acb4e4874e4d care for ColorValue (ColorValue cyan)
ca
parents: 1347
diff changeset
  1782
            2r01010101
acb4e4874e4d care for ColorValue (ColorValue cyan)
ca
parents: 1347
diff changeset
  1783
            2r11111110
acb4e4874e4d care for ColorValue (ColorValue cyan)
ca
parents: 1347
diff changeset
  1784
            2r01010101
acb4e4874e4d care for ColorValue (ColorValue cyan)
ca
parents: 1347
diff changeset
  1785
            2r11111111
acb4e4874e4d care for ColorValue (ColorValue cyan)
ca
parents: 1347
diff changeset
  1786
            2r01010101]
acb4e4874e4d care for ColorValue (ColorValue cyan)
ca
parents: 1347
diff changeset
  1787
acb4e4874e4d care for ColorValue (ColorValue cyan)
ca
parents: 1347
diff changeset
  1788
        "/ 47in64
acb4e4874e4d care for ColorValue (ColorValue cyan)
ca
parents: 1347
diff changeset
  1789
acb4e4874e4d care for ColorValue (ColorValue cyan)
ca
parents: 1347
diff changeset
  1790
          #[2r11101111
acb4e4874e4d care for ColorValue (ColorValue cyan)
ca
parents: 1347
diff changeset
  1791
            2r01010101
acb4e4874e4d care for ColorValue (ColorValue cyan)
ca
parents: 1347
diff changeset
  1792
            2r11111111
acb4e4874e4d care for ColorValue (ColorValue cyan)
ca
parents: 1347
diff changeset
  1793
            2r01010101
acb4e4874e4d care for ColorValue (ColorValue cyan)
ca
parents: 1347
diff changeset
  1794
            2r11111111
acb4e4874e4d care for ColorValue (ColorValue cyan)
ca
parents: 1347
diff changeset
  1795
            2r01010101
acb4e4874e4d care for ColorValue (ColorValue cyan)
ca
parents: 1347
diff changeset
  1796
            2r11111111
acb4e4874e4d care for ColorValue (ColorValue cyan)
ca
parents: 1347
diff changeset
  1797
            2r01010101]
acb4e4874e4d care for ColorValue (ColorValue cyan)
ca
parents: 1347
diff changeset
  1798
acb4e4874e4d care for ColorValue (ColorValue cyan)
ca
parents: 1347
diff changeset
  1799
        "/ 48in64
acb4e4874e4d care for ColorValue (ColorValue cyan)
ca
parents: 1347
diff changeset
  1800
acb4e4874e4d care for ColorValue (ColorValue cyan)
ca
parents: 1347
diff changeset
  1801
          #[2r11111111
acb4e4874e4d care for ColorValue (ColorValue cyan)
ca
parents: 1347
diff changeset
  1802
            2r01010101
acb4e4874e4d care for ColorValue (ColorValue cyan)
ca
parents: 1347
diff changeset
  1803
            2r11111111
acb4e4874e4d care for ColorValue (ColorValue cyan)
ca
parents: 1347
diff changeset
  1804
            2r01010101
acb4e4874e4d care for ColorValue (ColorValue cyan)
ca
parents: 1347
diff changeset
  1805
            2r11111111
acb4e4874e4d care for ColorValue (ColorValue cyan)
ca
parents: 1347
diff changeset
  1806
            2r01010101
acb4e4874e4d care for ColorValue (ColorValue cyan)
ca
parents: 1347
diff changeset
  1807
            2r11111111
acb4e4874e4d care for ColorValue (ColorValue cyan)
ca
parents: 1347
diff changeset
  1808
            2r01010101]
acb4e4874e4d care for ColorValue (ColorValue cyan)
ca
parents: 1347
diff changeset
  1809
acb4e4874e4d care for ColorValue (ColorValue cyan)
ca
parents: 1347
diff changeset
  1810
        "/ 49in64
acb4e4874e4d care for ColorValue (ColorValue cyan)
ca
parents: 1347
diff changeset
  1811
acb4e4874e4d care for ColorValue (ColorValue cyan)
ca
parents: 1347
diff changeset
  1812
          #[2r11111111
acb4e4874e4d care for ColorValue (ColorValue cyan)
ca
parents: 1347
diff changeset
  1813
            2r01110101
acb4e4874e4d care for ColorValue (ColorValue cyan)
ca
parents: 1347
diff changeset
  1814
            2r11111111
acb4e4874e4d care for ColorValue (ColorValue cyan)
ca
parents: 1347
diff changeset
  1815
            2r01010101
acb4e4874e4d care for ColorValue (ColorValue cyan)
ca
parents: 1347
diff changeset
  1816
            2r11111111
acb4e4874e4d care for ColorValue (ColorValue cyan)
ca
parents: 1347
diff changeset
  1817
            2r01010101
acb4e4874e4d care for ColorValue (ColorValue cyan)
ca
parents: 1347
diff changeset
  1818
            2r11111111
acb4e4874e4d care for ColorValue (ColorValue cyan)
ca
parents: 1347
diff changeset
  1819
            2r01010101]
acb4e4874e4d care for ColorValue (ColorValue cyan)
ca
parents: 1347
diff changeset
  1820
acb4e4874e4d care for ColorValue (ColorValue cyan)
ca
parents: 1347
diff changeset
  1821
        "/ 50in64
acb4e4874e4d care for ColorValue (ColorValue cyan)
ca
parents: 1347
diff changeset
  1822
acb4e4874e4d care for ColorValue (ColorValue cyan)
ca
parents: 1347
diff changeset
  1823
          #[2r11111111
acb4e4874e4d care for ColorValue (ColorValue cyan)
ca
parents: 1347
diff changeset
  1824
            2r01110101
acb4e4874e4d care for ColorValue (ColorValue cyan)
ca
parents: 1347
diff changeset
  1825
            2r11111111
acb4e4874e4d care for ColorValue (ColorValue cyan)
ca
parents: 1347
diff changeset
  1826
            2r01010101
acb4e4874e4d care for ColorValue (ColorValue cyan)
ca
parents: 1347
diff changeset
  1827
            2r11111111
acb4e4874e4d care for ColorValue (ColorValue cyan)
ca
parents: 1347
diff changeset
  1828
            2r01010111
acb4e4874e4d care for ColorValue (ColorValue cyan)
ca
parents: 1347
diff changeset
  1829
            2r11111111
acb4e4874e4d care for ColorValue (ColorValue cyan)
ca
parents: 1347
diff changeset
  1830
            2r01010101]
acb4e4874e4d care for ColorValue (ColorValue cyan)
ca
parents: 1347
diff changeset
  1831
acb4e4874e4d care for ColorValue (ColorValue cyan)
ca
parents: 1347
diff changeset
  1832
        "/ 51in64
acb4e4874e4d care for ColorValue (ColorValue cyan)
ca
parents: 1347
diff changeset
  1833
acb4e4874e4d care for ColorValue (ColorValue cyan)
ca
parents: 1347
diff changeset
  1834
          #[2r11111111
acb4e4874e4d care for ColorValue (ColorValue cyan)
ca
parents: 1347
diff changeset
  1835
            2r01110101
acb4e4874e4d care for ColorValue (ColorValue cyan)
ca
parents: 1347
diff changeset
  1836
            2r11111111
acb4e4874e4d care for ColorValue (ColorValue cyan)
ca
parents: 1347
diff changeset
  1837
            2r01010101
acb4e4874e4d care for ColorValue (ColorValue cyan)
ca
parents: 1347
diff changeset
  1838
            2r11111111
acb4e4874e4d care for ColorValue (ColorValue cyan)
ca
parents: 1347
diff changeset
  1839
            2r01110111
acb4e4874e4d care for ColorValue (ColorValue cyan)
ca
parents: 1347
diff changeset
  1840
            2r11111111
acb4e4874e4d care for ColorValue (ColorValue cyan)
ca
parents: 1347
diff changeset
  1841
            2r01010101]
acb4e4874e4d care for ColorValue (ColorValue cyan)
ca
parents: 1347
diff changeset
  1842
acb4e4874e4d care for ColorValue (ColorValue cyan)
ca
parents: 1347
diff changeset
  1843
        "/ 52in64
acb4e4874e4d care for ColorValue (ColorValue cyan)
ca
parents: 1347
diff changeset
  1844
acb4e4874e4d care for ColorValue (ColorValue cyan)
ca
parents: 1347
diff changeset
  1845
          #[2r11111111
acb4e4874e4d care for ColorValue (ColorValue cyan)
ca
parents: 1347
diff changeset
  1846
            2r01110111
acb4e4874e4d care for ColorValue (ColorValue cyan)
ca
parents: 1347
diff changeset
  1847
            2r11111111
acb4e4874e4d care for ColorValue (ColorValue cyan)
ca
parents: 1347
diff changeset
  1848
            2r01010101
acb4e4874e4d care for ColorValue (ColorValue cyan)
ca
parents: 1347
diff changeset
  1849
            2r11111111
acb4e4874e4d care for ColorValue (ColorValue cyan)
ca
parents: 1347
diff changeset
  1850
            2r01110111
acb4e4874e4d care for ColorValue (ColorValue cyan)
ca
parents: 1347
diff changeset
  1851
            2r11111111
acb4e4874e4d care for ColorValue (ColorValue cyan)
ca
parents: 1347
diff changeset
  1852
            2r01010101]
acb4e4874e4d care for ColorValue (ColorValue cyan)
ca
parents: 1347
diff changeset
  1853
acb4e4874e4d care for ColorValue (ColorValue cyan)
ca
parents: 1347
diff changeset
  1854
        "/ 53in64
acb4e4874e4d care for ColorValue (ColorValue cyan)
ca
parents: 1347
diff changeset
  1855
acb4e4874e4d care for ColorValue (ColorValue cyan)
ca
parents: 1347
diff changeset
  1856
          #[2r11111111
acb4e4874e4d care for ColorValue (ColorValue cyan)
ca
parents: 1347
diff changeset
  1857
            2r01110111
acb4e4874e4d care for ColorValue (ColorValue cyan)
ca
parents: 1347
diff changeset
  1858
            2r11111111
acb4e4874e4d care for ColorValue (ColorValue cyan)
ca
parents: 1347
diff changeset
  1859
            2r01010101
acb4e4874e4d care for ColorValue (ColorValue cyan)
ca
parents: 1347
diff changeset
  1860
            2r11111111
acb4e4874e4d care for ColorValue (ColorValue cyan)
ca
parents: 1347
diff changeset
  1861
            2r01110111
acb4e4874e4d care for ColorValue (ColorValue cyan)
ca
parents: 1347
diff changeset
  1862
            2r11111111
acb4e4874e4d care for ColorValue (ColorValue cyan)
ca
parents: 1347
diff changeset
  1863
            2r11010101]
acb4e4874e4d care for ColorValue (ColorValue cyan)
ca
parents: 1347
diff changeset
  1864
acb4e4874e4d care for ColorValue (ColorValue cyan)
ca
parents: 1347
diff changeset
  1865
        "/ 54in64
acb4e4874e4d care for ColorValue (ColorValue cyan)
ca
parents: 1347
diff changeset
  1866
acb4e4874e4d care for ColorValue (ColorValue cyan)
ca
parents: 1347
diff changeset
  1867
          #[2r11111111
acb4e4874e4d care for ColorValue (ColorValue cyan)
ca
parents: 1347
diff changeset
  1868
            2r01110111
acb4e4874e4d care for ColorValue (ColorValue cyan)
ca
parents: 1347
diff changeset
  1869
            2r11111111
acb4e4874e4d care for ColorValue (ColorValue cyan)
ca
parents: 1347
diff changeset
  1870
            2r01011101
acb4e4874e4d care for ColorValue (ColorValue cyan)
ca
parents: 1347
diff changeset
  1871
            2r11111111
acb4e4874e4d care for ColorValue (ColorValue cyan)
ca
parents: 1347
diff changeset
  1872
            2r01110111
acb4e4874e4d care for ColorValue (ColorValue cyan)
ca
parents: 1347
diff changeset
  1873
            2r11111111
acb4e4874e4d care for ColorValue (ColorValue cyan)
ca
parents: 1347
diff changeset
  1874
            2r11010101]
acb4e4874e4d care for ColorValue (ColorValue cyan)
ca
parents: 1347
diff changeset
  1875
acb4e4874e4d care for ColorValue (ColorValue cyan)
ca
parents: 1347
diff changeset
  1876
        "/ 55in64
acb4e4874e4d care for ColorValue (ColorValue cyan)
ca
parents: 1347
diff changeset
  1877
acb4e4874e4d care for ColorValue (ColorValue cyan)
ca
parents: 1347
diff changeset
  1878
          #[2r11111111
acb4e4874e4d care for ColorValue (ColorValue cyan)
ca
parents: 1347
diff changeset
  1879
            2r01110111
acb4e4874e4d care for ColorValue (ColorValue cyan)
ca
parents: 1347
diff changeset
  1880
            2r11111111
acb4e4874e4d care for ColorValue (ColorValue cyan)
ca
parents: 1347
diff changeset
  1881
            2r11011101
acb4e4874e4d care for ColorValue (ColorValue cyan)
ca
parents: 1347
diff changeset
  1882
            2r11111111
acb4e4874e4d care for ColorValue (ColorValue cyan)
ca
parents: 1347
diff changeset
  1883
            2r01110111
acb4e4874e4d care for ColorValue (ColorValue cyan)
ca
parents: 1347
diff changeset
  1884
            2r11111111
acb4e4874e4d care for ColorValue (ColorValue cyan)
ca
parents: 1347
diff changeset
  1885
            2r11010101]
acb4e4874e4d care for ColorValue (ColorValue cyan)
ca
parents: 1347
diff changeset
  1886
acb4e4874e4d care for ColorValue (ColorValue cyan)
ca
parents: 1347
diff changeset
  1887
        "/ 56in64
acb4e4874e4d care for ColorValue (ColorValue cyan)
ca
parents: 1347
diff changeset
  1888
acb4e4874e4d care for ColorValue (ColorValue cyan)
ca
parents: 1347
diff changeset
  1889
          #[2r11111111
acb4e4874e4d care for ColorValue (ColorValue cyan)
ca
parents: 1347
diff changeset
  1890
            2r01110111
acb4e4874e4d care for ColorValue (ColorValue cyan)
ca
parents: 1347
diff changeset
  1891
            2r11111111
acb4e4874e4d care for ColorValue (ColorValue cyan)
ca
parents: 1347
diff changeset
  1892
            2r11011101
acb4e4874e4d care for ColorValue (ColorValue cyan)
ca
parents: 1347
diff changeset
  1893
            2r11111111
acb4e4874e4d care for ColorValue (ColorValue cyan)
ca
parents: 1347
diff changeset
  1894
            2r01110111
acb4e4874e4d care for ColorValue (ColorValue cyan)
ca
parents: 1347
diff changeset
  1895
            2r11111111
acb4e4874e4d care for ColorValue (ColorValue cyan)
ca
parents: 1347
diff changeset
  1896
            2r11011101]
acb4e4874e4d care for ColorValue (ColorValue cyan)
ca
parents: 1347
diff changeset
  1897
acb4e4874e4d care for ColorValue (ColorValue cyan)
ca
parents: 1347
diff changeset
  1898
        "/ 57in64
acb4e4874e4d care for ColorValue (ColorValue cyan)
ca
parents: 1347
diff changeset
  1899
acb4e4874e4d care for ColorValue (ColorValue cyan)
ca
parents: 1347
diff changeset
  1900
          #[2r11111111
acb4e4874e4d care for ColorValue (ColorValue cyan)
ca
parents: 1347
diff changeset
  1901
            2r01110111
acb4e4874e4d care for ColorValue (ColorValue cyan)
ca
parents: 1347
diff changeset
  1902
            2r11111111
acb4e4874e4d care for ColorValue (ColorValue cyan)
ca
parents: 1347
diff changeset
  1903
            2r11011101
acb4e4874e4d care for ColorValue (ColorValue cyan)
ca
parents: 1347
diff changeset
  1904
            2r11111111
acb4e4874e4d care for ColorValue (ColorValue cyan)
ca
parents: 1347
diff changeset
  1905
            2r01110111
acb4e4874e4d care for ColorValue (ColorValue cyan)
ca
parents: 1347
diff changeset
  1906
            2r11111111
acb4e4874e4d care for ColorValue (ColorValue cyan)
ca
parents: 1347
diff changeset
  1907
            2r11111101]
acb4e4874e4d care for ColorValue (ColorValue cyan)
ca
parents: 1347
diff changeset
  1908
acb4e4874e4d care for ColorValue (ColorValue cyan)
ca
parents: 1347
diff changeset
  1909
        "/ 58in64
acb4e4874e4d care for ColorValue (ColorValue cyan)
ca
parents: 1347
diff changeset
  1910
acb4e4874e4d care for ColorValue (ColorValue cyan)
ca
parents: 1347
diff changeset
  1911
          #[2r11111111
acb4e4874e4d care for ColorValue (ColorValue cyan)
ca
parents: 1347
diff changeset
  1912
            2r01110111
acb4e4874e4d care for ColorValue (ColorValue cyan)
ca
parents: 1347
diff changeset
  1913
            2r11111111
acb4e4874e4d care for ColorValue (ColorValue cyan)
ca
parents: 1347
diff changeset
  1914
            2r11011111
acb4e4874e4d care for ColorValue (ColorValue cyan)
ca
parents: 1347
diff changeset
  1915
            2r11111111
acb4e4874e4d care for ColorValue (ColorValue cyan)
ca
parents: 1347
diff changeset
  1916
            2r01110111
acb4e4874e4d care for ColorValue (ColorValue cyan)
ca
parents: 1347
diff changeset
  1917
            2r11111111
acb4e4874e4d care for ColorValue (ColorValue cyan)
ca
parents: 1347
diff changeset
  1918
            2r11111101]
acb4e4874e4d care for ColorValue (ColorValue cyan)
ca
parents: 1347
diff changeset
  1919
acb4e4874e4d care for ColorValue (ColorValue cyan)
ca
parents: 1347
diff changeset
  1920
        "/ 59in64
acb4e4874e4d care for ColorValue (ColorValue cyan)
ca
parents: 1347
diff changeset
  1921
acb4e4874e4d care for ColorValue (ColorValue cyan)
ca
parents: 1347
diff changeset
  1922
          #[2r11111111
acb4e4874e4d care for ColorValue (ColorValue cyan)
ca
parents: 1347
diff changeset
  1923
            2r01110111
acb4e4874e4d care for ColorValue (ColorValue cyan)
ca
parents: 1347
diff changeset
  1924
            2r11111111
acb4e4874e4d care for ColorValue (ColorValue cyan)
ca
parents: 1347
diff changeset
  1925
            2r11011111
acb4e4874e4d care for ColorValue (ColorValue cyan)
ca
parents: 1347
diff changeset
  1926
            2r11111111
acb4e4874e4d care for ColorValue (ColorValue cyan)
ca
parents: 1347
diff changeset
  1927
            2r01110111
acb4e4874e4d care for ColorValue (ColorValue cyan)
ca
parents: 1347
diff changeset
  1928
            2r11111111
acb4e4874e4d care for ColorValue (ColorValue cyan)
ca
parents: 1347
diff changeset
  1929
            2r11111111]
acb4e4874e4d care for ColorValue (ColorValue cyan)
ca
parents: 1347
diff changeset
  1930
acb4e4874e4d care for ColorValue (ColorValue cyan)
ca
parents: 1347
diff changeset
  1931
        "/ 60in64
acb4e4874e4d care for ColorValue (ColorValue cyan)
ca
parents: 1347
diff changeset
  1932
acb4e4874e4d care for ColorValue (ColorValue cyan)
ca
parents: 1347
diff changeset
  1933
          #[2r11111111
acb4e4874e4d care for ColorValue (ColorValue cyan)
ca
parents: 1347
diff changeset
  1934
            2r01110111
acb4e4874e4d care for ColorValue (ColorValue cyan)
ca
parents: 1347
diff changeset
  1935
            2r11111111
acb4e4874e4d care for ColorValue (ColorValue cyan)
ca
parents: 1347
diff changeset
  1936
            2r11111111
acb4e4874e4d care for ColorValue (ColorValue cyan)
ca
parents: 1347
diff changeset
  1937
            2r11111111
acb4e4874e4d care for ColorValue (ColorValue cyan)
ca
parents: 1347
diff changeset
  1938
            2r01110111
acb4e4874e4d care for ColorValue (ColorValue cyan)
ca
parents: 1347
diff changeset
  1939
            2r11111111
acb4e4874e4d care for ColorValue (ColorValue cyan)
ca
parents: 1347
diff changeset
  1940
            2r11111111]
acb4e4874e4d care for ColorValue (ColorValue cyan)
ca
parents: 1347
diff changeset
  1941
acb4e4874e4d care for ColorValue (ColorValue cyan)
ca
parents: 1347
diff changeset
  1942
        "/ 61in64
acb4e4874e4d care for ColorValue (ColorValue cyan)
ca
parents: 1347
diff changeset
  1943
acb4e4874e4d care for ColorValue (ColorValue cyan)
ca
parents: 1347
diff changeset
  1944
          #[2r11111111
acb4e4874e4d care for ColorValue (ColorValue cyan)
ca
parents: 1347
diff changeset
  1945
            2r01110111
acb4e4874e4d care for ColorValue (ColorValue cyan)
ca
parents: 1347
diff changeset
  1946
            2r11111111
acb4e4874e4d care for ColorValue (ColorValue cyan)
ca
parents: 1347
diff changeset
  1947
            2r11111111
acb4e4874e4d care for ColorValue (ColorValue cyan)
ca
parents: 1347
diff changeset
  1948
            2r11111111
acb4e4874e4d care for ColorValue (ColorValue cyan)
ca
parents: 1347
diff changeset
  1949
            2r01111111
acb4e4874e4d care for ColorValue (ColorValue cyan)
ca
parents: 1347
diff changeset
  1950
            2r11111111
acb4e4874e4d care for ColorValue (ColorValue cyan)
ca
parents: 1347
diff changeset
  1951
            2r11111111]
acb4e4874e4d care for ColorValue (ColorValue cyan)
ca
parents: 1347
diff changeset
  1952
acb4e4874e4d care for ColorValue (ColorValue cyan)
ca
parents: 1347
diff changeset
  1953
        "/ 62in64
acb4e4874e4d care for ColorValue (ColorValue cyan)
ca
parents: 1347
diff changeset
  1954
acb4e4874e4d care for ColorValue (ColorValue cyan)
ca
parents: 1347
diff changeset
  1955
          #[2r11111111
acb4e4874e4d care for ColorValue (ColorValue cyan)
ca
parents: 1347
diff changeset
  1956
            2r11110111
acb4e4874e4d care for ColorValue (ColorValue cyan)
ca
parents: 1347
diff changeset
  1957
            2r11111111
acb4e4874e4d care for ColorValue (ColorValue cyan)
ca
parents: 1347
diff changeset
  1958
            2r11111111
acb4e4874e4d care for ColorValue (ColorValue cyan)
ca
parents: 1347
diff changeset
  1959
            2r11111111
acb4e4874e4d care for ColorValue (ColorValue cyan)
ca
parents: 1347
diff changeset
  1960
            2r01111111
acb4e4874e4d care for ColorValue (ColorValue cyan)
ca
parents: 1347
diff changeset
  1961
            2r11111111
acb4e4874e4d care for ColorValue (ColorValue cyan)
ca
parents: 1347
diff changeset
  1962
            2r11111111]
acb4e4874e4d care for ColorValue (ColorValue cyan)
ca
parents: 1347
diff changeset
  1963
acb4e4874e4d care for ColorValue (ColorValue cyan)
ca
parents: 1347
diff changeset
  1964
        "/ 63in64
acb4e4874e4d care for ColorValue (ColorValue cyan)
ca
parents: 1347
diff changeset
  1965
acb4e4874e4d care for ColorValue (ColorValue cyan)
ca
parents: 1347
diff changeset
  1966
          #[2r11111111
acb4e4874e4d care for ColorValue (ColorValue cyan)
ca
parents: 1347
diff changeset
  1967
            2r11110111
acb4e4874e4d care for ColorValue (ColorValue cyan)
ca
parents: 1347
diff changeset
  1968
            2r11111111
acb4e4874e4d care for ColorValue (ColorValue cyan)
ca
parents: 1347
diff changeset
  1969
            2r11111111
acb4e4874e4d care for ColorValue (ColorValue cyan)
ca
parents: 1347
diff changeset
  1970
            2r11111111
acb4e4874e4d care for ColorValue (ColorValue cyan)
ca
parents: 1347
diff changeset
  1971
            2r11111111
acb4e4874e4d care for ColorValue (ColorValue cyan)
ca
parents: 1347
diff changeset
  1972
            2r11111111
acb4e4874e4d care for ColorValue (ColorValue cyan)
ca
parents: 1347
diff changeset
  1973
            2r11111111]
1023
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
  1974
     )
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
  1975
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
  1976
    "Modified: 23.4.1996 / 13:31:50 / cg"
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
  1977
    "Created: 11.6.1996 / 15:34:29 / cg"
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
  1978
!
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
  1979
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
  1980
existingColorRed:r green:g blue:b on:aDevice
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
  1981
    "return a device color on aDevice with rgb values
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
  1982
     if there is one, nil otherwise."
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
  1983
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
  1984
    ^ self existingColorScaledRed:(r * MaxValue // 100)
1348
acb4e4874e4d care for ColorValue (ColorValue cyan)
ca
parents: 1347
diff changeset
  1985
                        scaledGreen:(g * MaxValue // 100)
acb4e4874e4d care for ColorValue (ColorValue cyan)
ca
parents: 1347
diff changeset
  1986
                        scaledBlue:(b * MaxValue // 100)
1023
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
  1987
!
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
  1988
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
  1989
existingColorScaledRed:r scaledGreen:g scaledBlue:b on:aDevice
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
  1990
    "return a device color on aDevice with rgb values
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
  1991
     if there is one, nil otherwise."
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
  1992
1365
37a9e7ac4dbc moved color registration from Color class to per-device lobby
Claus Gittinger <cg@exept.de>
parents: 1348
diff changeset
  1993
    aDevice deviceColors do:[:aColor |
1348
acb4e4874e4d care for ColorValue (ColorValue cyan)
ca
parents: 1347
diff changeset
  1994
        (r == aColor scaledRed) ifTrue:[
acb4e4874e4d care for ColorValue (ColorValue cyan)
ca
parents: 1347
diff changeset
  1995
            (g == aColor scaledGreen) ifTrue:[
acb4e4874e4d care for ColorValue (ColorValue cyan)
ca
parents: 1347
diff changeset
  1996
                (b == aColor scaledBlue) ifTrue:[
1365
37a9e7ac4dbc moved color registration from Color class to per-device lobby
Claus Gittinger <cg@exept.de>
parents: 1348
diff changeset
  1997
                    ^ aColor
1348
acb4e4874e4d care for ColorValue (ColorValue cyan)
ca
parents: 1347
diff changeset
  1998
                ]
acb4e4874e4d care for ColorValue (ColorValue cyan)
ca
parents: 1347
diff changeset
  1999
            ]
acb4e4874e4d care for ColorValue (ColorValue cyan)
ca
parents: 1347
diff changeset
  2000
        ]
1023
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
  2001
    ].
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
  2002
    ^ nil
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
  2003
1365
37a9e7ac4dbc moved color registration from Color class to per-device lobby
Claus Gittinger <cg@exept.de>
parents: 1348
diff changeset
  2004
    "Modified: 24.2.1997 / 18:17:35 / cg"
1023
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
  2005
! !
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
  2006
1144
07f3de59864d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1023
diff changeset
  2007
!Color class methodsFor:'queries'!
1023
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
  2008
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
  2009
constantNames
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
  2010
    "return names known as instance creation messages"
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
  2011
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
  2012
    ^ #(white black 
1348
acb4e4874e4d care for ColorValue (ColorValue cyan)
ca
parents: 1347
diff changeset
  2013
        grey mediumGrey veryLightGrey lightGrey darkGrey veryDarkGrey
acb4e4874e4d care for ColorValue (ColorValue cyan)
ca
parents: 1347
diff changeset
  2014
        red green blue cyan yellow pink orange magenta)
1023
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
  2015
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
  2016
    "Modified: 2.5.1996 / 11:34:05 / cg"
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
  2017
!
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
  2018
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
  2019
scalingValue
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
  2020
    "ST-80 compatibility"
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
  2021
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
  2022
    ^ MaxValue
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
  2023
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
  2024
    "Created: 2.5.1996 / 11:30:09 / cg"
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
  2025
    "Modified: 11.7.1996 / 21:42:26 / cg"
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
  2026
! !
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
  2027
1144
07f3de59864d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1023
diff changeset
  2028
!Color class methodsFor:'special instance creation'!
1023
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
  2029
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
  2030
nearestColorRed:r green:g blue:b on:aDevice in:colors
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
  2031
    "return the nearest color on aDevice with RGB values
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
  2032
     same or near r/g/b in a collection of colors.
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
  2033
     If there is one, return it; nil otherwise.
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
  2034
     Near is defined as having an error less than the argument
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
  2035
     error (in percent). The error is computed by the color
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
  2036
     vector distance (which may not be the best possible solution)."
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
  2037
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
  2038
    ^ self
1348
acb4e4874e4d care for ColorValue (ColorValue cyan)
ca
parents: 1347
diff changeset
  2039
        nearestColorScaledRed:(r * MaxValue // 100)
acb4e4874e4d care for ColorValue (ColorValue cyan)
ca
parents: 1347
diff changeset
  2040
                  scaledGreen:(g * MaxValue // 100) 
acb4e4874e4d care for ColorValue (ColorValue cyan)
ca
parents: 1347
diff changeset
  2041
                   scaledBlue:(b * MaxValue // 100) 
acb4e4874e4d care for ColorValue (ColorValue cyan)
ca
parents: 1347
diff changeset
  2042
                           on:aDevice 
acb4e4874e4d care for ColorValue (ColorValue cyan)
ca
parents: 1347
diff changeset
  2043
                           in:colors
1023
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
  2044
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
  2045
    "Modified: 11.6.1996 / 18:04:55 / cg"
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
  2046
    "Created: 14.6.1996 / 20:05:13 / cg"
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
  2047
!
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
  2048
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
  2049
nearestColorScaledRed:r scaledGreen:g scaledBlue:b inCube:aColorCube numRed:nRed numGreen:nGreen numBlue:nBlue
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
  2050
    "return a color with rgb values same or near r/g/b in a given
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
  2051
     collection, containing colors from a colorCube.
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
  2052
     This is used with preallocated fixColors and is quite fast 
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
  2053
     (no need to search)"
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
  2054
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
  2055
    |sR  "{ Class: SmallInteger }"
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
  2056
     sG  "{ Class: SmallInteger }"
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
  2057
     sB  "{ Class: SmallInteger }"
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
  2058
     idx "{ Class: SmallInteger }"
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
  2059
     nR  "{ Class: SmallInteger }"
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
  2060
     nG  "{ Class: SmallInteger }"
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
  2061
     nB  "{ Class: SmallInteger }"
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
  2062
     rI  "{ Class: SmallInteger }"
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
  2063
     gI  "{ Class: SmallInteger }"
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
  2064
     bI  "{ Class: SmallInteger }"|
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
  2065
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
  2066
    "
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
  2067
     round to the step given by FixColors
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
  2068
    "
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
  2069
    nR := nRed.
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
  2070
    nG := nGreen.
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
  2071
    nB := nBlue.
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
  2072
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
  2073
    sR := MaxValue // (nR - 1).
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
  2074
    sG := MaxValue // (nG - 1).
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
  2075
    sB := MaxValue // (nB - 1).
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
  2076
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
  2077
    rI := (r + (sR // 2)) // sR.
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
  2078
    gI := (g + (sG // 2)) // sG.
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
  2079
    bI := (b + (sB // 2)) // sB.
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
  2080
    idx := (((rI * nG) + gI) * nB + bI) + 1.
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
  2081
    ^ aColorCube at:idx
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
  2082
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
  2083
    "Modified: 11.7.1996 / 17:52:46 / cg"
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
  2084
    "Created: 11.7.1996 / 18:20:13 / cg"
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
  2085
!
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
  2086
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
  2087
nearestColorScaledRed:r scaledGreen:g scaledBlue:b on:aDevice
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
  2088
    "return a device color on aDevice with RGB values
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
  2089
     same or near r/g/b, if there is one, nil otherwise.
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
  2090
     Near is defined as having an error less than the argument
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
  2091
     error (in percent). The error is computed by the color
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
  2092
     vector distance (which may not be the best possible solution)."
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
  2093
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
  2094
    |cube|
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
  2095
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
  2096
    "
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
  2097
     if there are preallocated colors, things are much easier ...
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
  2098
    "
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
  2099
    (cube := aDevice fixColors) notNil ifTrue:[
1348
acb4e4874e4d care for ColorValue (ColorValue cyan)
ca
parents: 1347
diff changeset
  2100
        ^ self 
acb4e4874e4d care for ColorValue (ColorValue cyan)
ca
parents: 1347
diff changeset
  2101
            nearestColorScaledRed:r 
acb4e4874e4d care for ColorValue (ColorValue cyan)
ca
parents: 1347
diff changeset
  2102
            scaledGreen:g 
acb4e4874e4d care for ColorValue (ColorValue cyan)
ca
parents: 1347
diff changeset
  2103
            scaledBlue:b
acb4e4874e4d care for ColorValue (ColorValue cyan)
ca
parents: 1347
diff changeset
  2104
            inCube:cube
acb4e4874e4d care for ColorValue (ColorValue cyan)
ca
parents: 1347
diff changeset
  2105
            numRed:(aDevice numFixRed)
acb4e4874e4d care for ColorValue (ColorValue cyan)
ca
parents: 1347
diff changeset
  2106
            numGreen:(aDevice numFixGreen)
acb4e4874e4d care for ColorValue (ColorValue cyan)
ca
parents: 1347
diff changeset
  2107
            numBlue:(aDevice numFixBlue)
1023
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
  2108
    ].
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
  2109
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
  2110
    "
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
  2111
     search in existing colors ...
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
  2112
    "
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
  2113
    ^ self 
1348
acb4e4874e4d care for ColorValue (ColorValue cyan)
ca
parents: 1347
diff changeset
  2114
        nearestColorScaledRed:r 
acb4e4874e4d care for ColorValue (ColorValue cyan)
ca
parents: 1347
diff changeset
  2115
        scaledGreen:g 
acb4e4874e4d care for ColorValue (ColorValue cyan)
ca
parents: 1347
diff changeset
  2116
        scaledBlue:b 
acb4e4874e4d care for ColorValue (ColorValue cyan)
ca
parents: 1347
diff changeset
  2117
        on:aDevice 
1365
37a9e7ac4dbc moved color registration from Color class to per-device lobby
Claus Gittinger <cg@exept.de>
parents: 1348
diff changeset
  2118
        in:aDevice deviceColors
1023
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
  2119
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
  2120
    "Created: 14.6.1996 / 20:11:18 / cg"
1365
37a9e7ac4dbc moved color registration from Color class to per-device lobby
Claus Gittinger <cg@exept.de>
parents: 1348
diff changeset
  2121
    "Modified: 24.2.1997 / 18:17:51 / cg"
1023
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
  2122
!
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
  2123
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
  2124
nearestColorScaledRed:r scaledGreen:g scaledBlue:b on:aDevice in:colors
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
  2125
    "return the nearest color on aDevice with RGB values
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
  2126
     same or near r/g/b in a collection of colors.
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
  2127
     If there is one, return it; nil otherwise."
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
  2128
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
  2129
    |delta minDelta bestSoFar|
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
  2130
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
  2131
    minDelta := 9999999.
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
  2132
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
  2133
    colors do:[:aColor |
1348
acb4e4874e4d care for ColorValue (ColorValue cyan)
ca
parents: 1347
diff changeset
  2134
        |cr cg cb|
acb4e4874e4d care for ColorValue (ColorValue cyan)
ca
parents: 1347
diff changeset
  2135
acb4e4874e4d care for ColorValue (ColorValue cyan)
ca
parents: 1347
diff changeset
  2136
        (aColor graphicsDevice == aDevice) ifTrue:[
acb4e4874e4d care for ColorValue (ColorValue cyan)
ca
parents: 1347
diff changeset
  2137
            aColor colorId notNil ifTrue:[
acb4e4874e4d care for ColorValue (ColorValue cyan)
ca
parents: 1347
diff changeset
  2138
                delta := aColor deltaFromScaledRed:r scaledGreen:g scaledBlue:b.
acb4e4874e4d care for ColorValue (ColorValue cyan)
ca
parents: 1347
diff changeset
  2139
                delta < minDelta ifTrue:[
acb4e4874e4d care for ColorValue (ColorValue cyan)
ca
parents: 1347
diff changeset
  2140
                    "
acb4e4874e4d care for ColorValue (ColorValue cyan)
ca
parents: 1347
diff changeset
  2141
                     an exact fit - no need to continue search
acb4e4874e4d care for ColorValue (ColorValue cyan)
ca
parents: 1347
diff changeset
  2142
                    "
acb4e4874e4d care for ColorValue (ColorValue cyan)
ca
parents: 1347
diff changeset
  2143
                    delta == 0 ifTrue:[^ aColor].
acb4e4874e4d care for ColorValue (ColorValue cyan)
ca
parents: 1347
diff changeset
  2144
acb4e4874e4d care for ColorValue (ColorValue cyan)
ca
parents: 1347
diff changeset
  2145
                    bestSoFar := aColor.
acb4e4874e4d care for ColorValue (ColorValue cyan)
ca
parents: 1347
diff changeset
  2146
                    minDelta := delta
acb4e4874e4d care for ColorValue (ColorValue cyan)
ca
parents: 1347
diff changeset
  2147
                ]
acb4e4874e4d care for ColorValue (ColorValue cyan)
ca
parents: 1347
diff changeset
  2148
            ]
acb4e4874e4d care for ColorValue (ColorValue cyan)
ca
parents: 1347
diff changeset
  2149
        ]
1023
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
  2150
    ].
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
  2151
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
  2152
    ^ bestSoFar
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
  2153
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
  2154
    "Created: 11.6.1996 / 18:02:12 / cg"
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
  2155
    "Modified: 5.7.1996 / 17:58:09 / cg"
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
  2156
!
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
  2157
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
  2158
quickNearestColorScaledRed:r scaledGreen:g scaledBlue:b on:aDevice
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
  2159
    "return a device color on aDevice with rgb values
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
  2160
     same or near r/g/b.
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
  2161
     Near is defined as having an error less than the argument
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
  2162
     error (in percent). The error is computed by the color
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
  2163
     vector distance (which may not be the best possible solution).
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
  2164
     This looks for primary colors only and is thus faster
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
  2165
     than the general nearestColor search (slightly uglier though)."
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
  2166
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
  2167
    |cube|
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
  2168
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
  2169
    "
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
  2170
     if there are preallocated colors, thungs are much easier ...
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
  2171
    "
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
  2172
    (cube := aDevice fixColors) ifTrue:[
1348
acb4e4874e4d care for ColorValue (ColorValue cyan)
ca
parents: 1347
diff changeset
  2173
        ^ self 
acb4e4874e4d care for ColorValue (ColorValue cyan)
ca
parents: 1347
diff changeset
  2174
            nearestColorScaledRed:r 
acb4e4874e4d care for ColorValue (ColorValue cyan)
ca
parents: 1347
diff changeset
  2175
            scaledGreen:g 
acb4e4874e4d care for ColorValue (ColorValue cyan)
ca
parents: 1347
diff changeset
  2176
            scaledBlue:b 
acb4e4874e4d care for ColorValue (ColorValue cyan)
ca
parents: 1347
diff changeset
  2177
            inCube:cube
acb4e4874e4d care for ColorValue (ColorValue cyan)
ca
parents: 1347
diff changeset
  2178
            numRed:(aDevice numFixRed)
acb4e4874e4d care for ColorValue (ColorValue cyan)
ca
parents: 1347
diff changeset
  2179
            numGreen:(aDevice numFixGreen)
acb4e4874e4d care for ColorValue (ColorValue cyan)
ca
parents: 1347
diff changeset
  2180
            numBlue:(aDevice numFixBlue)
1023
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
  2181
    ].
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
  2182
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
  2183
    "
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
  2184
     search in existing colors ...
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
  2185
    "
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
  2186
    ^ self nearestColorScaledRed:r 
1348
acb4e4874e4d care for ColorValue (ColorValue cyan)
ca
parents: 1347
diff changeset
  2187
                     scaledGreen:g 
acb4e4874e4d care for ColorValue (ColorValue cyan)
ca
parents: 1347
diff changeset
  2188
                      scaledBlue:b 
acb4e4874e4d care for ColorValue (ColorValue cyan)
ca
parents: 1347
diff changeset
  2189
                        on:aDevice 
acb4e4874e4d care for ColorValue (ColorValue cyan)
ca
parents: 1347
diff changeset
  2190
                        in:aDevice availableDitherColors
1023
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
  2191
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
  2192
    "Created: 14.6.1996 / 20:13:22 / cg"
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
  2193
    "Modified: 11.7.1996 / 18:20:14 / cg"
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
  2194
! !
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
  2195
1347
4e19b2d586a4 VW now has #on:, but calls it #asDevicePaintOn:
ca
parents: 1326
diff changeset
  2196
!Color methodsFor:'ST-80 compatibility'!
4e19b2d586a4 VW now has #on:, but calls it #asDevicePaintOn:
ca
parents: 1326
diff changeset
  2197
4e19b2d586a4 VW now has #on:, but calls it #asDevicePaintOn:
ca
parents: 1326
diff changeset
  2198
asDevicePaintOn:aDevice
4e19b2d586a4 VW now has #on:, but calls it #asDevicePaintOn:
ca
parents: 1326
diff changeset
  2199
    "ST-80 compatibility: an alias for on:.
4e19b2d586a4 VW now has #on:, but calls it #asDevicePaintOn:
ca
parents: 1326
diff changeset
  2200
     create a new Color representing the same color as
4e19b2d586a4 VW now has #on:, but calls it #asDevicePaintOn:
ca
parents: 1326
diff changeset
  2201
     myself on aDevice; if one already exists, return the one"
4e19b2d586a4 VW now has #on:, but calls it #asDevicePaintOn:
ca
parents: 1326
diff changeset
  2202
4e19b2d586a4 VW now has #on:, but calls it #asDevicePaintOn:
ca
parents: 1326
diff changeset
  2203
    ^ self on:aDevice
4e19b2d586a4 VW now has #on:, but calls it #asDevicePaintOn:
ca
parents: 1326
diff changeset
  2204
! !
4e19b2d586a4 VW now has #on:, but calls it #asDevicePaintOn:
ca
parents: 1326
diff changeset
  2205
1023
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
  2206
!Color methodsFor:'accessing'!
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
  2207
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
  2208
blue
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
  2209
    "return the blue component in percent [0..100]"
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
  2210
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
  2211
    (blue isNil and:[colorId notNil]) ifTrue:[
1348
acb4e4874e4d care for ColorValue (ColorValue cyan)
ca
parents: 1347
diff changeset
  2212
        device getRGBFrom:colorId into:[:r :g :b | ^ b].
1023
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
  2213
    ].
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
  2214
    ^ blue * 100.0 / MaxValue
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
  2215
!
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
  2216
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
  2217
blueByte
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
  2218
    "return the blue components value mapped to 0..255"
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
  2219
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
  2220
    ^ blue * 255 // MaxValue
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
  2221
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
  2222
    "
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
  2223
     Color red blueByte   
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
  2224
     Color blue blueByte   
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
  2225
     Color green blueByte    
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
  2226
     Color black blueByte    
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
  2227
     Color grey blueByte    
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
  2228
     Color white blueByte   
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
  2229
    "
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
  2230
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
  2231
    "Created: 7.6.1996 / 18:30:25 / cg"
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
  2232
    "Modified: 7.6.1996 / 18:32:03 / cg"
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
  2233
!
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
  2234
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
  2235
colorId
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
  2236
    "return the device-dependent color-id"
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
  2237
1238
b363894182d0 prepare for replacement colors
Claus Gittinger <cg@exept.de>
parents: 1237
diff changeset
  2238
    colorId notNil ifTrue:[^ colorId].
b363894182d0 prepare for replacement colors
Claus Gittinger <cg@exept.de>
parents: 1237
diff changeset
  2239
    replacementColor notNil ifTrue:[^ replacementColor colorId].
b363894182d0 prepare for replacement colors
Claus Gittinger <cg@exept.de>
parents: 1237
diff changeset
  2240
    ^ nil
b363894182d0 prepare for replacement colors
Claus Gittinger <cg@exept.de>
parents: 1237
diff changeset
  2241
b363894182d0 prepare for replacement colors
Claus Gittinger <cg@exept.de>
parents: 1237
diff changeset
  2242
    "Modified: 17.1.1997 / 00:03:18 / cg"
1023
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
  2243
!
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
  2244
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
  2245
cyan
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
  2246
    "return the cyan component in percent [0..100] in cmy color space"
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
  2247
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
  2248
    ^ 100 - self red
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
  2249
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
  2250
    "Modified: 11.6.1996 / 17:20:07 / cg"
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
  2251
    "Created: 11.6.1996 / 18:30:00 / cg"
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
  2252
!
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
  2253
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
  2254
device
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
  2255
    "return the device I am associated to"
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
  2256
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
  2257
    ^ device
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
  2258
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
  2259
    "Modified: 23.4.1996 / 13:36:42 / cg"
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
  2260
!
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
  2261
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
  2262
deviceBlue
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
  2263
    "return the actual value of the blue component in percent."
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
  2264
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
  2265
    |v|
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
  2266
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
  2267
    device getRGBFrom:colorId into:[:r :g :b | v := b].
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
  2268
    ^ v
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
  2269
!
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
  2270
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
  2271
deviceGreen
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
  2272
    "return the actual value of the green component in percent.
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
  2273
     (usually 16bit in X; but could be different on other systems)"
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
  2274
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
  2275
    |v|
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
  2276
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
  2277
    device getRGBFrom:colorId into:[:r :g :b | v := g].
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
  2278
    ^ v
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
  2279
!
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
  2280
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
  2281
deviceRed
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
  2282
    "return the actual value of the red component in percent."
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
  2283
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
  2284
    |v|
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
  2285
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
  2286
    device getRGBFrom:colorId into:[:r :g :b | v := r].
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
  2287
    ^ v
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
  2288
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
  2289
    "
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
  2290
     (Color yellow on:Display) deviceRedValue
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
  2291
     (Color yellow on:aPrinterPage) deviceRedValue
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
  2292
    "
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
  2293
!
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
  2294
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
  2295
ditherForm
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
  2296
    "return the form to dither the color"
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
  2297
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
  2298
    ^ ditherForm
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
  2299
!
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
  2300
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
  2301
graphicsDevice
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
  2302
    "same as #device, for ST-80 compatibility naming.
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
  2303
     Return the device I am associated with."
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
  2304
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
  2305
    ^ device
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
  2306
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
  2307
    "Created: 28.5.1996 / 18:39:27 / cg"
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
  2308
!
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
  2309
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
  2310
green
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
  2311
    "return the green component in percent [0..100]"
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
  2312
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
  2313
    (green isNil and:[colorId notNil]) ifTrue:[
1348
acb4e4874e4d care for ColorValue (ColorValue cyan)
ca
parents: 1347
diff changeset
  2314
        device getRGBFrom:colorId into:[:r :g :b | ^ g].
1023
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
  2315
    ].
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
  2316
    ^ green * 100.0 / MaxValue
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
  2317
!
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
  2318
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
  2319
greenByte
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
  2320
    "return the green components value mapped to 0..255"
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
  2321
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
  2322
    ^ green * 255 // MaxValue
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
  2323
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
  2324
    "
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
  2325
     Color red greenByte   
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
  2326
     Color blue greenByte   
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
  2327
     Color green greenByte    
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
  2328
     Color black greenByte    
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
  2329
     Color grey greenByte    
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
  2330
     Color white greenByte   
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
  2331
    "
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
  2332
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
  2333
    "Modified: 7.6.1996 / 18:31:30 / cg"
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
  2334
!
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
  2335
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
  2336
hue
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
  2337
    "return the hue (in hue/light/saturation model) in degrees [0..360]"
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
  2338
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
  2339
    |r g b h|
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
  2340
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
  2341
    (red isNil and:[colorId notNil]) ifTrue:[
1348
acb4e4874e4d care for ColorValue (ColorValue cyan)
ca
parents: 1347
diff changeset
  2342
        device getRGBFrom:colorId into:[:xr :xg :xb |
acb4e4874e4d care for ColorValue (ColorValue cyan)
ca
parents: 1347
diff changeset
  2343
            r := xr.
acb4e4874e4d care for ColorValue (ColorValue cyan)
ca
parents: 1347
diff changeset
  2344
            g := xg.
acb4e4874e4d care for ColorValue (ColorValue cyan)
ca
parents: 1347
diff changeset
  2345
            b := xb.
acb4e4874e4d care for ColorValue (ColorValue cyan)
ca
parents: 1347
diff changeset
  2346
        ]
1023
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
  2347
    ] ifFalse:[
1348
acb4e4874e4d care for ColorValue (ColorValue cyan)
ca
parents: 1347
diff changeset
  2348
        r := self red.
acb4e4874e4d care for ColorValue (ColorValue cyan)
ca
parents: 1347
diff changeset
  2349
        g := self green.
acb4e4874e4d care for ColorValue (ColorValue cyan)
ca
parents: 1347
diff changeset
  2350
        b := self blue.
1023
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
  2351
    ].
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
  2352
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
  2353
    self class withHLSFromRed:r green:g blue:b do:[:xh :xl :xs |
1348
acb4e4874e4d care for ColorValue (ColorValue cyan)
ca
parents: 1347
diff changeset
  2354
        h := xh
1023
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
  2355
    ].
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
  2356
    ^ h
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
  2357
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
  2358
    "
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
  2359
     Color yellow hue
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
  2360
    "
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
  2361
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
  2362
    "Modified: 11.6.1996 / 17:14:51 / cg"
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
  2363
!
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
  2364
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
  2365
light 
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
  2366
    "return the light (in hue/light/saturation model) in percent [0..100].
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
  2367
     This corresponds to the brightness of the color (if displayed on
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
  2368
     a b&w television screen)"
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
  2369
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
  2370
    |r g b l|
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
  2371
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
  2372
    (red isNil and:[colorId notNil]) ifTrue:[
1348
acb4e4874e4d care for ColorValue (ColorValue cyan)
ca
parents: 1347
diff changeset
  2373
        device getRGBFrom:colorId into:[:xr :xg :xb |
acb4e4874e4d care for ColorValue (ColorValue cyan)
ca
parents: 1347
diff changeset
  2374
            r := xr.
acb4e4874e4d care for ColorValue (ColorValue cyan)
ca
parents: 1347
diff changeset
  2375
            g := xg.
acb4e4874e4d care for ColorValue (ColorValue cyan)
ca
parents: 1347
diff changeset
  2376
            b := xb.
acb4e4874e4d care for ColorValue (ColorValue cyan)
ca
parents: 1347
diff changeset
  2377
        ]
1023
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
  2378
    ] ifFalse:[
1348
acb4e4874e4d care for ColorValue (ColorValue cyan)
ca
parents: 1347
diff changeset
  2379
        r := self red.
acb4e4874e4d care for ColorValue (ColorValue cyan)
ca
parents: 1347
diff changeset
  2380
        g := self green.
acb4e4874e4d care for ColorValue (ColorValue cyan)
ca
parents: 1347
diff changeset
  2381
        b := self blue.
1023
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
  2382
    ].
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
  2383
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
  2384
    self class withHLSFromRed:r green:g blue:b do:[:xh :xl :xs |
1348
acb4e4874e4d care for ColorValue (ColorValue cyan)
ca
parents: 1347
diff changeset
  2385
        l := xl
1023
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
  2386
    ].
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
  2387
    ^ l
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
  2388
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
  2389
    "
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
  2390
     Color yellow light          
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
  2391
     Color yellow darkened light   
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
  2392
    "
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
  2393
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
  2394
    "Modified: 11.6.1996 / 17:15:24 / cg"
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
  2395
!
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
  2396
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
  2397
magenta
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
  2398
    "return the magenta component in percent [0..100] in cmy color space"
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
  2399
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
  2400
    ^ 100 - self green
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
  2401
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
  2402
    "Modified: 11.6.1996 / 17:20:07 / cg"
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
  2403
    "Created: 11.6.1996 / 18:30:11 / cg"
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
  2404
!
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
  2405
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
  2406
red
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
  2407
    "return the red component in percent [0..100]"
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
  2408
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
  2409
    (red isNil and:[colorId notNil]) ifTrue:[
1348
acb4e4874e4d care for ColorValue (ColorValue cyan)
ca
parents: 1347
diff changeset
  2410
        device getRGBFrom:colorId into:[:r :g :b | ^ r].
1023
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
  2411
    ].
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
  2412
    red isNil ifTrue:[^ 0].
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
  2413
    ^ red * 100.0 / MaxValue
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
  2414
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
  2415
    "Modified: 11.6.1996 / 17:20:07 / cg"
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
  2416
!
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
  2417
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
  2418
red:r green:g blue:b
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
  2419
    "set r/g/b components in percent. This method will change the color lookup
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
  2420
     table in pseudocolor devices.
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
  2421
     This is only allowed for writable colors (i.e. those allocated with 
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
  2422
     Color>>variableColorOn: on pseudoColor displays). 
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
  2423
     Using this may make your code unportable, since it depends on a display 
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
  2424
     using palettes (i.e. it will not work on greyScale or b&w displays)."
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
  2425
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
  2426
    ^ self scaledRed:(r * MaxValue // 100)
1348
acb4e4874e4d care for ColorValue (ColorValue cyan)
ca
parents: 1347
diff changeset
  2427
           scaledGreen:(g * MaxValue // 100)
acb4e4874e4d care for ColorValue (ColorValue cyan)
ca
parents: 1347
diff changeset
  2428
           scaledBlue:(b * MaxValue // 100)
1023
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
  2429
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
  2430
    "
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
  2431
     |c|
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
  2432
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
  2433
     c := Color variableColorOn:Display.
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
  2434
     c inspect.
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
  2435
     (Delay forSeconds:5) wait.
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
  2436
     c red:100 green:0 blue:0.
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
  2437
     (Delay forSeconds:5) wait.
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
  2438
     c red:0 green:100 blue:0.
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
  2439
     (Delay forSeconds:5) wait.
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
  2440
     c red:0 green:0 blue:100.
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
  2441
    "
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
  2442
!
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
  2443
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
  2444
redByte
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
  2445
    "return the red components value mapped to 0..255"
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
  2446
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
  2447
    ^ red * 255 // MaxValue
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
  2448
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
  2449
    "
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
  2450
     Color red redByte   
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
  2451
     Color blue redByte   
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
  2452
     Color green redByte    
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
  2453
     Color black redByte    
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
  2454
     Color grey redByte    
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
  2455
     Color white redByte   
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
  2456
    "
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
  2457
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
  2458
    "Modified: 7.6.1996 / 18:31:51 / cg"
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
  2459
!
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
  2460
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
  2461
saturation 
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
  2462
    "return the saturation (in hue/light/saturation model) in percent [0..100].
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
  2463
     This corresponds to the saturation setting of a color TV"
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
  2464
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
  2465
    |r g b s|
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
  2466
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
  2467
    (red isNil and:[colorId notNil]) ifTrue:[
1348
acb4e4874e4d care for ColorValue (ColorValue cyan)
ca
parents: 1347
diff changeset
  2468
        device getRGBFrom:colorId into:[:xr :xg :xb |
acb4e4874e4d care for ColorValue (ColorValue cyan)
ca
parents: 1347
diff changeset
  2469
            r := xr.
acb4e4874e4d care for ColorValue (ColorValue cyan)
ca
parents: 1347
diff changeset
  2470
            g := xg.
acb4e4874e4d care for ColorValue (ColorValue cyan)
ca
parents: 1347
diff changeset
  2471
            b := xb.
acb4e4874e4d care for ColorValue (ColorValue cyan)
ca
parents: 1347
diff changeset
  2472
        ]
1023
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
  2473
    ] ifFalse:[
1348
acb4e4874e4d care for ColorValue (ColorValue cyan)
ca
parents: 1347
diff changeset
  2474
        r := self red.
acb4e4874e4d care for ColorValue (ColorValue cyan)
ca
parents: 1347
diff changeset
  2475
        g := self green.
acb4e4874e4d care for ColorValue (ColorValue cyan)
ca
parents: 1347
diff changeset
  2476
        b := self blue.
1023
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
  2477
    ].
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
  2478
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
  2479
    self class withHLSFromRed:r green:g blue:b do:[:xh :xl :xs |
1348
acb4e4874e4d care for ColorValue (ColorValue cyan)
ca
parents: 1347
diff changeset
  2480
        s := xs
1023
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
  2481
    ].
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
  2482
    ^ s
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
  2483
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
  2484
    "
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
  2485
     Color yellow saturation
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
  2486
    "
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
  2487
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
  2488
    "Modified: 11.6.1996 / 17:15:47 / cg"
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
  2489
!
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
  2490
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
  2491
scaledBlue
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
  2492
    "ST-80 compatibility:
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
  2493
     return the blue components value mapped to 0..MaxValue"
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
  2494
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
  2495
    ^ blue
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
  2496
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
  2497
    "
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
  2498
     Color blue scaledBlue   
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
  2499
     Color black scaledBlue  
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
  2500
     Color grey scaledBlue   
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
  2501
    "
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
  2502
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
  2503
    "Modified: 7.6.1996 / 18:32:30 / cg"
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
  2504
!
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
  2505
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
  2506
scaledGray
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
  2507
    "return the grey intensity scaled to 0..MaxValue"
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
  2508
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
  2509
    ^ ((red * 3) + (green * 6) + blue) // 10
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
  2510
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
  2511
    "
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
  2512
     Color blue scaledGray   
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
  2513
     Color black scaledGray  
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
  2514
     Color white scaledGray  
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
  2515
     Color grey scaledGray    
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
  2516
    "
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
  2517
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
  2518
    "Modified: 11.6.1996 / 14:43:51 / cg"
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
  2519
!
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
  2520
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
  2521
scaledGreen
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
  2522
    "ST-80 compatibility:
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
  2523
     return the green components value mapped to 0..MaxValue"
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
  2524
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
  2525
    ^ green
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
  2526
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
  2527
    "
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
  2528
     Color green scaledRed    
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
  2529
     Color black scaledRed  
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
  2530
     Color grey scaledRed   
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
  2531
    "
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
  2532
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
  2533
    "Modified: 7.6.1996 / 18:32:38 / cg"
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
  2534
!
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
  2535
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
  2536
scaledRed
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
  2537
    "ST-80 compatibility:
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
  2538
     return the red components value mapped to 0..MaxValue"
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
  2539
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
  2540
    ^ red
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
  2541
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
  2542
    "
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
  2543
     Color red scaledRed    
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
  2544
     Color black scaledRed  
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
  2545
     Color grey scaledRed   
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
  2546
    "
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
  2547
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
  2548
    "Modified: 7.6.1996 / 18:32:43 / cg"
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
  2549
!
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
  2550
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
  2551
scaledRed:r scaledGreen:g scaledBlue:b
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
  2552
    "set r/g/b components in 0..MaxValue.
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
  2553
     This method will change the color lookup table in pseudocolor devices.
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
  2554
     This is only allowed for writable colors (i.e. those allocated with 
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
  2555
     Color>>variableColorOn: on pseudoColor displays).
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
  2556
     Using this may make your code unportable, since it depends on a display 
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
  2557
     using palettes (i.e. it will not work on greyScale or b&w displays)."
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
  2558
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
  2559
    (colorId isNil or:[red notNil]) ifTrue:[
1348
acb4e4874e4d care for ColorValue (ColorValue cyan)
ca
parents: 1347
diff changeset
  2560
        ^ self error:'operation is not allowed for shared colors'
1023
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
  2561
    ].
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
  2562
    device setColor:colorId scaledRed:r scaledGreen:g scaledBlue:b
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
  2563
!
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
  2564
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
  2565
writable
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
  2566
    "return true, if this is a writable colorcell"
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
  2567
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
  2568
    ^ writable == true
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
  2569
!
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
  2570
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
  2571
yellow
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
  2572
    "return the yellow component in percent [0..100] in cmy color space"
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
  2573
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
  2574
    ^ 100 - self blue
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
  2575
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
  2576
    "Modified: 11.6.1996 / 17:20:07 / cg"
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
  2577
    "Created: 11.6.1996 / 18:30:20 / cg"
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
  2578
! !
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
  2579
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
  2580
!Color methodsFor:'binary storage'!
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
  2581
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
  2582
readBinaryContentsFrom: stream manager: manager
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
  2583
    "tell the newly restored Color about restoration"
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
  2584
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
  2585
    super readBinaryContentsFrom:stream manager:manager.
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
  2586
    self postCopy
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
  2587
! !
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
  2588
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
  2589
!Color methodsFor:'comparing'!
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
  2590
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
  2591
= aColor
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
  2592
    "two colors are considered equal, if the color components are;
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
  2593
     independent of the device, the color is on"
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
  2594
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
  2595
    aColor == self ifTrue:[^ self].
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
  2596
    aColor isColor ifTrue:[
1348
acb4e4874e4d care for ColorValue (ColorValue cyan)
ca
parents: 1347
diff changeset
  2597
        (red == aColor scaledRed) ifTrue:[
acb4e4874e4d care for ColorValue (ColorValue cyan)
ca
parents: 1347
diff changeset
  2598
            (green == aColor scaledGreen) ifTrue:[
acb4e4874e4d care for ColorValue (ColorValue cyan)
ca
parents: 1347
diff changeset
  2599
                (blue == aColor scaledBlue) ifTrue:[
acb4e4874e4d care for ColorValue (ColorValue cyan)
ca
parents: 1347
diff changeset
  2600
                    ^ true
acb4e4874e4d care for ColorValue (ColorValue cyan)
ca
parents: 1347
diff changeset
  2601
                ]
acb4e4874e4d care for ColorValue (ColorValue cyan)
ca
parents: 1347
diff changeset
  2602
            ]
acb4e4874e4d care for ColorValue (ColorValue cyan)
ca
parents: 1347
diff changeset
  2603
        ]
1023
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
  2604
    ].
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
  2605
    ^ false
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
  2606
!
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
  2607
1390
4b519886451f added #almostSameAs:
Claus Gittinger <cg@exept.de>
parents: 1370
diff changeset
  2608
almostSameAs:aColor
4b519886451f added #almostSameAs:
Claus Gittinger <cg@exept.de>
parents: 1370
diff changeset
  2609
    "return true, if aColor looks almost the same as the receiver
4b519886451f added #almostSameAs:
Claus Gittinger <cg@exept.de>
parents: 1370
diff changeset
  2610
     (i.e. the components differ by a small, invisible amount).
4b519886451f added #almostSameAs:
Claus Gittinger <cg@exept.de>
parents: 1370
diff changeset
  2611
     We assume, that the human eye can distinguish roughly 100 grey levels
4b519886451f added #almostSameAs:
Claus Gittinger <cg@exept.de>
parents: 1370
diff changeset
  2612
     (which is optimistic ;-);
4b519886451f added #almostSameAs:
Claus Gittinger <cg@exept.de>
parents: 1370
diff changeset
  2613
     therefore, allow a 1 percent difference in each component for the colors
4b519886451f added #almostSameAs:
Claus Gittinger <cg@exept.de>
parents: 1370
diff changeset
  2614
     to compare as looking the same."
4b519886451f added #almostSameAs:
Claus Gittinger <cg@exept.de>
parents: 1370
diff changeset
  2615
4b519886451f added #almostSameAs:
Claus Gittinger <cg@exept.de>
parents: 1370
diff changeset
  2616
     (self red - aColor red) abs > 1 ifTrue:[^ false].
4b519886451f added #almostSameAs:
Claus Gittinger <cg@exept.de>
parents: 1370
diff changeset
  2617
     (self green - aColor green) abs > 1 ifTrue:[^ false].
4b519886451f added #almostSameAs:
Claus Gittinger <cg@exept.de>
parents: 1370
diff changeset
  2618
     (self blue - aColor blue) abs > 1 ifTrue:[^ false].
4b519886451f added #almostSameAs:
Claus Gittinger <cg@exept.de>
parents: 1370
diff changeset
  2619
     ^ true
4b519886451f added #almostSameAs:
Claus Gittinger <cg@exept.de>
parents: 1370
diff changeset
  2620
4b519886451f added #almostSameAs:
Claus Gittinger <cg@exept.de>
parents: 1370
diff changeset
  2621
     "
4b519886451f added #almostSameAs:
Claus Gittinger <cg@exept.de>
parents: 1370
diff changeset
  2622
      (Color red:10 green:10 blue:10) almostSameAs:(Color red:11 green:11 blue:11)
4b519886451f added #almostSameAs:
Claus Gittinger <cg@exept.de>
parents: 1370
diff changeset
  2623
     "
4b519886451f added #almostSameAs:
Claus Gittinger <cg@exept.de>
parents: 1370
diff changeset
  2624
4b519886451f added #almostSameAs:
Claus Gittinger <cg@exept.de>
parents: 1370
diff changeset
  2625
    "Modified: 28.2.1997 / 12:00:01 / cg"
4b519886451f added #almostSameAs:
Claus Gittinger <cg@exept.de>
parents: 1370
diff changeset
  2626
!
4b519886451f added #almostSameAs:
Claus Gittinger <cg@exept.de>
parents: 1370
diff changeset
  2627
1023
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
  2628
hash
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
  2629
    "return an integer useful as hash key for the receiver.
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
  2630
     Redefined since = is redefined"
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
  2631
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
  2632
    ^ red + green + blue
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
  2633
! !
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
  2634
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
  2635
!Color methodsFor:'converting'!
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
  2636
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
  2637
fromLiteralArrayEncoding:encoding
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
  2638
    "read my values from an encoding.
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
  2639
     The encoding is supposed to be of the form: 
1348
acb4e4874e4d care for ColorValue (ColorValue cyan)
ca
parents: 1347
diff changeset
  2640
        (#Color redPart greenPart bluePart)
1023
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
  2641
     This is the reverse operation to #literalArrayEncoding."
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
  2642
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
  2643
    red := ((encoding at:2) / 100.0 * MaxValue) rounded.
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
  2644
    green := ((encoding at:3) / 100.0 * MaxValue) rounded.
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
  2645
    blue := ((encoding at:4) / 100.0 * MaxValue) rounded.
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
  2646
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
  2647
    "
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
  2648
      Color new fromLiteralArrayEncoding:#(#Color 50 25 25)
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
  2649
    "
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
  2650
!
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
  2651
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
  2652
literalArrayEncoding
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
  2653
    "encode myself as an array, from which a copy of the receiver
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
  2654
     can be reconstructed with #decodeAsLiteralArray.
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
  2655
     The encoding is: 
1348
acb4e4874e4d care for ColorValue (ColorValue cyan)
ca
parents: 1347
diff changeset
  2656
        (#Color redPart greenPart bluePart)
1023
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
  2657
    "
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
  2658
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
  2659
    ^ Array
1348
acb4e4874e4d care for ColorValue (ColorValue cyan)
ca
parents: 1347
diff changeset
  2660
        with:self class name asSymbol
acb4e4874e4d care for ColorValue (ColorValue cyan)
ca
parents: 1347
diff changeset
  2661
        with:(red * 100.0 / MaxValue)
acb4e4874e4d care for ColorValue (ColorValue cyan)
ca
parents: 1347
diff changeset
  2662
        with:(green * 100.0 / MaxValue)
acb4e4874e4d care for ColorValue (ColorValue cyan)
ca
parents: 1347
diff changeset
  2663
        with:(blue * 100.0 / MaxValue)
1023
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
  2664
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
  2665
    "
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
  2666
      Color new fromLiteralArrayEncoding:#(#Color 50 25 25)
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
  2667
      (Color red:25 green:30 blue:70) literalArrayEncoding 
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
  2668
    "
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
  2669
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
  2670
    "Modified: 22.4.1996 / 13:00:11 / cg"
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
  2671
! !
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
  2672
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
  2673
!Color methodsFor:'copying'!
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
  2674
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
  2675
postCopy
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
  2676
    "redefined to clear out any device handles in the copy"
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
  2677
1238
b363894182d0 prepare for replacement colors
Claus Gittinger <cg@exept.de>
parents: 1237
diff changeset
  2678
    device := colorId := ditherForm := replacementColor := nil
b363894182d0 prepare for replacement colors
Claus Gittinger <cg@exept.de>
parents: 1237
diff changeset
  2679
b363894182d0 prepare for replacement colors
Claus Gittinger <cg@exept.de>
parents: 1237
diff changeset
  2680
    "Modified: 17.1.1997 / 00:03:42 / cg"
1023
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
  2681
! !
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
  2682
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
  2683
!Color methodsFor:'getting a device color'!
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
  2684
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
  2685
exactOn:aDevice
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
  2686
    "create a new Color representing the same color as
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
  2687
     myself on aDevice; if one already exists, return the one.
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
  2688
     Do not dither or otherwise approximate the color, but return
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
  2689
     nil, if the exact color is not available. 
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
  2690
     Used to aquire primary colors for dithering, during startup."
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
  2691
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
  2692
    |newColor id r g b|
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
  2693
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
  2694
    "if Iam already assigned to that device ..."
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
  2695
    (device == aDevice and:[ditherForm isNil]) ifTrue:[^ self].
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
  2696
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
  2697
    r := red.
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
  2698
    g := green.
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
  2699
    b := blue.
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
  2700
1239
f4bd3bc9f3f9 oops - dont round when searching for existing colors
Claus Gittinger <cg@exept.de>
parents: 1238
diff changeset
  2701
    "first look if not already there"
f4bd3bc9f3f9 oops - dont round when searching for existing colors
Claus Gittinger <cg@exept.de>
parents: 1238
diff changeset
  2702
    newColor := Color existingColorScaledRed:r scaledGreen:g scaledBlue:b on:aDevice.
f4bd3bc9f3f9 oops - dont round when searching for existing colors
Claus Gittinger <cg@exept.de>
parents: 1238
diff changeset
  2703
    (newColor notNil and:[newColor ditherForm isNil]) ifTrue:[^ newColor].
f4bd3bc9f3f9 oops - dont round when searching for existing colors
Claus Gittinger <cg@exept.de>
parents: 1238
diff changeset
  2704
1023
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
  2705
    r := (r bitAnd:16rFF00) bitOr:(r bitShift:-8).
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
  2706
    g := (g bitAnd:16rFF00) bitOr:(g bitShift:-8).
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
  2707
    b := (b bitAnd:16rFF00) bitOr:(b bitShift:-8).
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
  2708
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
  2709
    "ask that device for the color"
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
  2710
    id := aDevice colorScaledRed:r scaledGreen:g scaledBlue:b.
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
  2711
    id isNil ifTrue:[
1238
b363894182d0 prepare for replacement colors
Claus Gittinger <cg@exept.de>
parents: 1237
diff changeset
  2712
        "/ this is a kludge: scavenge to free unused colors
b363894182d0 prepare for replacement colors
Claus Gittinger <cg@exept.de>
parents: 1237
diff changeset
  2713
        "/  and try again ...
b363894182d0 prepare for replacement colors
Claus Gittinger <cg@exept.de>
parents: 1237
diff changeset
  2714
        ObjectMemory scavenge; finalize.
b363894182d0 prepare for replacement colors
Claus Gittinger <cg@exept.de>
parents: 1237
diff changeset
  2715
        id := aDevice colorScaledRed:r scaledGreen:g scaledBlue:b
1023
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
  2716
    ].
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
  2717
    id isNil ifTrue:[
1238
b363894182d0 prepare for replacement colors
Claus Gittinger <cg@exept.de>
parents: 1237
diff changeset
  2718
        "no such color - fail"
1023
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
  2719
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
  2720
"/      'COLOR: no color for ' infoPrint. self displayString infoPrintCR.
1238
b363894182d0 prepare for replacement colors
Claus Gittinger <cg@exept.de>
parents: 1237
diff changeset
  2721
        ^ nil
1023
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
  2722
    ].
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
  2723
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
  2724
    "receiver was not associated - do it now"
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
  2725
    device isNil ifTrue:[
1238
b363894182d0 prepare for replacement colors
Claus Gittinger <cg@exept.de>
parents: 1237
diff changeset
  2726
        device := aDevice.
b363894182d0 prepare for replacement colors
Claus Gittinger <cg@exept.de>
parents: 1237
diff changeset
  2727
        colorId := id.
b363894182d0 prepare for replacement colors
Claus Gittinger <cg@exept.de>
parents: 1237
diff changeset
  2728
b363894182d0 prepare for replacement colors
Claus Gittinger <cg@exept.de>
parents: 1237
diff changeset
  2729
        aDevice visualType ~~ #TrueColor ifTrue:[
1365
37a9e7ac4dbc moved color registration from Color class to per-device lobby
Claus Gittinger <cg@exept.de>
parents: 1348
diff changeset
  2730
            "/ Lobby register:self.
37a9e7ac4dbc moved color registration from Color class to per-device lobby
Claus Gittinger <cg@exept.de>
parents: 1348
diff changeset
  2731
            aDevice registerColor:self.
1238
b363894182d0 prepare for replacement colors
Claus Gittinger <cg@exept.de>
parents: 1237
diff changeset
  2732
        ].
b363894182d0 prepare for replacement colors
Claus Gittinger <cg@exept.de>
parents: 1237
diff changeset
  2733
        ^ self
1023
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
  2734
    ].
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
  2735
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
  2736
    "receiver was already associated to another device - need a new color"
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
  2737
    newColor := (self class basicNew) setScaledRed:r scaledGreen:g scaledBlue:b device:aDevice.
1238
b363894182d0 prepare for replacement colors
Claus Gittinger <cg@exept.de>
parents: 1237
diff changeset
  2738
    newColor setColorId:id.
1023
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
  2739
    aDevice visualType ~~ #TrueColor ifTrue:[
1365
37a9e7ac4dbc moved color registration from Color class to per-device lobby
Claus Gittinger <cg@exept.de>
parents: 1348
diff changeset
  2740
        "/ Lobby register:newColor.
37a9e7ac4dbc moved color registration from Color class to per-device lobby
Claus Gittinger <cg@exept.de>
parents: 1348
diff changeset
  2741
        aDevice registerColor:newColor.
1023
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
  2742
    ].
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
  2743
    ^ newColor
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
  2744
1365
37a9e7ac4dbc moved color registration from Color class to per-device lobby
Claus Gittinger <cg@exept.de>
parents: 1348
diff changeset
  2745
    "Modified: 24.2.1997 / 18:23:20 / cg"
1023
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
  2746
!
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
  2747
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
  2748
nearestOn:aDevice 
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
  2749
    "create a new Color representing the same color as myself on aDevice; 
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
  2750
     if one already exists, return the one. If no exact match is found,
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
  2751
     search for the nearest match"
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
  2752
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
  2753
    |newColor id|
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
  2754
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
  2755
    "if I'am already assigned to that device ..."
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
  2756
    (device == aDevice) ifTrue:[^ self].
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
  2757
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
  2758
    "first look if not already there"
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
  2759
    newColor := Color nearestColorScaledRed:red scaledGreen:green scaledBlue:blue on:aDevice.
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
  2760
    newColor notNil ifTrue:[^ newColor].
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
  2761
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
  2762
    "ask that device for the color"
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
  2763
    id := aDevice colorScaledRed:red scaledGreen:green scaledBlue:blue.
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
  2764
    id isNil ifTrue:[
1238
b363894182d0 prepare for replacement colors
Claus Gittinger <cg@exept.de>
parents: 1237
diff changeset
  2765
        "this is a kludge: 
b363894182d0 prepare for replacement colors
Claus Gittinger <cg@exept.de>
parents: 1237
diff changeset
  2766
            scavenge to possuby free unused colors and try again ...
b363894182d0 prepare for replacement colors
Claus Gittinger <cg@exept.de>
parents: 1237
diff changeset
  2767
            this is a compromise: actually a full GC is required here,
b363894182d0 prepare for replacement colors
Claus Gittinger <cg@exept.de>
parents: 1237
diff changeset
  2768
            but that is too expensive.
b363894182d0 prepare for replacement colors
Claus Gittinger <cg@exept.de>
parents: 1237
diff changeset
  2769
        "
1023
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
  2770
" "
1238
b363894182d0 prepare for replacement colors
Claus Gittinger <cg@exept.de>
parents: 1237
diff changeset
  2771
        ObjectMemory scavenge; finalize.
b363894182d0 prepare for replacement colors
Claus Gittinger <cg@exept.de>
parents: 1237
diff changeset
  2772
        id := aDevice colorScaledRed:red scaledGreen:green scaledBlue:blue
1023
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
  2773
" "
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
  2774
    ].
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
  2775
    id isNil ifTrue:[
1238
b363894182d0 prepare for replacement colors
Claus Gittinger <cg@exept.de>
parents: 1237
diff changeset
  2776
        "no color - fail"
b363894182d0 prepare for replacement colors
Claus Gittinger <cg@exept.de>
parents: 1237
diff changeset
  2777
b363894182d0 prepare for replacement colors
Claus Gittinger <cg@exept.de>
parents: 1237
diff changeset
  2778
        ^ nil
1023
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
  2779
    ].
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
  2780
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
  2781
    "receiver was not associated - do it now"
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
  2782
    device isNil ifTrue:[
1238
b363894182d0 prepare for replacement colors
Claus Gittinger <cg@exept.de>
parents: 1237
diff changeset
  2783
        device := aDevice.
b363894182d0 prepare for replacement colors
Claus Gittinger <cg@exept.de>
parents: 1237
diff changeset
  2784
        colorId := id.
b363894182d0 prepare for replacement colors
Claus Gittinger <cg@exept.de>
parents: 1237
diff changeset
  2785
b363894182d0 prepare for replacement colors
Claus Gittinger <cg@exept.de>
parents: 1237
diff changeset
  2786
        aDevice visualType ~~ #TrueColor ifTrue:[
1365
37a9e7ac4dbc moved color registration from Color class to per-device lobby
Claus Gittinger <cg@exept.de>
parents: 1348
diff changeset
  2787
            "/ Lobby register:self.
37a9e7ac4dbc moved color registration from Color class to per-device lobby
Claus Gittinger <cg@exept.de>
parents: 1348
diff changeset
  2788
            aDevice registerColor:self.
1238
b363894182d0 prepare for replacement colors
Claus Gittinger <cg@exept.de>
parents: 1237
diff changeset
  2789
        ].
b363894182d0 prepare for replacement colors
Claus Gittinger <cg@exept.de>
parents: 1237
diff changeset
  2790
        ^ self
1023
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
  2791
    ].
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
  2792
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
  2793
    "receiver was already associated to another device - need a new color"
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
  2794
    newColor := (self class basicNew) setScaledRed:red scaledGreen:green sclaedBlue:blue device:aDevice.
1238
b363894182d0 prepare for replacement colors
Claus Gittinger <cg@exept.de>
parents: 1237
diff changeset
  2795
    newColor setColorId:id.
1023
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
  2796
    aDevice visualType ~~ #TrueColor ifTrue:[
1365
37a9e7ac4dbc moved color registration from Color class to per-device lobby
Claus Gittinger <cg@exept.de>
parents: 1348
diff changeset
  2797
        "/ Lobby register:newColor.
37a9e7ac4dbc moved color registration from Color class to per-device lobby
Claus Gittinger <cg@exept.de>
parents: 1348
diff changeset
  2798
        aDevice registerColor:newColor.
1023
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
  2799
    ].
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
  2800
    ^ newColor
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
  2801
1365
37a9e7ac4dbc moved color registration from Color class to per-device lobby
Claus Gittinger <cg@exept.de>
parents: 1348
diff changeset
  2802
    "Modified: 24.2.1997 / 18:23:26 / cg"
1023
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
  2803
!
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
  2804
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
  2805
on:aDevice
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
  2806
    "create a new Color representing the same color as
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
  2807
     myself on aDevice; if one already exists, return the one"
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
  2808
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
  2809
    |newColor id grey form 
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
  2810
     greyV "{ Class: SmallInteger }"
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
  2811
     rV    "{ Class: SmallInteger }"
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
  2812
     gV    "{ Class: SmallInteger }" 
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
  2813
     bV    "{ Class: SmallInteger }"
1144
07f3de59864d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1023
diff changeset
  2814
     deviceVisual deviceFixColors|
1023
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
  2815
1233
c6796bddc7d1 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1229
diff changeset
  2816
    "/ the most common cases (already allocated) first 
c6796bddc7d1 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1229
diff changeset
  2817
c6796bddc7d1 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1229
diff changeset
  2818
    colorId notNil ifTrue:[
c6796bddc7d1 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1229
diff changeset
  2819
c6796bddc7d1 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1229
diff changeset
  2820
        "/ is someone validating me before drawing on aDevice ?
c6796bddc7d1 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1229
diff changeset
  2821
c6796bddc7d1 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1229
diff changeset
  2822
        aDevice notNil ifTrue:[
c6796bddc7d1 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1229
diff changeset
  2823
            aDevice == device ifTrue:[
1144
07f3de59864d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1023
diff changeset
  2824
                ^ self
07f3de59864d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1023
diff changeset
  2825
            ]
1233
c6796bddc7d1 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1229
diff changeset
  2826
        ].
c6796bddc7d1 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1229
diff changeset
  2827
c6796bddc7d1 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1229
diff changeset
  2828
        "/ a special case for pseudo-colors (0 and 1 in bitmaps)
c6796bddc7d1 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1229
diff changeset
  2829
        "/ those have nil r/g/b values, but a nonNil colorId
c6796bddc7d1 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1229
diff changeset
  2830
c6796bddc7d1 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1229
diff changeset
  2831
        red isNil ifTrue:[^ self].
c6796bddc7d1 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1229
diff changeset
  2832
c6796bddc7d1 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1229
diff changeset
  2833
        "/ want to release color ?
c6796bddc7d1 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1229
diff changeset
  2834
c6796bddc7d1 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1229
diff changeset
  2835
        (aDevice isNil and:[device notNil]) ifTrue:[
c6796bddc7d1 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1229
diff changeset
  2836
            "/ trueColor device-colors are not registered
c6796bddc7d1 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1229
diff changeset
  2837
            device visualType ~~ #TrueColor ifTrue:[
1365
37a9e7ac4dbc moved color registration from Color class to per-device lobby
Claus Gittinger <cg@exept.de>
parents: 1348
diff changeset
  2838
                "/ Lobby unregister:self.
37a9e7ac4dbc moved color registration from Color class to per-device lobby
Claus Gittinger <cg@exept.de>
parents: 1348
diff changeset
  2839
                device unregisterColor:newColor.
1205
e28b664586f8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1165
diff changeset
  2840
                device freeColor:colorId
e28b664586f8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1165
diff changeset
  2841
            ].
1233
c6796bddc7d1 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1229
diff changeset
  2842
            device := nil.
c6796bddc7d1 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1229
diff changeset
  2843
            colorId := nil.
c6796bddc7d1 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1229
diff changeset
  2844
            ^ self
1205
e28b664586f8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1165
diff changeset
  2845
        ].
e28b664586f8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1165
diff changeset
  2846
    ].
e28b664586f8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1165
diff changeset
  2847
1368
cb5fbbcf568f checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1365
diff changeset
  2848
    "/ on high-resolution true-color systems, dont care for dithering and
1023
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
  2849
    "/ especially freeing colors
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
  2850
    "/ (no need to remember in Lobby)
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
  2851
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
  2852
    (deviceVisual := aDevice visualType) == #TrueColor ifTrue:[
1144
07f3de59864d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1023
diff changeset
  2853
        aDevice depth >= 15 ifTrue:[
07f3de59864d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1023
diff changeset
  2854
            id := aDevice colorScaledRed:red scaledGreen:green scaledBlue:blue.
07f3de59864d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1023
diff changeset
  2855
            id notNil ifTrue:[
07f3de59864d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1023
diff changeset
  2856
                device isNil ifTrue:[
07f3de59864d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1023
diff changeset
  2857
                    colorId := id.
07f3de59864d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1023
diff changeset
  2858
                    ditherForm := nil.
07f3de59864d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1023
diff changeset
  2859
                    ^ self
1233
c6796bddc7d1 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1229
diff changeset
  2860
                ].
c6796bddc7d1 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1229
diff changeset
  2861
                newColor := (self class basicNew) 
c6796bddc7d1 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1229
diff changeset
  2862
                                    setScaledRed:red 
c6796bddc7d1 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1229
diff changeset
  2863
                                    scaledGreen:green 
c6796bddc7d1 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1229
diff changeset
  2864
                                    scaledBlue:blue 
c6796bddc7d1 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1229
diff changeset
  2865
                                    device:aDevice.
1238
b363894182d0 prepare for replacement colors
Claus Gittinger <cg@exept.de>
parents: 1237
diff changeset
  2866
                newColor setColorId:id.
1233
c6796bddc7d1 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1229
diff changeset
  2867
                ^ newColor
1144
07f3de59864d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1023
diff changeset
  2868
            ] 
07f3de59864d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1023
diff changeset
  2869
        ] 
1023
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
  2870
    ].
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
  2871
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
  2872
    "/ round a bit within 1% in red & green, 2% in blue
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
  2873
1239
f4bd3bc9f3f9 oops - dont round when searching for existing colors
Claus Gittinger <cg@exept.de>
parents: 1238
diff changeset
  2874
    rV := red.
f4bd3bc9f3f9 oops - dont round when searching for existing colors
Claus Gittinger <cg@exept.de>
parents: 1238
diff changeset
  2875
    gV := green.
f4bd3bc9f3f9 oops - dont round when searching for existing colors
Claus Gittinger <cg@exept.de>
parents: 1238
diff changeset
  2876
    bV := blue.
f4bd3bc9f3f9 oops - dont round when searching for existing colors
Claus Gittinger <cg@exept.de>
parents: 1238
diff changeset
  2877
f4bd3bc9f3f9 oops - dont round when searching for existing colors
Claus Gittinger <cg@exept.de>
parents: 1238
diff changeset
  2878
"/    rV := (red / 100.0) rounded * 100.
f4bd3bc9f3f9 oops - dont round when searching for existing colors
Claus Gittinger <cg@exept.de>
parents: 1238
diff changeset
  2879
"/    gV := (green / 100.0) rounded * 100.
f4bd3bc9f3f9 oops - dont round when searching for existing colors
Claus Gittinger <cg@exept.de>
parents: 1238
diff changeset
  2880
"/    bV := (blue / 50.0) rounded * 50.
1023
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
  2881
1233
c6796bddc7d1 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1229
diff changeset
  2882
    "/ if I am already assigned to that device ...
c6796bddc7d1 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1229
diff changeset
  2883
1368
cb5fbbcf568f checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1365
diff changeset
  2884
"/    ((device == aDevice) and:[ditherForm notNil]) ifTrue:[
cb5fbbcf568f checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1365
diff changeset
  2885
"/
cb5fbbcf568f checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1365
diff changeset
  2886
"/        "/ mhmh - if I was dithered the last time (not enough colors then)
cb5fbbcf568f checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1365
diff changeset
  2887
"/        "/ try again - maybe some colors were reclaimed in the meanwhile
cb5fbbcf568f checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1365
diff changeset
  2888
"/
cb5fbbcf568f checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1365
diff changeset
  2889
"/        deviceFixColors := aDevice fixColors.
cb5fbbcf568f checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1365
diff changeset
  2890
"/
cb5fbbcf568f checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1365
diff changeset
  2891
"/        (deviceFixColors isNil
cb5fbbcf568f checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1365
diff changeset
  2892
"/         and:[RetryAllocation]) ifTrue:[
cb5fbbcf568f checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1365
diff changeset
  2893
"/            "
cb5fbbcf568f checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1365
diff changeset
  2894
"/             but there is no chance on b&w displays - so don't try
cb5fbbcf568f checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1365
diff changeset
  2895
"/            "
cb5fbbcf568f checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1365
diff changeset
  2896
"/            aDevice depth > 2 ifTrue:[
cb5fbbcf568f checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1365
diff changeset
  2897
"/                id := aDevice colorScaledRed:rV scaledGreen:gV scaledBlue:bV.
cb5fbbcf568f checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1365
diff changeset
  2898
"/                id notNil ifTrue:[
cb5fbbcf568f checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1365
diff changeset
  2899
"/                    colorId := id.
cb5fbbcf568f checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1365
diff changeset
  2900
"/                    ditherForm := nil.
cb5fbbcf568f checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1365
diff changeset
  2901
"/                    "/ Lobby register:self.
cb5fbbcf568f checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1365
diff changeset
  2902
"/                    device registerColor:self.
cb5fbbcf568f checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1365
diff changeset
  2903
"/                ]
cb5fbbcf568f checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1365
diff changeset
  2904
"/            ]
cb5fbbcf568f checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1365
diff changeset
  2905
"/        ].
cb5fbbcf568f checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1365
diff changeset
  2906
"/        ^ self
cb5fbbcf568f checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1365
diff changeset
  2907
"/    ].
1023
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
  2908
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
  2909
    newColor := Color existingColorScaledRed:rV scaledGreen:gV scaledBlue:bV on:aDevice.
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
  2910
    newColor notNil ifTrue:[^ newColor].
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
  2911
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
  2912
    "/
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
  2913
    "/ ok, we are going to dither that color.
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
  2914
    "/ if its 'almost' grey, make it grey and round it a bit (1%)
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
  2915
    "/
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
  2916
    greyV := (3 * red) + (6 * green) + (1 * blue).
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
  2917
    greyV := (greyV / 1000.0) rounded * 10.
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
  2918
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
  2919
    "/ allow an error of 1% in red & green, 2% in blue
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
  2920
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
  2921
    ((rV - greyV) abs <= 655                    "/ MaxValue // 100
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
  2922
    and:[(gV - greyV) abs <= 655                "/ MaxValue // 100
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
  2923
    and:[(bV - greyV) abs <= 1310]]) ifTrue:[   "/ MaxValue // 100 * 2
1144
07f3de59864d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1023
diff changeset
  2924
        rV := gV := bV := greyV.
1023
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
  2925
    ] ifFalse:[
1144
07f3de59864d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1023
diff changeset
  2926
        rV := red. gV := green. bV := blue.
1023
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
  2927
    ].
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
  2928
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
  2929
    aDevice hasColors ifTrue:[
1368
cb5fbbcf568f checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1365
diff changeset
  2930
        deviceFixColors := aDevice fixColors.
1144
07f3de59864d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1023
diff changeset
  2931
        deviceFixColors isNil ifTrue:[
07f3de59864d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1023
diff changeset
  2932
            "/ ask that device for the exact color
07f3de59864d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1023
diff changeset
  2933
            id := aDevice colorScaledRed:rV scaledGreen:gV scaledBlue:bV.
07f3de59864d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1023
diff changeset
  2934
            id isNil ifTrue:[
07f3de59864d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1023
diff changeset
  2935
                "/ this is a kludge: scavenge to free unused colors
07f3de59864d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1023
diff changeset
  2936
                "/ and try again ...
07f3de59864d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1023
diff changeset
  2937
                ObjectMemory scavenge; finalize.
07f3de59864d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1023
diff changeset
  2938
                id := aDevice colorScaledRed:rV scaledGreen:gV scaledBlue:bV
07f3de59864d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1023
diff changeset
  2939
            ].
07f3de59864d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1023
diff changeset
  2940
07f3de59864d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1023
diff changeset
  2941
            id isNil ifTrue:[
07f3de59864d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1023
diff changeset
  2942
                "/ no such color - try color dithers
07f3de59864d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1023
diff changeset
  2943
07f3de59864d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1023
diff changeset
  2944
                self ditherRed:rV green:gV blue:bV on:aDevice 
07f3de59864d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1023
diff changeset
  2945
                          into:[:c :f | newColor := c. form := f].
07f3de59864d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1023
diff changeset
  2946
                newColor notNil ifTrue:[^ newColor].
07f3de59864d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1023
diff changeset
  2947
            ].
07f3de59864d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1023
diff changeset
  2948
        ].
07f3de59864d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1023
diff changeset
  2949
07f3de59864d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1023
diff changeset
  2950
        "/ none found ? -> do a hard dither using fixColors
07f3de59864d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1023
diff changeset
  2951
07f3de59864d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1023
diff changeset
  2952
        (id isNil and:[form isNil]) ifTrue:[
07f3de59864d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1023
diff changeset
  2953
            (deviceFixColors notNil "and:[aDevice == Display]") ifTrue:[
07f3de59864d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1023
diff changeset
  2954
                self fixDitherRed:rV green:gV blue:bV on:aDevice 
07f3de59864d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1023
diff changeset
  2955
                             into:[:c :f | newColor := c. form := f].
07f3de59864d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1023
diff changeset
  2956
                newColor notNil ifTrue:[^ newColor].
07f3de59864d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1023
diff changeset
  2957
            ]
07f3de59864d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1023
diff changeset
  2958
        ].
07f3de59864d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1023
diff changeset
  2959
07f3de59864d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1023
diff changeset
  2960
        "/ still none found ? -> do a very hard dither using existing colors
07f3de59864d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1023
diff changeset
  2961
07f3de59864d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1023
diff changeset
  2962
        (id isNil and:[form isNil]) ifTrue:[
07f3de59864d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1023
diff changeset
  2963
            self complexDitherRed:rV green:gV blue:bV on:aDevice 
07f3de59864d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1023
diff changeset
  2964
                      into:[:c :f | newColor := c. form := f].
07f3de59864d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1023
diff changeset
  2965
            newColor notNil ifTrue:[^ newColor].
07f3de59864d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1023
diff changeset
  2966
        ].
1023
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
  2967
    ].
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
  2968
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
  2969
    (id isNil and:[form isNil]) ifTrue:[
1144
07f3de59864d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1023
diff changeset
  2970
        "still no result - try greying"
07f3de59864d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1023
diff changeset
  2971
07f3de59864d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1023
diff changeset
  2972
        greyV == 0 ifTrue:[
07f3de59864d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1023
diff changeset
  2973
            id := aDevice blackpixel
07f3de59864d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1023
diff changeset
  2974
        ] ifFalse:[
07f3de59864d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1023
diff changeset
  2975
            greyV == MaxValue ifTrue:[
07f3de59864d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1023
diff changeset
  2976
                id := aDevice whitepixel
07f3de59864d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1023
diff changeset
  2977
            ] ifFalse:[
07f3de59864d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1023
diff changeset
  2978
                aDevice hasGrayscales ifTrue:[
07f3de59864d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1023
diff changeset
  2979
                    self ditherGrayFor:(greyV / MaxValue)
07f3de59864d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1023
diff changeset
  2980
                                    on:aDevice
07f3de59864d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1023
diff changeset
  2981
                                  into:[:c :f | newColor := c. form := f].
07f3de59864d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1023
diff changeset
  2982
                    newColor notNil ifTrue:[^ newColor].
07f3de59864d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1023
diff changeset
  2983
                ].
07f3de59864d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1023
diff changeset
  2984
            ]
07f3de59864d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1023
diff changeset
  2985
        ].
1023
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
  2986
    ].
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
  2987
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
  2988
    device isNil ifTrue:[
1144
07f3de59864d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1023
diff changeset
  2989
        "/ receiver was not associated - do it now & return mySelf
07f3de59864d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1023
diff changeset
  2990
07f3de59864d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1023
diff changeset
  2991
        device := aDevice.
07f3de59864d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1023
diff changeset
  2992
        id isNil ifTrue:[
07f3de59864d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1023
diff changeset
  2993
            ditherForm := form
07f3de59864d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1023
diff changeset
  2994
        ].
07f3de59864d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1023
diff changeset
  2995
        colorId := id.
07f3de59864d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1023
diff changeset
  2996
07f3de59864d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1023
diff changeset
  2997
        "/ have to tell Lobby - otherwise it keeps old info around
07f3de59864d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1023
diff changeset
  2998
07f3de59864d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1023
diff changeset
  2999
        id notNil ifTrue:[
07f3de59864d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1023
diff changeset
  3000
            deviceVisual ~~ #TrueColor ifTrue:[    
1365
37a9e7ac4dbc moved color registration from Color class to per-device lobby
Claus Gittinger <cg@exept.de>
parents: 1348
diff changeset
  3001
                "/ Lobby register:self.
1368
cb5fbbcf568f checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1365
diff changeset
  3002
                aDevice registerColor:self.
1144
07f3de59864d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1023
diff changeset
  3003
            ]
07f3de59864d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1023
diff changeset
  3004
        ].
07f3de59864d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1023
diff changeset
  3005
        ^ self
1023
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
  3006
    ].
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
  3007
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
  3008
    "/ receiver was already associated to another device
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
  3009
    "/ - need a new color and return it
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
  3010
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
  3011
    newColor := (self class basicNew) 
1144
07f3de59864d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1023
diff changeset
  3012
                        setScaledRed:red 
07f3de59864d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1023
diff changeset
  3013
                        scaledGreen:green 
07f3de59864d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1023
diff changeset
  3014
                        scaledBlue:blue 
07f3de59864d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1023
diff changeset
  3015
                        device:aDevice.
1023
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
  3016
    id isNil ifTrue:[
1238
b363894182d0 prepare for replacement colors
Claus Gittinger <cg@exept.de>
parents: 1237
diff changeset
  3017
        newColor setDitherForm:form
1023
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
  3018
    ] ifFalse:[
1238
b363894182d0 prepare for replacement colors
Claus Gittinger <cg@exept.de>
parents: 1237
diff changeset
  3019
        newColor setColorId:id.
1233
c6796bddc7d1 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1229
diff changeset
  3020
c6796bddc7d1 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1229
diff changeset
  3021
        "/ trueColor device-colors are not registered
1144
07f3de59864d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1023
diff changeset
  3022
        deviceVisual ~~ #TrueColor ifTrue:[    
1365
37a9e7ac4dbc moved color registration from Color class to per-device lobby
Claus Gittinger <cg@exept.de>
parents: 1348
diff changeset
  3023
            "/ Lobby register:newColor.
1368
cb5fbbcf568f checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1365
diff changeset
  3024
            aDevice registerColor:newColor.
1144
07f3de59864d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1023
diff changeset
  3025
        ]
1023
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
  3026
    ].
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
  3027
    ^ newColor
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
  3028
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
  3029
    "Created: 16.11.1995 / 20:16:42 / cg"
1368
cb5fbbcf568f checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1365
diff changeset
  3030
    "Modified: 24.2.1997 / 22:01:16 / cg"
1023
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
  3031
! !
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
  3032
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
  3033
!Color methodsFor:'inspecting'!
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
  3034
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
  3035
inspectorClass
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
  3036
    "return the class of an appropriate inspector.
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
  3037
     ST/X has a specialized ColorInspectorView for that"
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
  3038
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
  3039
    ^ ColorInspectorView
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
  3040
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
  3041
    "Modified: 23.4.1996 / 13:39:50 / cg"
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
  3042
! !
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
  3043
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
  3044
!Color methodsFor:'instance creation'!
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
  3045
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
  3046
asHiliteColor
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
  3047
    "same as lightened - for ST-80 compatibility"
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
  3048
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
  3049
    ^ self lightened
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
  3050
!
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
  3051
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
  3052
asShadowColor
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
  3053
    "same as darkened - for ST-80 compatibility"
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
  3054
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
  3055
    ^ self darkened
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
  3056
!
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
  3057
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
  3058
blendWith:aColor
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
  3059
    "create a new color from equally mixing the receiver
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
  3060
     and the argument, aColor.
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
  3061
     Mixing is done by adding components 
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
  3062
     (which is different from mixing colors on paper ..)"
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
  3063
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
  3064
    red isNil ifTrue:[
1326
a519593747e8 #isGray - ST80 compatibility
Claus Gittinger <cg@exept.de>
parents: 1269
diff changeset
  3065
        ^ aColor
1023
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
  3066
    ].
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
  3067
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
  3068
    ^ (self class)
1326
a519593747e8 #isGray - ST80 compatibility
Claus Gittinger <cg@exept.de>
parents: 1269
diff changeset
  3069
        scaledRed:(red + aColor scaledRed) // 2
a519593747e8 #isGray - ST80 compatibility
Claus Gittinger <cg@exept.de>
parents: 1269
diff changeset
  3070
        scaledGreen:(green + aColor scaledGreen) // 2
a519593747e8 #isGray - ST80 compatibility
Claus Gittinger <cg@exept.de>
parents: 1269
diff changeset
  3071
        scaledBlue:(blue + aColor scaledBlue) // 2
1023
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
  3072
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
  3073
    "
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
  3074
     (Color red) blendWith:(Color yellow)
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
  3075
     (Color red) blendWith:(Color blue)
1326
a519593747e8 #isGray - ST80 compatibility
Claus Gittinger <cg@exept.de>
parents: 1269
diff changeset
  3076
     (Color red) blendWith:(Color black)
a519593747e8 #isGray - ST80 compatibility
Claus Gittinger <cg@exept.de>
parents: 1269
diff changeset
  3077
     (Color red) blendWith:(Color white)
1023
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
  3078
    "
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
  3079
1326
a519593747e8 #isGray - ST80 compatibility
Claus Gittinger <cg@exept.de>
parents: 1269
diff changeset
  3080
    "Modified: 10.2.1997 / 22:08:14 / cg"
1023
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
  3081
!
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
  3082
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
  3083
darkened
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
  3084
    "return a new color, which is slightly darker than the receiver"
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
  3085
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
  3086
    ^ self blendWith:Black
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
  3087
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
  3088
    "
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
  3089
     (Color red) darkened
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
  3090
     (Color red) darkened darkened
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
  3091
    "
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
  3092
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
  3093
    "Modified: 11.6.1996 / 18:10:37 / cg"
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
  3094
!
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
  3095
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
  3096
lightened
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
  3097
    "return a new color, which is slightly lighter than the receiver"
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
  3098
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
  3099
    ^ self blendWith:White
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
  3100
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
  3101
    "
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
  3102
     (Color red) lightened
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
  3103
     (Color red) lightened lightened
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
  3104
    "
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
  3105
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
  3106
    "Modified: 11.6.1996 / 18:10:49 / cg"
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
  3107
! !
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
  3108
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
  3109
!Color methodsFor:'instance release'!
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
  3110
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
  3111
shallowCopyForFinalization
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
  3112
    "redefined, since for finalization only device and colorIndex
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
  3113
     are needed - thus a faster copy is possible here"
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
  3114
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
  3115
    |aCopy|
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
  3116
1234
f06543bb7a8d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1233
diff changeset
  3117
    aCopy := DeviceColorHandle basicNew.
1023
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
  3118
    aCopy setDevice:device colorId:colorId.
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
  3119
    ^ aCopy
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
  3120
! !
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
  3121
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
  3122
!Color methodsFor:'printing & storing'!
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
  3123
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
  3124
printOn:aStream
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
  3125
    "append a string representing of the receiver
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
  3126
     to the argument, aStream"
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
  3127
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
  3128
    self storeOn:aStream
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
  3129
!
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
  3130
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
  3131
storeOn:aStream
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
  3132
    "append a string representing an expression to reconstruct the receiver
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
  3133
     to the argument, aStream"
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
  3134
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
  3135
    red isNil ifTrue:[
1348
acb4e4874e4d care for ColorValue (ColorValue cyan)
ca
parents: 1347
diff changeset
  3136
        colorId notNil ifTrue:[
acb4e4874e4d care for ColorValue (ColorValue cyan)
ca
parents: 1347
diff changeset
  3137
            aStream nextPutAll:'(Color colorId:'.
acb4e4874e4d care for ColorValue (ColorValue cyan)
ca
parents: 1347
diff changeset
  3138
            colorId storeOn:aStream.
acb4e4874e4d care for ColorValue (ColorValue cyan)
ca
parents: 1347
diff changeset
  3139
            aStream nextPut:$).
acb4e4874e4d care for ColorValue (ColorValue cyan)
ca
parents: 1347
diff changeset
  3140
            ^ self
acb4e4874e4d care for ColorValue (ColorValue cyan)
ca
parents: 1347
diff changeset
  3141
        ]
1023
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
  3142
    ].
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
  3143
    (red == green and:[red == blue]) ifTrue:[
1348
acb4e4874e4d care for ColorValue (ColorValue cyan)
ca
parents: 1347
diff changeset
  3144
        red == 0 ifTrue:[
acb4e4874e4d care for ColorValue (ColorValue cyan)
ca
parents: 1347
diff changeset
  3145
            aStream nextPutAll:'(Color black)'.
acb4e4874e4d care for ColorValue (ColorValue cyan)
ca
parents: 1347
diff changeset
  3146
        ] ifFalse:[
acb4e4874e4d care for ColorValue (ColorValue cyan)
ca
parents: 1347
diff changeset
  3147
            red == MaxValue ifTrue:[
acb4e4874e4d care for ColorValue (ColorValue cyan)
ca
parents: 1347
diff changeset
  3148
                aStream nextPutAll:'(Color white)'.
acb4e4874e4d care for ColorValue (ColorValue cyan)
ca
parents: 1347
diff changeset
  3149
            ] ifFalse:[
acb4e4874e4d care for ColorValue (ColorValue cyan)
ca
parents: 1347
diff changeset
  3150
                aStream nextPutAll:'(Color grey:'.
acb4e4874e4d care for ColorValue (ColorValue cyan)
ca
parents: 1347
diff changeset
  3151
                (self red) storeOn:aStream.
acb4e4874e4d care for ColorValue (ColorValue cyan)
ca
parents: 1347
diff changeset
  3152
                aStream nextPut:$).
acb4e4874e4d care for ColorValue (ColorValue cyan)
ca
parents: 1347
diff changeset
  3153
            ]
acb4e4874e4d care for ColorValue (ColorValue cyan)
ca
parents: 1347
diff changeset
  3154
        ].
acb4e4874e4d care for ColorValue (ColorValue cyan)
ca
parents: 1347
diff changeset
  3155
        ^ self
1023
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
  3156
    ].
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
  3157
    aStream nextPutAll:'(Color red:'.
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
  3158
    (self red) storeOn:aStream.
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
  3159
    aStream nextPutAll:' green:'.
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
  3160
    (self green) storeOn:aStream.
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
  3161
    aStream nextPutAll:' blue:'.
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
  3162
    (self blue) storeOn:aStream.
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
  3163
    aStream nextPut:$).
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
  3164
! !
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
  3165
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
  3166
!Color methodsFor:'private'!
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
  3167
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
  3168
complexDitherRed:red green:green blue:blue on:aDevice into:aBlock
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
  3169
    "get a deep dither form for an rgb value.
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
  3170
     Use all available colors for error dithering into a form."
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
  3171
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
  3172
    |errR errG errB f wantR wantG wantB clr 
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
  3173
     dir   "{ Class: SmallInteger }"
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
  3174
     start "{ Class: SmallInteger }"
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
  3175
     end   "{ Class: SmallInteger }" 
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
  3176
     map|
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
  3177
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
  3178
    errR := 0.
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
  3179
    errG := 0.
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
  3180
    errB := 0.
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
  3181
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
  3182
    "get a form and clear it"
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
  3183
    f := Form width:4 height:4 depth:(aDevice depth) on:aDevice.
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
  3184
    map := IdentityDictionary new.
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
  3185
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
  3186
    0 to:3 do:[:x |
1348
acb4e4874e4d care for ColorValue (ColorValue cyan)
ca
parents: 1347
diff changeset
  3187
        x even ifTrue:[
acb4e4874e4d care for ColorValue (ColorValue cyan)
ca
parents: 1347
diff changeset
  3188
            dir := 1.
acb4e4874e4d care for ColorValue (ColorValue cyan)
ca
parents: 1347
diff changeset
  3189
            start := 0.
acb4e4874e4d care for ColorValue (ColorValue cyan)
ca
parents: 1347
diff changeset
  3190
            end := 3.
acb4e4874e4d care for ColorValue (ColorValue cyan)
ca
parents: 1347
diff changeset
  3191
        ] ifFalse:[
acb4e4874e4d care for ColorValue (ColorValue cyan)
ca
parents: 1347
diff changeset
  3192
            dir := -1.
acb4e4874e4d care for ColorValue (ColorValue cyan)
ca
parents: 1347
diff changeset
  3193
            start := 3.
acb4e4874e4d care for ColorValue (ColorValue cyan)
ca
parents: 1347
diff changeset
  3194
            end := 0.
acb4e4874e4d care for ColorValue (ColorValue cyan)
ca
parents: 1347
diff changeset
  3195
        ].
acb4e4874e4d care for ColorValue (ColorValue cyan)
ca
parents: 1347
diff changeset
  3196
        start to:end by:dir do:[:y |
acb4e4874e4d care for ColorValue (ColorValue cyan)
ca
parents: 1347
diff changeset
  3197
            wantR := red + errR. 
acb4e4874e4d care for ColorValue (ColorValue cyan)
ca
parents: 1347
diff changeset
  3198
            wantR > MaxValue ifTrue:[
acb4e4874e4d care for ColorValue (ColorValue cyan)
ca
parents: 1347
diff changeset
  3199
                wantR := MaxValue
acb4e4874e4d care for ColorValue (ColorValue cyan)
ca
parents: 1347
diff changeset
  3200
            ] ifFalse:[ wantR < 0 ifTrue:[
acb4e4874e4d care for ColorValue (ColorValue cyan)
ca
parents: 1347
diff changeset
  3201
                wantR := 0
acb4e4874e4d care for ColorValue (ColorValue cyan)
ca
parents: 1347
diff changeset
  3202
            ]].
acb4e4874e4d care for ColorValue (ColorValue cyan)
ca
parents: 1347
diff changeset
  3203
acb4e4874e4d care for ColorValue (ColorValue cyan)
ca
parents: 1347
diff changeset
  3204
            wantG := green + errG.
acb4e4874e4d care for ColorValue (ColorValue cyan)
ca
parents: 1347
diff changeset
  3205
            wantG > MaxValue ifTrue:[
acb4e4874e4d care for ColorValue (ColorValue cyan)
ca
parents: 1347
diff changeset
  3206
                wantG := MaxValue
acb4e4874e4d care for ColorValue (ColorValue cyan)
ca
parents: 1347
diff changeset
  3207
            ] ifFalse:[ wantG < 0 ifTrue:[
acb4e4874e4d care for ColorValue (ColorValue cyan)
ca
parents: 1347
diff changeset
  3208
                wantG := 0
acb4e4874e4d care for ColorValue (ColorValue cyan)
ca
parents: 1347
diff changeset
  3209
            ]].
acb4e4874e4d care for ColorValue (ColorValue cyan)
ca
parents: 1347
diff changeset
  3210
acb4e4874e4d care for ColorValue (ColorValue cyan)
ca
parents: 1347
diff changeset
  3211
            wantB := blue + errB.
acb4e4874e4d care for ColorValue (ColorValue cyan)
ca
parents: 1347
diff changeset
  3212
            wantB > MaxValue ifTrue:[
acb4e4874e4d care for ColorValue (ColorValue cyan)
ca
parents: 1347
diff changeset
  3213
                wantB := MaxValue
acb4e4874e4d care for ColorValue (ColorValue cyan)
ca
parents: 1347
diff changeset
  3214
            ] ifFalse:[ wantB < 0 ifTrue:[
acb4e4874e4d care for ColorValue (ColorValue cyan)
ca
parents: 1347
diff changeset
  3215
                wantB := 0
acb4e4874e4d care for ColorValue (ColorValue cyan)
ca
parents: 1347
diff changeset
  3216
            ]].
acb4e4874e4d care for ColorValue (ColorValue cyan)
ca
parents: 1347
diff changeset
  3217
acb4e4874e4d care for ColorValue (ColorValue cyan)
ca
parents: 1347
diff changeset
  3218
            "find the nearest color"
1023
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
  3219
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
  3220
" "
1348
acb4e4874e4d care for ColorValue (ColorValue cyan)
ca
parents: 1347
diff changeset
  3221
            clr := Color quickNearestColorScaledRed:wantR scaledGreen:wantG scaledBlue:wantB on:aDevice.
1023
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
  3222
" "
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
  3223
"
1348
acb4e4874e4d care for ColorValue (ColorValue cyan)
ca
parents: 1347
diff changeset
  3224
            clr := Color nearestColorScaledRed:wantR green:wantG blue:wantB on:aDevice.
1023
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
  3225
"
1348
acb4e4874e4d care for ColorValue (ColorValue cyan)
ca
parents: 1347
diff changeset
  3226
            clr isNil ifTrue:[
acb4e4874e4d care for ColorValue (ColorValue cyan)
ca
parents: 1347
diff changeset
  3227
                clr := Color scaledRed:wantR scaledGreen:wantG scaledBlue:wantB.
acb4e4874e4d care for ColorValue (ColorValue cyan)
ca
parents: 1347
diff changeset
  3228
                clr brightness > 0.5 ifTrue:[
acb4e4874e4d care for ColorValue (ColorValue cyan)
ca
parents: 1347
diff changeset
  3229
                    clr := Color white on:aDevice
acb4e4874e4d care for ColorValue (ColorValue cyan)
ca
parents: 1347
diff changeset
  3230
                ] ifFalse:[
acb4e4874e4d care for ColorValue (ColorValue cyan)
ca
parents: 1347
diff changeset
  3231
                    clr := Color black on:aDevice
acb4e4874e4d care for ColorValue (ColorValue cyan)
ca
parents: 1347
diff changeset
  3232
                ]
1023
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
  3233
"
1348
acb4e4874e4d care for ColorValue (ColorValue cyan)
ca
parents: 1347
diff changeset
  3234
                ^ aBlock value:nil value:nil
1023
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
  3235
"
1348
acb4e4874e4d care for ColorValue (ColorValue cyan)
ca
parents: 1347
diff changeset
  3236
            ].
acb4e4874e4d care for ColorValue (ColorValue cyan)
ca
parents: 1347
diff changeset
  3237
acb4e4874e4d care for ColorValue (ColorValue cyan)
ca
parents: 1347
diff changeset
  3238
            f paint:clr.
acb4e4874e4d care for ColorValue (ColorValue cyan)
ca
parents: 1347
diff changeset
  3239
            f displayPointX:x y:y.
acb4e4874e4d care for ColorValue (ColorValue cyan)
ca
parents: 1347
diff changeset
  3240
            map at:clr colorId + 1 put:clr.
acb4e4874e4d care for ColorValue (ColorValue cyan)
ca
parents: 1347
diff changeset
  3241
acb4e4874e4d care for ColorValue (ColorValue cyan)
ca
parents: 1347
diff changeset
  3242
            "compute the new error"
acb4e4874e4d care for ColorValue (ColorValue cyan)
ca
parents: 1347
diff changeset
  3243
            errR := wantR - clr scaledRed.
acb4e4874e4d care for ColorValue (ColorValue cyan)
ca
parents: 1347
diff changeset
  3244
            errG := wantG - clr scaledGreen.
acb4e4874e4d care for ColorValue (ColorValue cyan)
ca
parents: 1347
diff changeset
  3245
            errB := wantB - clr scaledBlue.
acb4e4874e4d care for ColorValue (ColorValue cyan)
ca
parents: 1347
diff changeset
  3246
        ].
1023
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
  3247
    ].
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
  3248
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
  3249
    f colorMap:map.
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
  3250
"
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
  3251
'hard dither' printNewline.
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
  3252
"
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
  3253
    ^ aBlock value:nil value:f
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
  3254
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
  3255
    "Modified: 14.6.1996 / 20:13:39 / cg"
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
  3256
!
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
  3257
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
  3258
ditherGrayFor:fraction on:aDevice into:aBlock
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
  3259
    "get a dither form or colorId for a brightness value.
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
  3260
     Returns 2 values (either color or ditherForm) through aBlock."
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
  3261
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
  3262
    |d nGray grayBelow scaledGrey scaledGray1 scaledGray2 clr1 clr2 newFraction step|
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
  3263
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
  3264
    d := aDevice depth.
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
  3265
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
  3266
    "/ special code for b&w displays
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
  3267
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
  3268
    d == 1 ifTrue:[
1348
acb4e4874e4d care for ColorValue (ColorValue cyan)
ca
parents: 1347
diff changeset
  3269
        aDevice blackpixel == 0 ifTrue:[
acb4e4874e4d care for ColorValue (ColorValue cyan)
ca
parents: 1347
diff changeset
  3270
            clr1 := Black.
acb4e4874e4d care for ColorValue (ColorValue cyan)
ca
parents: 1347
diff changeset
  3271
            clr2 := White.
acb4e4874e4d care for ColorValue (ColorValue cyan)
ca
parents: 1347
diff changeset
  3272
            newFraction := fraction.
acb4e4874e4d care for ColorValue (ColorValue cyan)
ca
parents: 1347
diff changeset
  3273
        ] ifFalse:[
acb4e4874e4d care for ColorValue (ColorValue cyan)
ca
parents: 1347
diff changeset
  3274
            clr1 := White.
acb4e4874e4d care for ColorValue (ColorValue cyan)
ca
parents: 1347
diff changeset
  3275
            clr2 := Black.
acb4e4874e4d care for ColorValue (ColorValue cyan)
ca
parents: 1347
diff changeset
  3276
            newFraction := 1 - fraction
acb4e4874e4d care for ColorValue (ColorValue cyan)
ca
parents: 1347
diff changeset
  3277
        ]
1023
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
  3278
    ] ifFalse:[
1348
acb4e4874e4d care for ColorValue (ColorValue cyan)
ca
parents: 1347
diff changeset
  3279
        "/ special code for 2-plane displays (NeXT)
acb4e4874e4d care for ColorValue (ColorValue cyan)
ca
parents: 1347
diff changeset
  3280
acb4e4874e4d care for ColorValue (ColorValue cyan)
ca
parents: 1347
diff changeset
  3281
        d == 2 ifTrue:[
acb4e4874e4d care for ColorValue (ColorValue cyan)
ca
parents: 1347
diff changeset
  3282
            fraction <= 0.01 ifTrue:[
acb4e4874e4d care for ColorValue (ColorValue cyan)
ca
parents: 1347
diff changeset
  3283
                clr1 := Black exactOn:aDevice
acb4e4874e4d care for ColorValue (ColorValue cyan)
ca
parents: 1347
diff changeset
  3284
            ] ifFalse:[
acb4e4874e4d care for ColorValue (ColorValue cyan)
ca
parents: 1347
diff changeset
  3285
                (fraction between:0.32 and:0.34) ifTrue:[
acb4e4874e4d care for ColorValue (ColorValue cyan)
ca
parents: 1347
diff changeset
  3286
                    clr1 := (Color gray:33) exactOn:aDevice
acb4e4874e4d care for ColorValue (ColorValue cyan)
ca
parents: 1347
diff changeset
  3287
                ] ifFalse:[
acb4e4874e4d care for ColorValue (ColorValue cyan)
ca
parents: 1347
diff changeset
  3288
                    (fraction between:0.66 and:0.68) ifTrue:[
acb4e4874e4d care for ColorValue (ColorValue cyan)
ca
parents: 1347
diff changeset
  3289
                        clr1 := (Color gray:67) exactOn:aDevice
acb4e4874e4d care for ColorValue (ColorValue cyan)
ca
parents: 1347
diff changeset
  3290
                    ] ifFalse:[
acb4e4874e4d care for ColorValue (ColorValue cyan)
ca
parents: 1347
diff changeset
  3291
                        fraction >= 0.99 ifTrue:[
acb4e4874e4d care for ColorValue (ColorValue cyan)
ca
parents: 1347
diff changeset
  3292
                            clr1 := White exactOn:aDevice
acb4e4874e4d care for ColorValue (ColorValue cyan)
ca
parents: 1347
diff changeset
  3293
                        ]
acb4e4874e4d care for ColorValue (ColorValue cyan)
ca
parents: 1347
diff changeset
  3294
                    ]
acb4e4874e4d care for ColorValue (ColorValue cyan)
ca
parents: 1347
diff changeset
  3295
                ]
acb4e4874e4d care for ColorValue (ColorValue cyan)
ca
parents: 1347
diff changeset
  3296
            ].
acb4e4874e4d care for ColorValue (ColorValue cyan)
ca
parents: 1347
diff changeset
  3297
            clr1 notNil ifTrue:[
acb4e4874e4d care for ColorValue (ColorValue cyan)
ca
parents: 1347
diff changeset
  3298
                ^ aBlock value:clr1 value:nil
acb4e4874e4d care for ColorValue (ColorValue cyan)
ca
parents: 1347
diff changeset
  3299
            ].
acb4e4874e4d care for ColorValue (ColorValue cyan)
ca
parents: 1347
diff changeset
  3300
acb4e4874e4d care for ColorValue (ColorValue cyan)
ca
parents: 1347
diff changeset
  3301
            (fraction between:0 and:0.33) ifTrue:[
acb4e4874e4d care for ColorValue (ColorValue cyan)
ca
parents: 1347
diff changeset
  3302
                clr1 := Black.
acb4e4874e4d care for ColorValue (ColorValue cyan)
ca
parents: 1347
diff changeset
  3303
                clr2 := Color gray:33.
acb4e4874e4d care for ColorValue (ColorValue cyan)
ca
parents: 1347
diff changeset
  3304
            ] ifFalse:[
acb4e4874e4d care for ColorValue (ColorValue cyan)
ca
parents: 1347
diff changeset
  3305
                (fraction between:0.34 and:0.66) ifTrue:[
acb4e4874e4d care for ColorValue (ColorValue cyan)
ca
parents: 1347
diff changeset
  3306
                    clr1 := Color gray:33.
acb4e4874e4d care for ColorValue (ColorValue cyan)
ca
parents: 1347
diff changeset
  3307
                    clr2 := Color gray:67.
acb4e4874e4d care for ColorValue (ColorValue cyan)
ca
parents: 1347
diff changeset
  3308
                ] ifFalse:[
acb4e4874e4d care for ColorValue (ColorValue cyan)
ca
parents: 1347
diff changeset
  3309
                    clr1 := Color gray:67.
acb4e4874e4d care for ColorValue (ColorValue cyan)
ca
parents: 1347
diff changeset
  3310
                    clr2 := White.
acb4e4874e4d care for ColorValue (ColorValue cyan)
ca
parents: 1347
diff changeset
  3311
                ]
acb4e4874e4d care for ColorValue (ColorValue cyan)
ca
parents: 1347
diff changeset
  3312
            ].
acb4e4874e4d care for ColorValue (ColorValue cyan)
ca
parents: 1347
diff changeset
  3313
            scaledGray1 := clr1 scaledRed.
acb4e4874e4d care for ColorValue (ColorValue cyan)
ca
parents: 1347
diff changeset
  3314
            scaledGray2 := clr2 scaledRed.
acb4e4874e4d care for ColorValue (ColorValue cyan)
ca
parents: 1347
diff changeset
  3315
acb4e4874e4d care for ColorValue (ColorValue cyan)
ca
parents: 1347
diff changeset
  3316
            scaledGrey := (MaxValue * fraction) rounded.
acb4e4874e4d care for ColorValue (ColorValue cyan)
ca
parents: 1347
diff changeset
  3317
acb4e4874e4d care for ColorValue (ColorValue cyan)
ca
parents: 1347
diff changeset
  3318
            newFraction := (scaledGrey - scaledGray1) asFloat / (scaledGray2 - scaledGray1).
acb4e4874e4d care for ColorValue (ColorValue cyan)
ca
parents: 1347
diff changeset
  3319
        ] ifFalse:[
acb4e4874e4d care for ColorValue (ColorValue cyan)
ca
parents: 1347
diff changeset
  3320
            nGray := (1 bitShift:d) - 1.
acb4e4874e4d care for ColorValue (ColorValue cyan)
ca
parents: 1347
diff changeset
  3321
acb4e4874e4d care for ColorValue (ColorValue cyan)
ca
parents: 1347
diff changeset
  3322
            "/ scale greyValue into grey levels
acb4e4874e4d care for ColorValue (ColorValue cyan)
ca
parents: 1347
diff changeset
  3323
acb4e4874e4d care for ColorValue (ColorValue cyan)
ca
parents: 1347
diff changeset
  3324
            grayBelow := (fraction * nGray) truncated.
acb4e4874e4d care for ColorValue (ColorValue cyan)
ca
parents: 1347
diff changeset
  3325
acb4e4874e4d care for ColorValue (ColorValue cyan)
ca
parents: 1347
diff changeset
  3326
            grayBelow < 0 ifTrue:[
acb4e4874e4d care for ColorValue (ColorValue cyan)
ca
parents: 1347
diff changeset
  3327
                ^ Color black exactOn:aDevice
acb4e4874e4d care for ColorValue (ColorValue cyan)
ca
parents: 1347
diff changeset
  3328
            ].
acb4e4874e4d care for ColorValue (ColorValue cyan)
ca
parents: 1347
diff changeset
  3329
            grayBelow >= nGray ifTrue:[
acb4e4874e4d care for ColorValue (ColorValue cyan)
ca
parents: 1347
diff changeset
  3330
                ^ Color white exactOn:aDevice
acb4e4874e4d care for ColorValue (ColorValue cyan)
ca
parents: 1347
diff changeset
  3331
            ].
acb4e4874e4d care for ColorValue (ColorValue cyan)
ca
parents: 1347
diff changeset
  3332
acb4e4874e4d care for ColorValue (ColorValue cyan)
ca
parents: 1347
diff changeset
  3333
            scaledGrey := (MaxValue * fraction) rounded.
acb4e4874e4d care for ColorValue (ColorValue cyan)
ca
parents: 1347
diff changeset
  3334
acb4e4874e4d care for ColorValue (ColorValue cyan)
ca
parents: 1347
diff changeset
  3335
            step := MaxValue // nGray.
acb4e4874e4d care for ColorValue (ColorValue cyan)
ca
parents: 1347
diff changeset
  3336
            scaledGray1 := grayBelow * step.
acb4e4874e4d care for ColorValue (ColorValue cyan)
ca
parents: 1347
diff changeset
  3337
            scaledGray2 := scaledGray1 + step.
acb4e4874e4d care for ColorValue (ColorValue cyan)
ca
parents: 1347
diff changeset
  3338
acb4e4874e4d care for ColorValue (ColorValue cyan)
ca
parents: 1347
diff changeset
  3339
            clr1 := Color scaledGray:scaledGray1.
acb4e4874e4d care for ColorValue (ColorValue cyan)
ca
parents: 1347
diff changeset
  3340
            clr2 := Color scaledGray:scaledGray2.
acb4e4874e4d care for ColorValue (ColorValue cyan)
ca
parents: 1347
diff changeset
  3341
acb4e4874e4d care for ColorValue (ColorValue cyan)
ca
parents: 1347
diff changeset
  3342
            "/ scale remainder in between low..high
acb4e4874e4d care for ColorValue (ColorValue cyan)
ca
parents: 1347
diff changeset
  3343
            newFraction := (scaledGrey - scaledGray1) asFloat / (scaledGray2 - scaledGray1).
acb4e4874e4d care for ColorValue (ColorValue cyan)
ca
parents: 1347
diff changeset
  3344
acb4e4874e4d care for ColorValue (ColorValue cyan)
ca
parents: 1347
diff changeset
  3345
            "/ dither between those two colors
acb4e4874e4d care for ColorValue (ColorValue cyan)
ca
parents: 1347
diff changeset
  3346
        ].
1023
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
  3347
    ].
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
  3348
    clr1 := clr1 exactOn:aDevice.
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
  3349
    clr2 := clr2 exactOn:aDevice.
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
  3350
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
  3351
    ^ self monoDitherFor:newFraction 
1348
acb4e4874e4d care for ColorValue (ColorValue cyan)
ca
parents: 1347
diff changeset
  3352
                 between:clr1 and:clr2
acb4e4874e4d care for ColorValue (ColorValue cyan)
ca
parents: 1347
diff changeset
  3353
                      on:aDevice into:aBlock
1023
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
  3354
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
  3355
    "
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
  3356
     Color basicNew
1348
acb4e4874e4d care for ColorValue (ColorValue cyan)
ca
parents: 1347
diff changeset
  3357
        ditherGrayFor:0.5 
acb4e4874e4d care for ColorValue (ColorValue cyan)
ca
parents: 1347
diff changeset
  3358
        on:Display 
acb4e4874e4d care for ColorValue (ColorValue cyan)
ca
parents: 1347
diff changeset
  3359
        into:[:clr :form | clr notNil ifTrue:[clr inspect].
acb4e4874e4d care for ColorValue (ColorValue cyan)
ca
parents: 1347
diff changeset
  3360
                           form notNil ifTrue:[(form magnifiedBy:16) inspect].]
1023
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
  3361
    "
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
  3362
    "
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
  3363
     Color basicNew
1348
acb4e4874e4d care for ColorValue (ColorValue cyan)
ca
parents: 1347
diff changeset
  3364
        ditherGrayFor:0.25 
acb4e4874e4d care for ColorValue (ColorValue cyan)
ca
parents: 1347
diff changeset
  3365
        on:Display 
acb4e4874e4d care for ColorValue (ColorValue cyan)
ca
parents: 1347
diff changeset
  3366
        into:[:clr :form | clr notNil ifTrue:[clr inspect].
acb4e4874e4d care for ColorValue (ColorValue cyan)
ca
parents: 1347
diff changeset
  3367
                           form notNil ifTrue:[(form magnifiedBy:16) inspect].]
1023
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
  3368
    "
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
  3369
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
  3370
    "Modified: 11.6.1996 / 17:08:14 / cg"
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
  3371
!
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
  3372
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
  3373
ditherRed:rV green:gV blue:bV on:aDevice into:aBlock
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
  3374
    "get a dither form or colorId for an rgb value.
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
  3375
     Returns 2 values (either color or ditherForm) through
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
  3376
     aBlock.
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
  3377
     This code is just a minimum of what is really needed,
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
  3378
     and needs much more work. Currently only some special cases
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
  3379
     are handled"
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
  3380
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
  3381
    |rh rl rs 
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
  3382
     lowL hiL lowValL hiValL lowS hiS lowValS hiValS lowH hiH lowValH hiValH d|
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
  3383
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
  3384
    "get hls (since we dither anyway, round them a bit"
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
  3385
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
  3386
    Color withHLSFromScaledRed:rV scaledGreen:gV scaledBlue:bV do:[:h :l :s |
1348
acb4e4874e4d care for ColorValue (ColorValue cyan)
ca
parents: 1347
diff changeset
  3387
        h notNil ifTrue:[
acb4e4874e4d care for ColorValue (ColorValue cyan)
ca
parents: 1347
diff changeset
  3388
            rh := (h * 3.0) rounded / 3.0.
acb4e4874e4d care for ColorValue (ColorValue cyan)
ca
parents: 1347
diff changeset
  3389
        ].
acb4e4874e4d care for ColorValue (ColorValue cyan)
ca
parents: 1347
diff changeset
  3390
        rl := (l * 3.0) rounded / 3.0.
acb4e4874e4d care for ColorValue (ColorValue cyan)
ca
parents: 1347
diff changeset
  3391
        rs := (s * 3.0) rounded / 3.0.
1023
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
  3392
    ].
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
  3393
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
  3394
    rh isNil ifTrue:[
1348
acb4e4874e4d care for ColorValue (ColorValue cyan)
ca
parents: 1347
diff changeset
  3395
        "achromatic,  dither between achromatic colors"
acb4e4874e4d care for ColorValue (ColorValue cyan)
ca
parents: 1347
diff changeset
  3396
acb4e4874e4d care for ColorValue (ColorValue cyan)
ca
parents: 1347
diff changeset
  3397
        lowL := nil.
acb4e4874e4d care for ColorValue (ColorValue cyan)
ca
parents: 1347
diff changeset
  3398
        hiL := nil.
acb4e4874e4d care for ColorValue (ColorValue cyan)
ca
parents: 1347
diff changeset
  3399
acb4e4874e4d care for ColorValue (ColorValue cyan)
ca
parents: 1347
diff changeset
  3400
        "find the 2 bounding colors"
1365
37a9e7ac4dbc moved color registration from Color class to per-device lobby
Claus Gittinger <cg@exept.de>
parents: 1348
diff changeset
  3401
        aDevice deviceColors do:[:aColor |
1348
acb4e4874e4d care for ColorValue (ColorValue cyan)
ca
parents: 1347
diff changeset
  3402
            aColor colorId notNil ifTrue:[
1023
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
  3403
                
1348
acb4e4874e4d care for ColorValue (ColorValue cyan)
ca
parents: 1347
diff changeset
  3404
                Color withHLSFromRed:aColor red green:aColor green blue:aColor blue do:[:h :l :s |
acb4e4874e4d care for ColorValue (ColorValue cyan)
ca
parents: 1347
diff changeset
  3405
                    | cl |
acb4e4874e4d care for ColorValue (ColorValue cyan)
ca
parents: 1347
diff changeset
  3406
acb4e4874e4d care for ColorValue (ColorValue cyan)
ca
parents: 1347
diff changeset
  3407
                    h isNil ifTrue:[
acb4e4874e4d care for ColorValue (ColorValue cyan)
ca
parents: 1347
diff changeset
  3408
                        cl := (l * 3.0) rounded / 3.0.
acb4e4874e4d care for ColorValue (ColorValue cyan)
ca
parents: 1347
diff changeset
  3409
acb4e4874e4d care for ColorValue (ColorValue cyan)
ca
parents: 1347
diff changeset
  3410
                        cl > rl ifTrue:[
acb4e4874e4d care for ColorValue (ColorValue cyan)
ca
parents: 1347
diff changeset
  3411
                            hiL isNil ifTrue:[
acb4e4874e4d care for ColorValue (ColorValue cyan)
ca
parents: 1347
diff changeset
  3412
                                hiL := aColor.
acb4e4874e4d care for ColorValue (ColorValue cyan)
ca
parents: 1347
diff changeset
  3413
                                hiValL := cl.
acb4e4874e4d care for ColorValue (ColorValue cyan)
ca
parents: 1347
diff changeset
  3414
                            ] ifFalse:[
acb4e4874e4d care for ColorValue (ColorValue cyan)
ca
parents: 1347
diff changeset
  3415
                                cl < hiValL ifTrue:[
acb4e4874e4d care for ColorValue (ColorValue cyan)
ca
parents: 1347
diff changeset
  3416
                                    hiL := aColor.
acb4e4874e4d care for ColorValue (ColorValue cyan)
ca
parents: 1347
diff changeset
  3417
                                    hiValL := cl.
acb4e4874e4d care for ColorValue (ColorValue cyan)
ca
parents: 1347
diff changeset
  3418
                                ]
acb4e4874e4d care for ColorValue (ColorValue cyan)
ca
parents: 1347
diff changeset
  3419
                            ]
acb4e4874e4d care for ColorValue (ColorValue cyan)
ca
parents: 1347
diff changeset
  3420
                        ] ifFalse:[
acb4e4874e4d care for ColorValue (ColorValue cyan)
ca
parents: 1347
diff changeset
  3421
                            lowL isNil ifTrue:[
acb4e4874e4d care for ColorValue (ColorValue cyan)
ca
parents: 1347
diff changeset
  3422
                                lowL := aColor.
acb4e4874e4d care for ColorValue (ColorValue cyan)
ca
parents: 1347
diff changeset
  3423
                                lowValL := cl
acb4e4874e4d care for ColorValue (ColorValue cyan)
ca
parents: 1347
diff changeset
  3424
                            ] ifFalse:[
acb4e4874e4d care for ColorValue (ColorValue cyan)
ca
parents: 1347
diff changeset
  3425
                                cl > lowValL ifTrue:[
acb4e4874e4d care for ColorValue (ColorValue cyan)
ca
parents: 1347
diff changeset
  3426
                                    lowL := aColor.
acb4e4874e4d care for ColorValue (ColorValue cyan)
ca
parents: 1347
diff changeset
  3427
                                    lowValL := cl
acb4e4874e4d care for ColorValue (ColorValue cyan)
ca
parents: 1347
diff changeset
  3428
                                ]
acb4e4874e4d care for ColorValue (ColorValue cyan)
ca
parents: 1347
diff changeset
  3429
                            ]
acb4e4874e4d care for ColorValue (ColorValue cyan)
ca
parents: 1347
diff changeset
  3430
                        ]
acb4e4874e4d care for ColorValue (ColorValue cyan)
ca
parents: 1347
diff changeset
  3431
                    ]
acb4e4874e4d care for ColorValue (ColorValue cyan)
ca
parents: 1347
diff changeset
  3432
                ]
acb4e4874e4d care for ColorValue (ColorValue cyan)
ca
parents: 1347
diff changeset
  3433
            ]
acb4e4874e4d care for ColorValue (ColorValue cyan)
ca
parents: 1347
diff changeset
  3434
        ].
acb4e4874e4d care for ColorValue (ColorValue cyan)
ca
parents: 1347
diff changeset
  3435
acb4e4874e4d care for ColorValue (ColorValue cyan)
ca
parents: 1347
diff changeset
  3436
        (lowL notNil and:[hiL notNil]) ifTrue:[
acb4e4874e4d care for ColorValue (ColorValue cyan)
ca
parents: 1347
diff changeset
  3437
            ^ self monoDitherFor:1.0 / (hiValL - lowValL) * (rl - lowValL)
acb4e4874e4d care for ColorValue (ColorValue cyan)
ca
parents: 1347
diff changeset
  3438
                         between:lowL
acb4e4874e4d care for ColorValue (ColorValue cyan)
ca
parents: 1347
diff changeset
  3439
                             and:hiL 
acb4e4874e4d care for ColorValue (ColorValue cyan)
ca
parents: 1347
diff changeset
  3440
                              on:aDevice
acb4e4874e4d care for ColorValue (ColorValue cyan)
ca
parents: 1347
diff changeset
  3441
                            into:aBlock
acb4e4874e4d care for ColorValue (ColorValue cyan)
ca
parents: 1347
diff changeset
  3442
        ].
acb4e4874e4d care for ColorValue (ColorValue cyan)
ca
parents: 1347
diff changeset
  3443
        "cannot happen, should always find at least black and white"
acb4e4874e4d care for ColorValue (ColorValue cyan)
ca
parents: 1347
diff changeset
  3444
        self error:'cannot happen'.
acb4e4874e4d care for ColorValue (ColorValue cyan)
ca
parents: 1347
diff changeset
  3445
        ^ aBlock value:nil value:nil
1023
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
  3446
    ].
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
  3447
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
  3448
    "chromatic case"
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
  3449
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
  3450
    aDevice hasColors ifFalse:[
1348
acb4e4874e4d care for ColorValue (ColorValue cyan)
ca
parents: 1347
diff changeset
  3451
        "no chance, return nil values"
acb4e4874e4d care for ColorValue (ColorValue cyan)
ca
parents: 1347
diff changeset
  3452
        ^ aBlock value:nil value:nil
1023
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
  3453
    ].
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
  3454
    (Red isNil or:[Green isNil or:[Blue isNil]]) ifTrue:[
1348
acb4e4874e4d care for ColorValue (ColorValue cyan)
ca
parents: 1347
diff changeset
  3455
        "if we where not able to get primary colors: no chance"
acb4e4874e4d care for ColorValue (ColorValue cyan)
ca
parents: 1347
diff changeset
  3456
        ^ aBlock value:nil value:nil
1023
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
  3457
    ].
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
  3458
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
  3459
    "try to find two bounding colors with same hue and saturation;
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
  3460
     dither on light between those"
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
  3461
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
  3462
    lowL := nil.
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
  3463
    hiL := nil.
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
  3464
    lowS := nil.
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
  3465
    hiS := nil.
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
  3466
    lowH := nil.
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
  3467
    hiH := nil.
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
  3468
1365
37a9e7ac4dbc moved color registration from Color class to per-device lobby
Claus Gittinger <cg@exept.de>
parents: 1348
diff changeset
  3469
    aDevice deviceColors do:[:aColor |
1348
acb4e4874e4d care for ColorValue (ColorValue cyan)
ca
parents: 1347
diff changeset
  3470
        aColor colorId notNil ifTrue:[
acb4e4874e4d care for ColorValue (ColorValue cyan)
ca
parents: 1347
diff changeset
  3471
            Color withHLSFromRed:aColor red green:aColor green blue:aColor blue do:[:h :l :s |
acb4e4874e4d care for ColorValue (ColorValue cyan)
ca
parents: 1347
diff changeset
  3472
                | cl ch cs|
acb4e4874e4d care for ColorValue (ColorValue cyan)
ca
parents: 1347
diff changeset
  3473
acb4e4874e4d care for ColorValue (ColorValue cyan)
ca
parents: 1347
diff changeset
  3474
                h notNil ifTrue:[
acb4e4874e4d care for ColorValue (ColorValue cyan)
ca
parents: 1347
diff changeset
  3475
                   ch := (h * 3.0) rounded / 3.0.
acb4e4874e4d care for ColorValue (ColorValue cyan)
ca
parents: 1347
diff changeset
  3476
                ] ifFalse:[
acb4e4874e4d care for ColorValue (ColorValue cyan)
ca
parents: 1347
diff changeset
  3477
                   ch := nil
acb4e4874e4d care for ColorValue (ColorValue cyan)
ca
parents: 1347
diff changeset
  3478
                ].
acb4e4874e4d care for ColorValue (ColorValue cyan)
ca
parents: 1347
diff changeset
  3479
                cl := (l * 3.0) rounded / 3.0.
acb4e4874e4d care for ColorValue (ColorValue cyan)
ca
parents: 1347
diff changeset
  3480
                cs := (s * 3.0) rounded / 3.0.
acb4e4874e4d care for ColorValue (ColorValue cyan)
ca
parents: 1347
diff changeset
  3481
acb4e4874e4d care for ColorValue (ColorValue cyan)
ca
parents: 1347
diff changeset
  3482
                ((ch = rh) and:[cs = rs]) ifTrue:[
acb4e4874e4d care for ColorValue (ColorValue cyan)
ca
parents: 1347
diff changeset
  3483
                    "found a color with same saturation and same hue, keep for light"
acb4e4874e4d care for ColorValue (ColorValue cyan)
ca
parents: 1347
diff changeset
  3484
acb4e4874e4d care for ColorValue (ColorValue cyan)
ca
parents: 1347
diff changeset
  3485
                    cl > rl ifTrue:[
acb4e4874e4d care for ColorValue (ColorValue cyan)
ca
parents: 1347
diff changeset
  3486
                        hiL isNil ifTrue:[
acb4e4874e4d care for ColorValue (ColorValue cyan)
ca
parents: 1347
diff changeset
  3487
                            hiL := aColor.
acb4e4874e4d care for ColorValue (ColorValue cyan)
ca
parents: 1347
diff changeset
  3488
                            hiValL := cl
acb4e4874e4d care for ColorValue (ColorValue cyan)
ca
parents: 1347
diff changeset
  3489
                        ] ifFalse:[
acb4e4874e4d care for ColorValue (ColorValue cyan)
ca
parents: 1347
diff changeset
  3490
                            cl < hiValL ifTrue:[
acb4e4874e4d care for ColorValue (ColorValue cyan)
ca
parents: 1347
diff changeset
  3491
                                hiL := aColor.
acb4e4874e4d care for ColorValue (ColorValue cyan)
ca
parents: 1347
diff changeset
  3492
                                hiValL := cl
acb4e4874e4d care for ColorValue (ColorValue cyan)
ca
parents: 1347
diff changeset
  3493
                            ]
acb4e4874e4d care for ColorValue (ColorValue cyan)
ca
parents: 1347
diff changeset
  3494
                        ].
acb4e4874e4d care for ColorValue (ColorValue cyan)
ca
parents: 1347
diff changeset
  3495
                    ] ifFalse:[
acb4e4874e4d care for ColorValue (ColorValue cyan)
ca
parents: 1347
diff changeset
  3496
                        lowL isNil ifTrue:[
acb4e4874e4d care for ColorValue (ColorValue cyan)
ca
parents: 1347
diff changeset
  3497
                            lowL := aColor.
acb4e4874e4d care for ColorValue (ColorValue cyan)
ca
parents: 1347
diff changeset
  3498
                            lowValL := cl
acb4e4874e4d care for ColorValue (ColorValue cyan)
ca
parents: 1347
diff changeset
  3499
                        ] ifFalse:[
acb4e4874e4d care for ColorValue (ColorValue cyan)
ca
parents: 1347
diff changeset
  3500
                            cl > lowValL ifTrue:[
acb4e4874e4d care for ColorValue (ColorValue cyan)
ca
parents: 1347
diff changeset
  3501
                                lowL := aColor.
acb4e4874e4d care for ColorValue (ColorValue cyan)
ca
parents: 1347
diff changeset
  3502
                                lowValL := cl
acb4e4874e4d care for ColorValue (ColorValue cyan)
ca
parents: 1347
diff changeset
  3503
                            ]
acb4e4874e4d care for ColorValue (ColorValue cyan)
ca
parents: 1347
diff changeset
  3504
                        ]
acb4e4874e4d care for ColorValue (ColorValue cyan)
ca
parents: 1347
diff changeset
  3505
                    ]
acb4e4874e4d care for ColorValue (ColorValue cyan)
ca
parents: 1347
diff changeset
  3506
                ].
acb4e4874e4d care for ColorValue (ColorValue cyan)
ca
parents: 1347
diff changeset
  3507
acb4e4874e4d care for ColorValue (ColorValue cyan)
ca
parents: 1347
diff changeset
  3508
                (((ch = rh) or:[ch == nil]) and:[cl = rl]) ifTrue:[
acb4e4874e4d care for ColorValue (ColorValue cyan)
ca
parents: 1347
diff changeset
  3509
                    "found a color with same light and same hue, keep for saturation"
acb4e4874e4d care for ColorValue (ColorValue cyan)
ca
parents: 1347
diff changeset
  3510
acb4e4874e4d care for ColorValue (ColorValue cyan)
ca
parents: 1347
diff changeset
  3511
                    cs > rs ifTrue:[
acb4e4874e4d care for ColorValue (ColorValue cyan)
ca
parents: 1347
diff changeset
  3512
                        hiS isNil ifTrue:[
acb4e4874e4d care for ColorValue (ColorValue cyan)
ca
parents: 1347
diff changeset
  3513
                            hiS := aColor.
acb4e4874e4d care for ColorValue (ColorValue cyan)
ca
parents: 1347
diff changeset
  3514
                            hiValS := cs
acb4e4874e4d care for ColorValue (ColorValue cyan)
ca
parents: 1347
diff changeset
  3515
                        ] ifFalse:[
acb4e4874e4d care for ColorValue (ColorValue cyan)
ca
parents: 1347
diff changeset
  3516
                            cs < hiValS ifTrue:[
acb4e4874e4d care for ColorValue (ColorValue cyan)
ca
parents: 1347
diff changeset
  3517
                                hiS := aColor.
acb4e4874e4d care for ColorValue (ColorValue cyan)
ca
parents: 1347
diff changeset
  3518
                                hiValS := cs
acb4e4874e4d care for ColorValue (ColorValue cyan)
ca
parents: 1347
diff changeset
  3519
                            ]
acb4e4874e4d care for ColorValue (ColorValue cyan)
ca
parents: 1347
diff changeset
  3520
                        ].
acb4e4874e4d care for ColorValue (ColorValue cyan)
ca
parents: 1347
diff changeset
  3521
                    ] ifFalse:[
acb4e4874e4d care for ColorValue (ColorValue cyan)
ca
parents: 1347
diff changeset
  3522
                        lowS isNil ifTrue:[
acb4e4874e4d care for ColorValue (ColorValue cyan)
ca
parents: 1347
diff changeset
  3523
                            lowS := aColor.
acb4e4874e4d care for ColorValue (ColorValue cyan)
ca
parents: 1347
diff changeset
  3524
                            lowValS := cs
acb4e4874e4d care for ColorValue (ColorValue cyan)
ca
parents: 1347
diff changeset
  3525
                        ] ifFalse:[
acb4e4874e4d care for ColorValue (ColorValue cyan)
ca
parents: 1347
diff changeset
  3526
                            cs > lowValS ifTrue:[
acb4e4874e4d care for ColorValue (ColorValue cyan)
ca
parents: 1347
diff changeset
  3527
                                lowS := aColor.
acb4e4874e4d care for ColorValue (ColorValue cyan)
ca
parents: 1347
diff changeset
  3528
                                lowValS := cs
acb4e4874e4d care for ColorValue (ColorValue cyan)
ca
parents: 1347
diff changeset
  3529
                            ]
acb4e4874e4d care for ColorValue (ColorValue cyan)
ca
parents: 1347
diff changeset
  3530
                        ]
acb4e4874e4d care for ColorValue (ColorValue cyan)
ca
parents: 1347
diff changeset
  3531
                    ]
acb4e4874e4d care for ColorValue (ColorValue cyan)
ca
parents: 1347
diff changeset
  3532
                ].
acb4e4874e4d care for ColorValue (ColorValue cyan)
ca
parents: 1347
diff changeset
  3533
acb4e4874e4d care for ColorValue (ColorValue cyan)
ca
parents: 1347
diff changeset
  3534
                rh notNil ifTrue:[
acb4e4874e4d care for ColorValue (ColorValue cyan)
ca
parents: 1347
diff changeset
  3535
                    cl = rl ifTrue:[
acb4e4874e4d care for ColorValue (ColorValue cyan)
ca
parents: 1347
diff changeset
  3536
                        cs = rs ifTrue:[
acb4e4874e4d care for ColorValue (ColorValue cyan)
ca
parents: 1347
diff changeset
  3537
                            ch notNil ifTrue:[
acb4e4874e4d care for ColorValue (ColorValue cyan)
ca
parents: 1347
diff changeset
  3538
                                d := (ch - rh) abs.
acb4e4874e4d care for ColorValue (ColorValue cyan)
ca
parents: 1347
diff changeset
  3539
                                d > 300 ifTrue:[
acb4e4874e4d care for ColorValue (ColorValue cyan)
ca
parents: 1347
diff changeset
  3540
                                    rh > 180 ifTrue:[
acb4e4874e4d care for ColorValue (ColorValue cyan)
ca
parents: 1347
diff changeset
  3541
                                        ch := ch + 360
acb4e4874e4d care for ColorValue (ColorValue cyan)
ca
parents: 1347
diff changeset
  3542
                                    ] ifFalse:[
acb4e4874e4d care for ColorValue (ColorValue cyan)
ca
parents: 1347
diff changeset
  3543
                                        ch := ch - 360
acb4e4874e4d care for ColorValue (ColorValue cyan)
ca
parents: 1347
diff changeset
  3544
                                    ].
acb4e4874e4d care for ColorValue (ColorValue cyan)
ca
parents: 1347
diff changeset
  3545
                                ].
acb4e4874e4d care for ColorValue (ColorValue cyan)
ca
parents: 1347
diff changeset
  3546
                                ch > rh ifTrue:[
acb4e4874e4d care for ColorValue (ColorValue cyan)
ca
parents: 1347
diff changeset
  3547
                                    hiH isNil ifTrue:[
acb4e4874e4d care for ColorValue (ColorValue cyan)
ca
parents: 1347
diff changeset
  3548
                                        hiH := aColor.
acb4e4874e4d care for ColorValue (ColorValue cyan)
ca
parents: 1347
diff changeset
  3549
                                        hiValH := ch
acb4e4874e4d care for ColorValue (ColorValue cyan)
ca
parents: 1347
diff changeset
  3550
                                    ] ifFalse:[
acb4e4874e4d care for ColorValue (ColorValue cyan)
ca
parents: 1347
diff changeset
  3551
                                        ch < hiValH ifTrue:[
acb4e4874e4d care for ColorValue (ColorValue cyan)
ca
parents: 1347
diff changeset
  3552
                                            hiH := aColor.
acb4e4874e4d care for ColorValue (ColorValue cyan)
ca
parents: 1347
diff changeset
  3553
                                            hiValH := ch
acb4e4874e4d care for ColorValue (ColorValue cyan)
ca
parents: 1347
diff changeset
  3554
                                        ]
acb4e4874e4d care for ColorValue (ColorValue cyan)
ca
parents: 1347
diff changeset
  3555
                                    ]
acb4e4874e4d care for ColorValue (ColorValue cyan)
ca
parents: 1347
diff changeset
  3556
                                ] ifFalse:[
acb4e4874e4d care for ColorValue (ColorValue cyan)
ca
parents: 1347
diff changeset
  3557
                                    lowH isNil ifTrue:[
acb4e4874e4d care for ColorValue (ColorValue cyan)
ca
parents: 1347
diff changeset
  3558
                                        lowH := aColor.
acb4e4874e4d care for ColorValue (ColorValue cyan)
ca
parents: 1347
diff changeset
  3559
                                        lowValH := ch
acb4e4874e4d care for ColorValue (ColorValue cyan)
ca
parents: 1347
diff changeset
  3560
                                    ] ifFalse:[
acb4e4874e4d care for ColorValue (ColorValue cyan)
ca
parents: 1347
diff changeset
  3561
                                        ch > lowValH ifTrue:[
acb4e4874e4d care for ColorValue (ColorValue cyan)
ca
parents: 1347
diff changeset
  3562
                                            lowH := aColor.
acb4e4874e4d care for ColorValue (ColorValue cyan)
ca
parents: 1347
diff changeset
  3563
                                            lowValH := ch
acb4e4874e4d care for ColorValue (ColorValue cyan)
ca
parents: 1347
diff changeset
  3564
                                        ]
acb4e4874e4d care for ColorValue (ColorValue cyan)
ca
parents: 1347
diff changeset
  3565
                                    ] 
acb4e4874e4d care for ColorValue (ColorValue cyan)
ca
parents: 1347
diff changeset
  3566
                                ]
acb4e4874e4d care for ColorValue (ColorValue cyan)
ca
parents: 1347
diff changeset
  3567
                            ]
acb4e4874e4d care for ColorValue (ColorValue cyan)
ca
parents: 1347
diff changeset
  3568
                        ]
acb4e4874e4d care for ColorValue (ColorValue cyan)
ca
parents: 1347
diff changeset
  3569
                    ]
acb4e4874e4d care for ColorValue (ColorValue cyan)
ca
parents: 1347
diff changeset
  3570
                ]
acb4e4874e4d care for ColorValue (ColorValue cyan)
ca
parents: 1347
diff changeset
  3571
            ]
acb4e4874e4d care for ColorValue (ColorValue cyan)
ca
parents: 1347
diff changeset
  3572
        ]
1023
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
  3573
    ].
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
  3574
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
  3575
    "found bounds for light ?"
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
  3576
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
  3577
    lowL notNil ifTrue:[
1348
acb4e4874e4d care for ColorValue (ColorValue cyan)
ca
parents: 1347
diff changeset
  3578
        rl = lowValL ifTrue:[
acb4e4874e4d care for ColorValue (ColorValue cyan)
ca
parents: 1347
diff changeset
  3579
            ^ aBlock value:lowL value:nil
acb4e4874e4d care for ColorValue (ColorValue cyan)
ca
parents: 1347
diff changeset
  3580
        ].
acb4e4874e4d care for ColorValue (ColorValue cyan)
ca
parents: 1347
diff changeset
  3581
        hiL notNil ifTrue:[
acb4e4874e4d care for ColorValue (ColorValue cyan)
ca
parents: 1347
diff changeset
  3582
            ^ self monoDitherFor:1.0 / (hiValL - lowValL) / (rl - lowValL)
acb4e4874e4d care for ColorValue (ColorValue cyan)
ca
parents: 1347
diff changeset
  3583
                         between:lowL
acb4e4874e4d care for ColorValue (ColorValue cyan)
ca
parents: 1347
diff changeset
  3584
                             and:hiL 
acb4e4874e4d care for ColorValue (ColorValue cyan)
ca
parents: 1347
diff changeset
  3585
                              on:aDevice
acb4e4874e4d care for ColorValue (ColorValue cyan)
ca
parents: 1347
diff changeset
  3586
                            into:aBlock
acb4e4874e4d care for ColorValue (ColorValue cyan)
ca
parents: 1347
diff changeset
  3587
        ].
acb4e4874e4d care for ColorValue (ColorValue cyan)
ca
parents: 1347
diff changeset
  3588
        "found bound for light - dither with white"
acb4e4874e4d care for ColorValue (ColorValue cyan)
ca
parents: 1347
diff changeset
  3589
        ^ self monoDitherFor:1.0 / (100 - lowValL) / (rl - lowValL)
acb4e4874e4d care for ColorValue (ColorValue cyan)
ca
parents: 1347
diff changeset
  3590
                     between:lowL
acb4e4874e4d care for ColorValue (ColorValue cyan)
ca
parents: 1347
diff changeset
  3591
                         and:White 
acb4e4874e4d care for ColorValue (ColorValue cyan)
ca
parents: 1347
diff changeset
  3592
                          on:aDevice
acb4e4874e4d care for ColorValue (ColorValue cyan)
ca
parents: 1347
diff changeset
  3593
                        into:aBlock
1023
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
  3594
    ].
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
  3595
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
  3596
    "found bound for light - dither with black"
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
  3597
    hiL notNil ifTrue:[
1348
acb4e4874e4d care for ColorValue (ColorValue cyan)
ca
parents: 1347
diff changeset
  3598
        ^ self monoDitherFor:1.0 / (hiValL) / (rl)
acb4e4874e4d care for ColorValue (ColorValue cyan)
ca
parents: 1347
diff changeset
  3599
                     between:Black
acb4e4874e4d care for ColorValue (ColorValue cyan)
ca
parents: 1347
diff changeset
  3600
                         and:hiL 
acb4e4874e4d care for ColorValue (ColorValue cyan)
ca
parents: 1347
diff changeset
  3601
                          on:aDevice
acb4e4874e4d care for ColorValue (ColorValue cyan)
ca
parents: 1347
diff changeset
  3602
                        into:aBlock
1023
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
  3603
    ].
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
  3604
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
  3605
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
  3606
    "found bounds for saturation?"
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
  3607
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
  3608
    (lowS notNil and:[hiS notNil]) ifTrue:[
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
  3609
"
1348
acb4e4874e4d care for ColorValue (ColorValue cyan)
ca
parents: 1347
diff changeset
  3610
        'saturation dither' printNewline.
1023
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
  3611
"
1348
acb4e4874e4d care for ColorValue (ColorValue cyan)
ca
parents: 1347
diff changeset
  3612
        ^ self monoDitherFor:1.0 / (hiValS - lowValS) / (rs - lowValS)
acb4e4874e4d care for ColorValue (ColorValue cyan)
ca
parents: 1347
diff changeset
  3613
                     between:lowS
acb4e4874e4d care for ColorValue (ColorValue cyan)
ca
parents: 1347
diff changeset
  3614
                         and:hiS
acb4e4874e4d care for ColorValue (ColorValue cyan)
ca
parents: 1347
diff changeset
  3615
                          on:aDevice
acb4e4874e4d care for ColorValue (ColorValue cyan)
ca
parents: 1347
diff changeset
  3616
                        into:aBlock
1023
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
  3617
    ].
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
  3618
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
  3619
    "found bounds for hue ?"
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
  3620
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
  3621
    (lowH notNil and:[hiH notNil]) ifTrue:[
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
  3622
"
1348
acb4e4874e4d care for ColorValue (ColorValue cyan)
ca
parents: 1347
diff changeset
  3623
        'hue dither' printNewline.
1023
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
  3624
"
1348
acb4e4874e4d care for ColorValue (ColorValue cyan)
ca
parents: 1347
diff changeset
  3625
        hiValH < lowValH ifTrue:[
acb4e4874e4d care for ColorValue (ColorValue cyan)
ca
parents: 1347
diff changeset
  3626
            hiValH := hiValH + 360
acb4e4874e4d care for ColorValue (ColorValue cyan)
ca
parents: 1347
diff changeset
  3627
        ].
acb4e4874e4d care for ColorValue (ColorValue cyan)
ca
parents: 1347
diff changeset
  3628
acb4e4874e4d care for ColorValue (ColorValue cyan)
ca
parents: 1347
diff changeset
  3629
        d := hiValH - lowValH.
acb4e4874e4d care for ColorValue (ColorValue cyan)
ca
parents: 1347
diff changeset
  3630
acb4e4874e4d care for ColorValue (ColorValue cyan)
ca
parents: 1347
diff changeset
  3631
        ^ self monoDitherFor:1.0 / (d / (rh - lowValH))
acb4e4874e4d care for ColorValue (ColorValue cyan)
ca
parents: 1347
diff changeset
  3632
                     between:lowH
acb4e4874e4d care for ColorValue (ColorValue cyan)
ca
parents: 1347
diff changeset
  3633
                         and:hiH 
acb4e4874e4d care for ColorValue (ColorValue cyan)
ca
parents: 1347
diff changeset
  3634
                          on:aDevice
acb4e4874e4d care for ColorValue (ColorValue cyan)
ca
parents: 1347
diff changeset
  3635
                        into:aBlock
1023
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
  3636
    ].
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
  3637
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
  3638
    ^ aBlock value:nil value:nil
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
  3639
1365
37a9e7ac4dbc moved color registration from Color class to per-device lobby
Claus Gittinger <cg@exept.de>
parents: 1348
diff changeset
  3640
    "Modified: 24.2.1997 / 18:22:45 / cg"
1023
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
  3641
!
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
  3642
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
  3643
fixDitherRed:redVal green:greenVal blue:blueVal on:aDevice into:aBlock
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
  3644
    "get a dither form for an rgb value.
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
  3645
     Returns 2 values (either color or ditherForm) through aBlock.
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
  3646
     This code uses the table of preallocated fix-colors to find
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
  3647
     dither colors."
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
  3648
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
  3649
    | 
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
  3650
     nR "{ Class: SmallInteger }"
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
  3651
     nG "{ Class: SmallInteger }"
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
  3652
     nB "{ Class: SmallInteger }"
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
  3653
     hR "{ Class: SmallInteger }"
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
  3654
     hG "{ Class: SmallInteger }"
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
  3655
     hB "{ Class: SmallInteger }"
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
  3656
     eR eG eB
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
  3657
     rI "{ Class: SmallInteger }"
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
  3658
     gI "{ Class: SmallInteger }"
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
  3659
     bI  "{ Class: SmallInteger }"
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
  3660
     idx "{ Class: SmallInteger }"
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
  3661
     f clr
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
  3662
     r    "{ Class: SmallInteger }"
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
  3663
     g    "{ Class: SmallInteger }"
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
  3664
     b    "{ Class: SmallInteger }"
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
  3665
     x1   "{ Class: SmallInteger }"
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
  3666
     x2   "{ Class: SmallInteger }"
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
  3667
     step "{ Class: SmallInteger }" 
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
  3668
     lastIdx mx 
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
  3669
     dS   "{ Class: SmallInteger }"
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
  3670
     cube|
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
  3671
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
  3672
    (cube := aDevice fixColors) notNil ifTrue:[
1348
acb4e4874e4d care for ColorValue (ColorValue cyan)
ca
parents: 1347
diff changeset
  3673
        dS := 4.
acb4e4874e4d care for ColorValue (ColorValue cyan)
ca
parents: 1347
diff changeset
  3674
acb4e4874e4d care for ColorValue (ColorValue cyan)
ca
parents: 1347
diff changeset
  3675
        f := Form width:dS height:dS depth:(aDevice depth) on:aDevice.
acb4e4874e4d care for ColorValue (ColorValue cyan)
ca
parents: 1347
diff changeset
  3676
        f initGC.
acb4e4874e4d care for ColorValue (ColorValue cyan)
ca
parents: 1347
diff changeset
  3677
acb4e4874e4d care for ColorValue (ColorValue cyan)
ca
parents: 1347
diff changeset
  3678
        mx := MaxValue asFloat.
acb4e4874e4d care for ColorValue (ColorValue cyan)
ca
parents: 1347
diff changeset
  3679
acb4e4874e4d care for ColorValue (ColorValue cyan)
ca
parents: 1347
diff changeset
  3680
        nR := aDevice numFixRed.
acb4e4874e4d care for ColorValue (ColorValue cyan)
ca
parents: 1347
diff changeset
  3681
        nG := aDevice numFixGreen.
acb4e4874e4d care for ColorValue (ColorValue cyan)
ca
parents: 1347
diff changeset
  3682
        nB := aDevice numFixBlue.
acb4e4874e4d care for ColorValue (ColorValue cyan)
ca
parents: 1347
diff changeset
  3683
acb4e4874e4d care for ColorValue (ColorValue cyan)
ca
parents: 1347
diff changeset
  3684
        hR := nR // 2.
acb4e4874e4d care for ColorValue (ColorValue cyan)
ca
parents: 1347
diff changeset
  3685
        hG := nG // 2.
acb4e4874e4d care for ColorValue (ColorValue cyan)
ca
parents: 1347
diff changeset
  3686
        hB := nB // 2.
acb4e4874e4d care for ColorValue (ColorValue cyan)
ca
parents: 1347
diff changeset
  3687
acb4e4874e4d care for ColorValue (ColorValue cyan)
ca
parents: 1347
diff changeset
  3688
        eR := eG := eB := 0.
acb4e4874e4d care for ColorValue (ColorValue cyan)
ca
parents: 1347
diff changeset
  3689
        r := redVal.
acb4e4874e4d care for ColorValue (ColorValue cyan)
ca
parents: 1347
diff changeset
  3690
        g := greenVal.
acb4e4874e4d care for ColorValue (ColorValue cyan)
ca
parents: 1347
diff changeset
  3691
        b := blueVal.
acb4e4874e4d care for ColorValue (ColorValue cyan)
ca
parents: 1347
diff changeset
  3692
acb4e4874e4d care for ColorValue (ColorValue cyan)
ca
parents: 1347
diff changeset
  3693
        step := -1.
acb4e4874e4d care for ColorValue (ColorValue cyan)
ca
parents: 1347
diff changeset
  3694
acb4e4874e4d care for ColorValue (ColorValue cyan)
ca
parents: 1347
diff changeset
  3695
        0 to:dS-1 do:[:y |
acb4e4874e4d care for ColorValue (ColorValue cyan)
ca
parents: 1347
diff changeset
  3696
            step == -1 ifTrue:[
acb4e4874e4d care for ColorValue (ColorValue cyan)
ca
parents: 1347
diff changeset
  3697
                x1 := 0. x2 := dS-1. step := 1.
acb4e4874e4d care for ColorValue (ColorValue cyan)
ca
parents: 1347
diff changeset
  3698
            ] ifFalse:[
acb4e4874e4d care for ColorValue (ColorValue cyan)
ca
parents: 1347
diff changeset
  3699
                x1 := dS-1. x2 := 0. step := -1.
acb4e4874e4d care for ColorValue (ColorValue cyan)
ca
parents: 1347
diff changeset
  3700
            ].
acb4e4874e4d care for ColorValue (ColorValue cyan)
ca
parents: 1347
diff changeset
  3701
acb4e4874e4d care for ColorValue (ColorValue cyan)
ca
parents: 1347
diff changeset
  3702
            x1 to:x2 by:step do:[:x |
acb4e4874e4d care for ColorValue (ColorValue cyan)
ca
parents: 1347
diff changeset
  3703
                "/ the nearest along the grid
acb4e4874e4d care for ColorValue (ColorValue cyan)
ca
parents: 1347
diff changeset
  3704
acb4e4874e4d care for ColorValue (ColorValue cyan)
ca
parents: 1347
diff changeset
  3705
                r := redVal + eR.
acb4e4874e4d care for ColorValue (ColorValue cyan)
ca
parents: 1347
diff changeset
  3706
                r > MaxValue ifTrue:[r := MaxValue]
acb4e4874e4d care for ColorValue (ColorValue cyan)
ca
parents: 1347
diff changeset
  3707
                             ifFalse:[r < 0 ifTrue:[r := 0]].
acb4e4874e4d care for ColorValue (ColorValue cyan)
ca
parents: 1347
diff changeset
  3708
                g := greenVal + eG.
acb4e4874e4d care for ColorValue (ColorValue cyan)
ca
parents: 1347
diff changeset
  3709
                g > MaxValue ifTrue:[g := MaxValue]
acb4e4874e4d care for ColorValue (ColorValue cyan)
ca
parents: 1347
diff changeset
  3710
                             ifFalse:[g < 0 ifTrue:[g := 0]].
acb4e4874e4d care for ColorValue (ColorValue cyan)
ca
parents: 1347
diff changeset
  3711
acb4e4874e4d care for ColorValue (ColorValue cyan)
ca
parents: 1347
diff changeset
  3712
                b := blueVal + eB.
acb4e4874e4d care for ColorValue (ColorValue cyan)
ca
parents: 1347
diff changeset
  3713
                b > MaxValue ifTrue:[b := MaxValue]
acb4e4874e4d care for ColorValue (ColorValue cyan)
ca
parents: 1347
diff changeset
  3714
                             ifFalse:[b < 0 ifTrue:[b := 0]].
acb4e4874e4d care for ColorValue (ColorValue cyan)
ca
parents: 1347
diff changeset
  3715
acb4e4874e4d care for ColorValue (ColorValue cyan)
ca
parents: 1347
diff changeset
  3716
                rI := (r * (nR-1) + hR / mx) rounded.
acb4e4874e4d care for ColorValue (ColorValue cyan)
ca
parents: 1347
diff changeset
  3717
                gI := (g * (nG-1) + hG / mx) rounded .
acb4e4874e4d care for ColorValue (ColorValue cyan)
ca
parents: 1347
diff changeset
  3718
                bI := (b * (nB-1) + hB / mx) rounded .
acb4e4874e4d care for ColorValue (ColorValue cyan)
ca
parents: 1347
diff changeset
  3719
acb4e4874e4d care for ColorValue (ColorValue cyan)
ca
parents: 1347
diff changeset
  3720
                idx := (((rI * nG) + gI) * nB + bI) + 1.
acb4e4874e4d care for ColorValue (ColorValue cyan)
ca
parents: 1347
diff changeset
  3721
                clr := (cube at:idx) exactOn:aDevice.
acb4e4874e4d care for ColorValue (ColorValue cyan)
ca
parents: 1347
diff changeset
  3722
                lastIdx isNil ifTrue:[lastIdx := idx]
acb4e4874e4d care for ColorValue (ColorValue cyan)
ca
parents: 1347
diff changeset
  3723
                ifFalse:[lastIdx ~~ idx ifTrue:[lastIdx := -1]].
acb4e4874e4d care for ColorValue (ColorValue cyan)
ca
parents: 1347
diff changeset
  3724
acb4e4874e4d care for ColorValue (ColorValue cyan)
ca
parents: 1347
diff changeset
  3725
                f foreground:clr.
acb4e4874e4d care for ColorValue (ColorValue cyan)
ca
parents: 1347
diff changeset
  3726
                f displayPointX:x y:y.
acb4e4874e4d care for ColorValue (ColorValue cyan)
ca
parents: 1347
diff changeset
  3727
acb4e4874e4d care for ColorValue (ColorValue cyan)
ca
parents: 1347
diff changeset
  3728
                eR := r  - clr scaledRed.
acb4e4874e4d care for ColorValue (ColorValue cyan)
ca
parents: 1347
diff changeset
  3729
                eG := g  - clr scaledGreen.
acb4e4874e4d care for ColorValue (ColorValue cyan)
ca
parents: 1347
diff changeset
  3730
                eB := b  - clr scaledBlue.
acb4e4874e4d care for ColorValue (ColorValue cyan)
ca
parents: 1347
diff changeset
  3731
            ].
acb4e4874e4d care for ColorValue (ColorValue cyan)
ca
parents: 1347
diff changeset
  3732
        ].
acb4e4874e4d care for ColorValue (ColorValue cyan)
ca
parents: 1347
diff changeset
  3733
        f releaseGC.
acb4e4874e4d care for ColorValue (ColorValue cyan)
ca
parents: 1347
diff changeset
  3734
acb4e4874e4d care for ColorValue (ColorValue cyan)
ca
parents: 1347
diff changeset
  3735
        lastIdx ~~ -1 ifTrue:[
acb4e4874e4d care for ColorValue (ColorValue cyan)
ca
parents: 1347
diff changeset
  3736
            ^ aBlock value:clr value:nil
acb4e4874e4d care for ColorValue (ColorValue cyan)
ca
parents: 1347
diff changeset
  3737
        ].
acb4e4874e4d care for ColorValue (ColorValue cyan)
ca
parents: 1347
diff changeset
  3738
        ^ aBlock value:nil value:f
1023
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
  3739
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
  3740
    ].
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
  3741
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
  3742
    ^ aBlock value:nil value:nil
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
  3743
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
  3744
    "Modified: 11.7.1996 / 18:30:28 / cg"
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
  3745
!
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
  3746
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
  3747
monoDitherFor:fraction between:color1 and:color2 on:aDevice into:aBlock
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
  3748
    "get a dither form or colorId for dithering between 2 colors.
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
  3749
     Returns 2 values (either color or ditherForm) through aBlock."
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
  3750
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
  3751
    |form c1 c2 
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
  3752
     index "{ Class:SmallInteger }"|
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
  3753
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
  3754
    "/
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
  3755
    "/ having forms with: [1 .. 63] of 64 pixels (see Form),
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
  3756
    "/ we get dithers for: 1/64, 2/64, ... 63/64
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
  3757
    "/
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
  3758
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
  3759
    index := (fraction * 64) rounded.
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
  3760
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
  3761
    c1 := color1 exactOn:aDevice.
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
  3762
    index < 1 ifTrue:[
1348
acb4e4874e4d care for ColorValue (ColorValue cyan)
ca
parents: 1347
diff changeset
  3763
        ^ aBlock value:c1 value:nil
1023
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
  3764
    ].
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
  3765
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
  3766
    c2 := color2 exactOn:aDevice.
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
  3767
    index >= 64 ifTrue:[
1348
acb4e4874e4d care for ColorValue (ColorValue cyan)
ca
parents: 1347
diff changeset
  3768
        ^ aBlock value:c2 value:nil
1023
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
  3769
    ].
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
  3770
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
  3771
    form := Form width:8 height:8 fromArray:(DitherBits at:index) on:aDevice.
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
  3772
    form colorMap:(Array with:c1 with:c2).
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
  3773
    ^ aBlock value:nil value:form
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
  3774
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
  3775
    "
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
  3776
     Color basicNew
1348
acb4e4874e4d care for ColorValue (ColorValue cyan)
ca
parents: 1347
diff changeset
  3777
        monoDitherFor:(MaxValue // 2)
acb4e4874e4d care for ColorValue (ColorValue cyan)
ca
parents: 1347
diff changeset
  3778
        between:Color black 
acb4e4874e4d care for ColorValue (ColorValue cyan)
ca
parents: 1347
diff changeset
  3779
        and:Color white 
acb4e4874e4d care for ColorValue (ColorValue cyan)
ca
parents: 1347
diff changeset
  3780
        on:Display 
acb4e4874e4d care for ColorValue (ColorValue cyan)
ca
parents: 1347
diff changeset
  3781
        into:[:clr :dither | clr inspect. dither inspect]
1023
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
  3782
    "
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
  3783
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
  3784
    "Modified: 11.6.1996 / 16:55:37 / cg"
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
  3785
!
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
  3786
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
  3787
restored
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
  3788
    "private: color has been restored (either from snapin or binary store);
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
  3789
     flush device stuff or reallocate a cell."
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
  3790
1238
b363894182d0 prepare for replacement colors
Claus Gittinger <cg@exept.de>
parents: 1237
diff changeset
  3791
    ditherForm := replacementColor := nil.
b363894182d0 prepare for replacement colors
Claus Gittinger <cg@exept.de>
parents: 1237
diff changeset
  3792
1023
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
  3793
    red notNil ifTrue:[
1238
b363894182d0 prepare for replacement colors
Claus Gittinger <cg@exept.de>
parents: 1237
diff changeset
  3794
        device := nil.
b363894182d0 prepare for replacement colors
Claus Gittinger <cg@exept.de>
parents: 1237
diff changeset
  3795
        colorId := nil
1023
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
  3796
    ] ifFalse:[
1238
b363894182d0 prepare for replacement colors
Claus Gittinger <cg@exept.de>
parents: 1237
diff changeset
  3797
        "a variable color has been restored"
b363894182d0 prepare for replacement colors
Claus Gittinger <cg@exept.de>
parents: 1237
diff changeset
  3798
        (colorId notNil and:[writable == true and:[device notNil]]) ifTrue:[
b363894182d0 prepare for replacement colors
Claus Gittinger <cg@exept.de>
parents: 1237
diff changeset
  3799
            colorId := device colorCell.
b363894182d0 prepare for replacement colors
Claus Gittinger <cg@exept.de>
parents: 1237
diff changeset
  3800
            device setColor:colorId scaledRed:red scaledGreen:green scaledBlue:blue
b363894182d0 prepare for replacement colors
Claus Gittinger <cg@exept.de>
parents: 1237
diff changeset
  3801
        ]
1023
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
  3802
    ]
1238
b363894182d0 prepare for replacement colors
Claus Gittinger <cg@exept.de>
parents: 1237
diff changeset
  3803
b363894182d0 prepare for replacement colors
Claus Gittinger <cg@exept.de>
parents: 1237
diff changeset
  3804
    "Modified: 17.1.1997 / 00:04:14 / cg"
b363894182d0 prepare for replacement colors
Claus Gittinger <cg@exept.de>
parents: 1237
diff changeset
  3805
!
b363894182d0 prepare for replacement colors
Claus Gittinger <cg@exept.de>
parents: 1237
diff changeset
  3806
b363894182d0 prepare for replacement colors
Claus Gittinger <cg@exept.de>
parents: 1237
diff changeset
  3807
setColorId:anId
b363894182d0 prepare for replacement colors
Claus Gittinger <cg@exept.de>
parents: 1237
diff changeset
  3808
    "private: set the deviceId"
b363894182d0 prepare for replacement colors
Claus Gittinger <cg@exept.de>
parents: 1237
diff changeset
  3809
b363894182d0 prepare for replacement colors
Claus Gittinger <cg@exept.de>
parents: 1237
diff changeset
  3810
    colorId := anId
b363894182d0 prepare for replacement colors
Claus Gittinger <cg@exept.de>
parents: 1237
diff changeset
  3811
b363894182d0 prepare for replacement colors
Claus Gittinger <cg@exept.de>
parents: 1237
diff changeset
  3812
    "Created: 17.1.1997 / 00:05:41 / cg"
1023
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
  3813
!
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
  3814
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
  3815
setDevice:aDevice colorId:aNumber
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
  3816
    "private:set device and colorId"
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
  3817
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
  3818
    device := aDevice.
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
  3819
    colorId := aNumber
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
  3820
!
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
  3821
1238
b363894182d0 prepare for replacement colors
Claus Gittinger <cg@exept.de>
parents: 1237
diff changeset
  3822
setDitherForm:aForm
b363894182d0 prepare for replacement colors
Claus Gittinger <cg@exept.de>
parents: 1237
diff changeset
  3823
    "private: set the ditherForm"
b363894182d0 prepare for replacement colors
Claus Gittinger <cg@exept.de>
parents: 1237
diff changeset
  3824
b363894182d0 prepare for replacement colors
Claus Gittinger <cg@exept.de>
parents: 1237
diff changeset
  3825
    ditherForm := aForm
b363894182d0 prepare for replacement colors
Claus Gittinger <cg@exept.de>
parents: 1237
diff changeset
  3826
b363894182d0 prepare for replacement colors
Claus Gittinger <cg@exept.de>
parents: 1237
diff changeset
  3827
    "Created: 17.1.1997 / 00:04:57 / cg"
b363894182d0 prepare for replacement colors
Claus Gittinger <cg@exept.de>
parents: 1237
diff changeset
  3828
!
b363894182d0 prepare for replacement colors
Claus Gittinger <cg@exept.de>
parents: 1237
diff changeset
  3829
1023
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
  3830
setScaledRed:r scaledGreen:g scaledBlue:b device:aDevice
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
  3831
    "private: set the components"
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
  3832
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
  3833
    red notNil ifTrue:[
1233
c6796bddc7d1 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1229
diff changeset
  3834
        "oops cannot change (you want to make red be green - or what)"
c6796bddc7d1 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1229
diff changeset
  3835
c6796bddc7d1 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1229
diff changeset
  3836
        self error:'Colors cannot change their components'.
c6796bddc7d1 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1229
diff changeset
  3837
        ^ self
1023
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
  3838
    ].
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
  3839
    red := r.
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
  3840
    green := g.
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
  3841
    blue := b.
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
  3842
    device := aDevice
1233
c6796bddc7d1 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1229
diff changeset
  3843
c6796bddc7d1 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1229
diff changeset
  3844
    "Modified: 16.1.1997 / 22:39:26 / cg"
1023
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
  3845
!
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
  3846
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
  3847
setWritable:aBoolean
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
  3848
    "set/clear the writable attribute. Highly private"
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
  3849
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
  3850
    writable := aBoolean
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
  3851
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
  3852
    "Modified: 23.4.1996 / 13:40:18 / cg"
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
  3853
! !
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
  3854
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
  3855
!Color methodsFor:'queries'!
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
  3856
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
  3857
averageColor
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
  3858
    "return the average color - thats myself.
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
  3859
     This method has been added for compatibility with the image
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
  3860
     protocol."
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
  3861
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
  3862
    ^ self 
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
  3863
!
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
  3864
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
  3865
averageColorIn:aRectangle
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
  3866
    "return the average color - thats myself.
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
  3867
     This method has been added for compatibility with the image
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
  3868
     protocol."
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
  3869
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
  3870
    ^ self 
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
  3871
!
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
  3872
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
  3873
brightness
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
  3874
    "ST80 compatibility: return the grey intensity in [0..1]"
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
  3875
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
  3876
    ^ ((3 * red) + (6 * green) + (blue)) / 10.0 / MaxValue
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
  3877
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
  3878
    "Modified: 7.6.1996 / 19:42:21 / cg"
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
  3879
!
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
  3880
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
  3881
deltaFrom:aColor
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
  3882
    "return the distance of the receiver from some color specified
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
  3883
     by r/g/b values"
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
  3884
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
  3885
    ^ aColor deltaFromRed:self red green:self green blue:self blue
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
  3886
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
  3887
    "Created: 14.6.1996 / 20:07:22 / cg"
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
  3888
    "Modified: 14.6.1996 / 20:49:32 / cg"
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
  3889
!
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
  3890
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
  3891
deltaFromRed:r green:g blue:b
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
  3892
    "return the distance of the receiver from some color specified
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
  3893
     by r/g/b values"
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
  3894
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
  3895
    "
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
  3896
     Q: how should component errors be weighted ?
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
  3897
    "
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
  3898
    ^ (self red - r) abs
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
  3899
      + (self green - g) abs
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
  3900
      + (self blue - b) abs.
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
  3901
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
  3902
    "Created: 14.6.1996 / 20:03:58 / cg"
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
  3903
    "Modified: 14.6.1996 / 20:20:24 / cg"
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
  3904
!
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
  3905
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
  3906
deltaFromScaledRed:r scaledGreen:g scaledBlue:b
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
  3907
    "return the distance of the receiver from some color specified
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
  3908
     by r/g/b values"
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
  3909
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
  3910
    "
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
  3911
     Q: how should component errors be weighted ?
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
  3912
    "
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
  3913
    ^ (red - r) abs
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
  3914
      + (green - g) abs
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
  3915
      + (blue - b) abs.
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
  3916
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
  3917
    "Created: 11.6.1996 / 18:01:12 / cg"
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
  3918
    "Modified: 14.6.1996 / 20:36:14 / cg"
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
  3919
!
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
  3920
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
  3921
errorFrom:aColor
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
  3922
    "return some value which can be used to compare colors.
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
  3923
     The following simply returns the vector distance of the r/g/b vectors.
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
  3924
     This may not be a very good idea; probably, we should honor the
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
  3925
     fact that the hue difference should have more weight than saturation and/or light"
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
  3926
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
  3927
    ^ (red - aColor scaledRed) squared
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
  3928
       + (green - aColor scaledGreen) squared
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
  3929
       + (blue - aColor scaledBlue) squared.
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
  3930
!
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
  3931
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
  3932
grayIntensity
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
  3933
    "return the grey intensity in percent [0..100] (US version ;-)"
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
  3934
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
  3935
    ^ ((3 * red) + (6 * green) + (1 * blue)) * 10.0 / MaxValue
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
  3936
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
  3937
    "Created: 2.5.1996 / 11:38:21 / cg"
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
  3938
!
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
  3939
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
  3940
greyIntensity
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
  3941
    "return the grey intensity in percent [0..100] (English version ;-)"
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
  3942
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
  3943
    ^ self grayIntensity
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
  3944
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
  3945
    "Modified: 28.5.1996 / 20:45:41 / cg"
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
  3946
!
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
  3947
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
  3948
isColor
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
  3949
    "return true if the receiver is a Color."
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
  3950
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
  3951
    ^ true
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
  3952
!
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
  3953
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
  3954
isDithered
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
  3955
    "return true, if this is a dithered Color.
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
  3956
     Only makes sense if the receiver is a device color."
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
  3957
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
  3958
    ^ ditherForm notNil
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
  3959
!
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
  3960
1326
a519593747e8 #isGray - ST80 compatibility
Claus Gittinger <cg@exept.de>
parents: 1269
diff changeset
  3961
isGray
a519593747e8 #isGray - ST80 compatibility
Claus Gittinger <cg@exept.de>
parents: 1269
diff changeset
  3962
    "same as isGrayColor - for ST80 compatibility."
a519593747e8 #isGray - ST80 compatibility
Claus Gittinger <cg@exept.de>
parents: 1269
diff changeset
  3963
a519593747e8 #isGray - ST80 compatibility
Claus Gittinger <cg@exept.de>
parents: 1269
diff changeset
  3964
    ^ self isGrayColor
a519593747e8 #isGray - ST80 compatibility
Claus Gittinger <cg@exept.de>
parents: 1269
diff changeset
  3965
a519593747e8 #isGray - ST80 compatibility
Claus Gittinger <cg@exept.de>
parents: 1269
diff changeset
  3966
    "
a519593747e8 #isGray - ST80 compatibility
Claus Gittinger <cg@exept.de>
parents: 1269
diff changeset
  3967
     (Color grey:50) isGray
a519593747e8 #isGray - ST80 compatibility
Claus Gittinger <cg@exept.de>
parents: 1269
diff changeset
  3968
     (Color red) isGray
a519593747e8 #isGray - ST80 compatibility
Claus Gittinger <cg@exept.de>
parents: 1269
diff changeset
  3969
    "
a519593747e8 #isGray - ST80 compatibility
Claus Gittinger <cg@exept.de>
parents: 1269
diff changeset
  3970
a519593747e8 #isGray - ST80 compatibility
Claus Gittinger <cg@exept.de>
parents: 1269
diff changeset
  3971
    "Created: 10.2.1997 / 22:10:25 / cg"
a519593747e8 #isGray - ST80 compatibility
Claus Gittinger <cg@exept.de>
parents: 1269
diff changeset
  3972
!
a519593747e8 #isGray - ST80 compatibility
Claus Gittinger <cg@exept.de>
parents: 1269
diff changeset
  3973
1023
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
  3974
isGrayColor
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
  3975
    "return true, if this color is a gray one -
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
  3976
     i.e. red = green = blue"
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
  3977
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
  3978
    red ~~ green ifTrue:[^ false].
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
  3979
    ^ red == blue
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
  3980
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
  3981
    "
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
  3982
     (Color grey:50) isGrayColor
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
  3983
     (Color red) isGrayColor
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
  3984
    "
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
  3985
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
  3986
    "Created: 2.5.1996 / 11:38:48 / cg"
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
  3987
!
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
  3988
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
  3989
isGreyColor
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
  3990
    "return true, if this color is a grey one (English version ;-) -
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
  3991
     i.e. red = green = blue"
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
  3992
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
  3993
    ^ self isGrayColor
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
  3994
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
  3995
    "(Color grey:50) isGreyColor"
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
  3996
    "(Color red) isGreyColor"
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
  3997
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
  3998
    "Modified: 28.5.1996 / 20:44:36 / cg"
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
  3999
! !
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
  4000
1347
4e19b2d586a4 VW now has #on:, but calls it #asDevicePaintOn:
ca
parents: 1326
diff changeset
  4001
!Color methodsFor:'testing'!
4e19b2d586a4 VW now has #on:, but calls it #asDevicePaintOn:
ca
parents: 1326
diff changeset
  4002
4e19b2d586a4 VW now has #on:, but calls it #asDevicePaintOn:
ca
parents: 1326
diff changeset
  4003
isColorObject
4e19b2d586a4 VW now has #on:, but calls it #asDevicePaintOn:
ca
parents: 1326
diff changeset
  4004
    ^ true
4e19b2d586a4 VW now has #on:, but calls it #asDevicePaintOn:
ca
parents: 1326
diff changeset
  4005
! !
4e19b2d586a4 VW now has #on:, but calls it #asDevicePaintOn:
ca
parents: 1326
diff changeset
  4006
1144
07f3de59864d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1023
diff changeset
  4007
!Color class methodsFor:'documentation'!
1023
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
  4008
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
  4009
version
1390
4b519886451f added #almostSameAs:
Claus Gittinger <cg@exept.de>
parents: 1370
diff changeset
  4010
    ^ '$Header: /cvs/stx/stx/libview/Color.st,v 1.91 1997-02-28 12:28:03 cg Exp $'
1023
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
  4011
! !
ddbc71885249 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
  4012
Color initialize!