ImageEditor.st
changeset 400 228524287573
child 401 30ecf82e3ae7
equal deleted inserted replaced
399:0822ecf56bf2 400:228524287573
       
     1 "
       
     2  COPYRIGHT (c) 1997 by eXept Software AG / Thomas Zwick
       
     3               All Rights Reserved
       
     4 
       
     5  This software is furnished under a license and may be used
       
     6  only in accordance with the terms of that license and with the
       
     7  inclusion of the above copyright notice.   This software may not
       
     8  be provided or otherwise made available to, or used by, any
       
     9  other person.  No title to or ownership of the software is
       
    10  hereby transferred.
       
    11 "
       
    12 
       
    13 ToolApplicationModel subclass:#ImageEditor
       
    14 	instanceVariableNames:'colorMapMode selectedColorIndex postOpenAction'
       
    15 	classVariableNames:''
       
    16 	poolDictionaries:''
       
    17 	category:'Interface-Advanced-Tools'
       
    18 !
       
    19 
       
    20 !ImageEditor class methodsFor:'documentation'!
       
    21 
       
    22 copyright
       
    23 "
       
    24  COPYRIGHT (c) 1997 by eXept Software AG / Thomas Zwick
       
    25               All Rights Reserved
       
    26 
       
    27  This software is furnished under a license and may be used
       
    28  only in accordance with the terms of that license and with the
       
    29  inclusion of the above copyright notice.   This software may not
       
    30  be provided or otherwise made available to, or used by, any
       
    31  other person.  No title to or ownership of the software is
       
    32  hereby transferred.
       
    33 "
       
    34 !
       
    35 
       
    36 documentation
       
    37 "
       
    38     By the Image Editor you are able to create, design, modify or just inspect images.
       
    39 
       
    40     [start with:]
       
    41         ImageEditor open
       
    42         ImageEditor openOnClass:ImageEditor andSelector:#newImageIcon
       
    43 
       
    44     [see also:]
       
    45         ImageEditView Image
       
    46 
       
    47     [author:]
       
    48         Thomas Zwick
       
    49 "
       
    50 ! !
       
    51 
       
    52 !ImageEditor class methodsFor:'instance creation'!
       
    53 
       
    54 openModalOnClass: aClass andSelector: aSelector
       
    55 
       
    56     "self openModalOnClass: self andSelector: #newImageIcon"
       
    57 
       
    58     |imageEditor className resourceClassName resourceSelector|                          
       
    59     imageEditor := self new.
       
    60     aClass isClass ifTrue: [className := aClass name].
       
    61     aClass isString ifTrue: [className := aClass].      
       
    62 
       
    63     imageEditor postOpenAction: [imageEditor loadFromMessage: className printString, ' ', aSelector].
       
    64     imageEditor openModal.
       
    65 
       
    66     resourceClassName := imageEditor valueOfResourceClass value.
       
    67     resourceSelector := imageEditor valueOfResourceSelector value.
       
    68     ^resourceClassName, ' ', resourceSelector
       
    69 !
       
    70 
       
    71 openOnClass: aClass andSelector: aSelector
       
    72 
       
    73     "self openOnClass: self andSelector: #newImageIcon"
       
    74 
       
    75     ^self open loadFromMessage: aClass name, ' ', aSelector
       
    76 !
       
    77 
       
    78 openOnFile: image
       
    79 
       
    80     "self openOnFile: 'bitmaps/SmalltalkX.xbm'"
       
    81 
       
    82     ^self open loadFromFile: image
       
    83 !
       
    84 
       
    85 openOnImage: image
       
    86 
       
    87     "self openOnImage: self stxIcon"
       
    88 
       
    89     ^self open loadFromImage: image
       
    90 ! !
       
    91 
       
    92 !ImageEditor class methodsFor:'accessing'!
       
    93 
       
    94 listOfColorMaps
       
    95 
       
    96     |colorMap|
       
    97     (colorMap := OrderedCollection new)
       
    98         add: Color black;
       
    99         add: Color white;
       
   100         add: Color red;
       
   101         add: Color green;
       
   102         add: Color blue;
       
   103         add: Color cyan;
       
   104         add: Color yellow;
       
   105         add: Color magenta;
       
   106         add: (Color red: 50 green: 0 blue: 0);
       
   107         add: (Color red: 0 green: 50 blue: 0);
       
   108         add: (Color red: 0 green: 0 blue: 50);
       
   109         add: (Color red: 0 green: 50 blue: 50);
       
   110         add: (Color red: 50 green: 50 blue: 0);
       
   111         add: (Color red: 50 green: 0 blue: 50);
       
   112         add: Color gray;
       
   113         add: Color lightGray.                                
       
   114     0 to: 5 do:
       
   115     [:r|                                                    
       
   116         0 to: 5 do:         
       
   117         [:g|
       
   118             0 to: 5 do:                             
       
   119             [:b|
       
   120                 colorMap add: (Color red: (r*100//5) ceiling green: (g*100//5) ceiling blue: (b*100//5) ceiling)
       
   121             ]
       
   122         ]
       
   123     ].
       
   124 
       
   125     1 to: 25 do:
       
   126     [:g|                             
       
   127         colorMap add: (Color gray: (g*100//26) ceiling)
       
   128     ].
       
   129 
       
   130     ^Dictionary new
       
   131         at: '8-plane' put: colorMap;
       
   132         at: '8-plane + mask' put: colorMap;
       
   133         at: '4-plane' put: (colorMap copyFrom: 1 to: 16);
       
   134         at: '4-plane + mask' put: (colorMap copyFrom: 1 to: 16);
       
   135         at: '2-plane' put: (colorMap copyFrom: 1 to: 4);
       
   136         at: '2-plane + mask' put: (colorMap copyFrom: 1 to: 4);
       
   137         at: '1-plane' put: (colorMap copyFrom: 1 to: 2);
       
   138         at: '1-plane + mask' put: (colorMap copyFrom: 1 to: 2);
       
   139         yourself
       
   140 !
       
   141 
       
   142 listOfDefaultSizes
       
   143 
       
   144     ^#('24x24' '16x16' '32x32')
       
   145 ! !
       
   146 
       
   147 !ImageEditor class methodsFor:'interface specs'!
       
   148 
       
   149 menu
       
   150     "this window spec was automatically generated by the ST/X MenuEditor"
       
   151 
       
   152     "do not manually edit this - the builder may not be able to
       
   153      handle the specification if its corrupted."
       
   154 
       
   155     "
       
   156      MenuEditor new openOnClass:ImageEditor andSelector:#menu
       
   157      (Menu new fromLiteralArrayEncoding:(ImageEditor menu)) startUp
       
   158     "
       
   159 
       
   160     <resource: #menu>
       
   161 
       
   162     ^
       
   163      
       
   164        #(#Menu
       
   165           
       
   166            #(
       
   167              #(#MenuItem
       
   168                 #'label:' 'About'
       
   169                 #'labelImage:' #(#ResourceRetriever #ImageEditor #icon)
       
   170                 #'submenuChannel:' #menuAbout
       
   171             )
       
   172              #(#MenuItem
       
   173                 #'label:' 'File'
       
   174                 #'translateLabel:' true
       
   175                 #'submenu:' 
       
   176                  #(#Menu
       
   177                     
       
   178                      #(
       
   179                        #(#MenuItem
       
   180                           #'label:' 'New...'
       
   181                           #'value:' #newImage
       
   182                       )
       
   183                        #(#MenuItem
       
   184                           #'label:' '-'
       
   185                       )
       
   186                        #(#MenuItem
       
   187                           #'label:' 'Load From File...'
       
   188                           #'value:' #loadFromFile
       
   189                       )
       
   190                        #(#MenuItem
       
   191                           #'label:' 'Load From Class...'
       
   192                           #'value:' #loadFromClass
       
   193                       )
       
   194                        #(#MenuItem
       
   195                           #'label:' 'Load From Class With Superclass...'
       
   196                           #'translateLabel:' true
       
   197                           #'value:' #loadFromClassWithSuperclass
       
   198                       )
       
   199                        #(#MenuItem
       
   200                           #'label:' '-'
       
   201                       )
       
   202                        #(#MenuItem
       
   203                           #'label:' 'Save'
       
   204                           #'value:' #saveImageFile
       
   205                           #'enabled:' #imageIsLoaded
       
   206                       )
       
   207                        #(#MenuItem
       
   208                           #'label:' 'Save As...'
       
   209                           #'value:' #saveImageFileAs
       
   210                           #'enabled:' #imageIsLoaded
       
   211                       )
       
   212                        #(#MenuItem
       
   213                           #'label:' 'Save Mask As...'
       
   214                           #'value:' #saveImageMaskFileAs
       
   215                           #'enabled:' #imageIsLoaded
       
   216                       )
       
   217                        #(#MenuItem
       
   218                           #'label:' '-'
       
   219                       )
       
   220                        #(#MenuItem
       
   221                           #'label:' 'Save Method'
       
   222                           #'value:' #saveMethod
       
   223                           #'enabled:' #imageIsLoaded
       
   224                       )
       
   225                        #(#MenuItem
       
   226                           #'label:' 'Save Method As...'
       
   227                           #'value:' #saveMethodAs
       
   228                           #'enabled:' #imageIsLoaded
       
   229                       )
       
   230                        #(#MenuItem
       
   231                           #'label:' '-'
       
   232                       )
       
   233                        #(#MenuItem
       
   234                           #'label:' 'Print'
       
   235                           #'value:' #print
       
   236                           #'enabled:' #imageIsLoaded
       
   237                       )
       
   238                        #(#MenuItem
       
   239                           #'label:' '-'
       
   240                       )
       
   241                        #(#MenuItem
       
   242                           #'label:' 'Browse Class'
       
   243                           #'value:' #browseClass
       
   244                           #'enabled:' #imageIsLoaded
       
   245                       )
       
   246                        #(#MenuItem
       
   247                           #'label:' '-'
       
   248                       )
       
   249                        #(#MenuItem
       
   250                           #'label:' 'Exit'
       
   251                           #'translateLabel:' true
       
   252                           #'value:' #closeRequest
       
   253                       )
       
   254                     ) nil
       
   255                     nil
       
   256                 )
       
   257             )
       
   258              #(#MenuItem
       
   259                 #'label:' 'Edit'
       
   260                 #'enabled:' #imageIsLoaded
       
   261                 #'submenu:' 
       
   262                  #(#Menu
       
   263                     
       
   264                      #(
       
   265                        #(#MenuItem
       
   266                           #'label:' 'Undo'
       
   267                           #'value:' #undo
       
   268                       )
       
   269                        #(#MenuItem
       
   270                           #'label:' '-'
       
   271                       )
       
   272                        #(#MenuItem
       
   273                           #'label:' 'Flip - Vertical'
       
   274                           #'value:' #flipVertical
       
   275                       )
       
   276                        #(#MenuItem
       
   277                           #'label:' 'Flip - Horizontal'
       
   278                           #'value:' #flipHorizontal
       
   279                       )
       
   280                        #(#MenuItem
       
   281                           #'label:' '-'
       
   282                       )
       
   283                        #(#MenuItem
       
   284                           #'label:' 'Resize...'
       
   285                           #'value:' #resizeImage
       
   286                       )
       
   287                        #(#MenuItem
       
   288                           #'label:' 'Magnify...'
       
   289                           #'value:' #magnifyImage
       
   290                       )
       
   291                        #(#MenuItem
       
   292                           #'label:' 'Rotate...'
       
   293                           #'value:' #rotateImage
       
   294                       )
       
   295                        #(#MenuItem
       
   296                           #'label:' '-'
       
   297                       )
       
   298                        #(#MenuItem
       
   299                           #'label:' 'Negative'
       
   300                           #'value:' #negativeImage
       
   301                       )
       
   302                     ) nil
       
   303                     nil
       
   304                 )
       
   305             )
       
   306              #(#MenuItem
       
   307                 #'label:' 'Color Map'
       
   308                 #'enabled:' #imageIsLoaded
       
   309                 #'submenu:' 
       
   310                  #(#Menu
       
   311                     
       
   312                      #(
       
   313                        #(#MenuItem
       
   314                           #'label:' '8-Plane'
       
   315                           #'argument:' '8-plane'
       
   316                           #'indication:' #'colorMapMode:value:'
       
   317                       )
       
   318                        #(#MenuItem
       
   319                           #'label:' '4-Plane'
       
   320                           #'argument:' '4-plane'
       
   321                           #'indication:' #'colorMapMode:value:'
       
   322                       )
       
   323                        #(#MenuItem
       
   324                           #'label:' '2-Plane'
       
   325                           #'argument:' '2-plane'
       
   326                           #'indication:' #'colorMapMode:value:'
       
   327                       )
       
   328                        #(#MenuItem
       
   329                           #'label:' '1-Plane'
       
   330                           #'argument:' '1-plane'
       
   331                           #'indication:' #'colorMapMode:value:'
       
   332                       )
       
   333                        #(#MenuItem
       
   334                           #'label:' '-'
       
   335                       )
       
   336                        #(#MenuItem
       
   337                           #'label:' '8-Plane + Mask'
       
   338                           #'argument:' '8-plane + mask'
       
   339                           #'indication:' #'colorMapMode:value:'
       
   340                       )
       
   341                        #(#MenuItem
       
   342                           #'label:' '4-Plane + Mask'
       
   343                           #'argument:' '4-plane + mask'
       
   344                           #'indication:' #'colorMapMode:value:'
       
   345                       )
       
   346                        #(#MenuItem
       
   347                           #'label:' '2-Plane + Mask'
       
   348                           #'argument:' '2-plane + mask'
       
   349                           #'indication:' #'colorMapMode:value:'
       
   350                       )
       
   351                        #(#MenuItem
       
   352                           #'label:' '1-Plane + Mask'
       
   353                           #'argument:' '1-plane + mask'
       
   354                           #'indication:' #'colorMapMode:value:'
       
   355                       )
       
   356                     ) nil
       
   357                     nil
       
   358                 )
       
   359             )
       
   360              #(#MenuItem
       
   361                 #'label:' 'History'
       
   362                 #'submenuChannel:' #menuHistory
       
   363             )
       
   364              #(#MenuItem
       
   365                 #'label:' 'Settings'
       
   366                 #'submenuChannel:' #menuSettings
       
   367             )
       
   368              #(#MenuItem
       
   369                 #'label:' 'Help'
       
   370                 #'submenuChannel:' #menuHelp
       
   371             )
       
   372           ) nil
       
   373           nil
       
   374       )
       
   375 !
       
   376 
       
   377 menuColorAssignment
       
   378     "this window spec was automatically generated by the ST/X MenuEditor"
       
   379 
       
   380     "do not manually edit this - the builder may not be able to
       
   381      handle the specification if its corrupted."
       
   382 
       
   383     "
       
   384      MenuEditor new openOnClass:ImageEditor andSelector:#menuColorAssignment
       
   385      (Menu new fromLiteralArrayEncoding:(ImageEditor menuColorAssignment)) startUp
       
   386     "
       
   387 
       
   388     <resource: #menu>
       
   389 
       
   390     ^
       
   391      
       
   392        #(#Menu
       
   393           
       
   394            #(
       
   395              #(#MenuItem
       
   396                 #'label:' 'left'
       
   397                 #'nameKey:' #leftMouseKeyButton
       
   398                 #'argument:' '1'
       
   399                 #'labelImage:' #(#ResourceRetriever nil #leftMouseKeyIcon)
       
   400                 #'indication:' #'mouseKeyColorMode:value:'
       
   401             )
       
   402              #(#MenuItem
       
   403                 #'label:' 'right'
       
   404                 #'nameKey:' #rightMouseKeyButton
       
   405                 #'argument:' '2'
       
   406                 #'labelImage:' #(#ResourceRetriever nil #rightMouseKeyIcon)
       
   407                 #'indication:' #'mouseKeyColorMode:value:'
       
   408             )
       
   409           ) nil
       
   410           nil
       
   411       )
       
   412 !
       
   413 
       
   414 menuToolbar
       
   415     "this window spec was automatically generated by the ST/X MenuEditor"
       
   416 
       
   417     "do not manually edit this - the builder may not be able to
       
   418      handle the specification if its corrupted."
       
   419 
       
   420     "
       
   421      MenuEditor new openOnClass:ImageEditor andSelector:#menuToolbar
       
   422      (Menu new fromLiteralArrayEncoding:(ImageEditor menuToolbar)) startUp
       
   423     "
       
   424 
       
   425     <resource: #menu>
       
   426 
       
   427     ^
       
   428      
       
   429        #(#Menu
       
   430           
       
   431            #(
       
   432              #(#MenuItem
       
   433                 #'label:' 'newImage'
       
   434                 #'isButton:' true
       
   435                 #'value:' #newImage
       
   436                 #'labelImage:' #(#ResourceRetriever nil #newImageIcon)
       
   437             )
       
   438              #(#MenuItem
       
   439                 #'label:' 'loadFromClass'
       
   440                 #'isButton:' true
       
   441                 #'value:' #loadFromClass
       
   442                 #'labelImage:' #(#ResourceRetriever nil #loadFromClassIcon)
       
   443             )
       
   444              #(#MenuItem
       
   445                 #'label:' 'loadFromFile'
       
   446                 #'isButton:' true
       
   447                 #'value:' #loadFromFile
       
   448                 #'labelImage:' #(#ResourceRetriever nil #loadFromFileIcon)
       
   449             )
       
   450              #(#MenuItem
       
   451                 #'label:' '-'
       
   452             )
       
   453              #(#MenuItem
       
   454                 #'label:' 'saveMethod'
       
   455                 #'isButton:' true
       
   456                 #'value:' #saveMethod
       
   457                 #'enabled:' #imageIsLoaded
       
   458                 #'labelImage:' #(#ResourceRetriever nil #saveAsMethodIcon)
       
   459             )
       
   460              #(#MenuItem
       
   461                 #'label:' 'saveFile'
       
   462                 #'isButton:' true
       
   463                 #'value:' #saveImageFile
       
   464                 #'enabled:' #imageIsLoaded
       
   465                 #'labelImage:' #(#ResourceRetriever nil #saveIcon)
       
   466             )
       
   467              #(#MenuItem
       
   468                 #'label:' '-'
       
   469             )
       
   470              #(#MenuItem
       
   471                 #'label:' 'Point'
       
   472                 #'enabled:' #imageIsLoaded
       
   473                 #'argument:' 'point'
       
   474                 #'indication:' #'editMode:value:'
       
   475             )
       
   476              #(#MenuItem
       
   477                 #'label:' 'Box'
       
   478                 #'enabled:' #imageIsLoaded
       
   479                 #'argument:' 'box'
       
   480                 #'indication:' #'editMode:value:'
       
   481             )
       
   482              #(#MenuItem
       
   483                 #'label:' 'Filled Box'
       
   484                 #'enabled:' #imageIsLoaded
       
   485                 #'argument:' 'filledBox'
       
   486                 #'indication:' #'editMode:value:'
       
   487             )
       
   488              #(#MenuItem
       
   489                 #'label:' 'Fill'
       
   490                 #'enabled:' #imageIsLoaded
       
   491                 #'argument:' 'fill'
       
   492                 #'indication:' #'editMode:value:'
       
   493             )
       
   494              #(#MenuItem
       
   495                 #'label:' 'Copy'
       
   496                 #'enabled:' #imageIsLoaded
       
   497                 #'argument:' 'copy'
       
   498                 #'indication:' #'editMode:value:'
       
   499             )
       
   500              #(#MenuItem
       
   501                 #'label:' 'Paste'
       
   502                 #'enabled:' #imageIsLoaded
       
   503                 #'argument:' 'paste'
       
   504                 #'indication:' #'editMode:value:'
       
   505             )
       
   506           ) nil
       
   507           nil
       
   508       )
       
   509 !
       
   510 
       
   511 windowSpec
       
   512     "this window spec was automatically generated by the ST/X UIPainter"
       
   513 
       
   514     "do not manually edit this - the painter/builder may not be able to
       
   515      handle the specification if its corrupted."
       
   516 
       
   517     "
       
   518      UIPainter new openOnClass:ImageEditor andSelector:#windowSpec
       
   519      ImageEditor new openInterface:#windowSpec
       
   520     "
       
   521     "ImageEditor open"
       
   522 
       
   523     <resource: #canvas>
       
   524 
       
   525     ^
       
   526      
       
   527        #(#FullSpec
       
   528           #'window:' 
       
   529            #(#WindowSpec
       
   530               #'name:' 'Image Editor'
       
   531               #'layout:' #(#LayoutFrame 364 0 199 0 863 0 544 0)
       
   532               #'label:' 'Image Editor'
       
   533               #'min:' #(#Point 400 320)
       
   534               #'max:' #(#Point 1152 900)
       
   535               #'bounds:' #(#Rectangle 364 199 864 545)
       
   536               #'menu:' #menu
       
   537               #'usePreferredExtent:' false
       
   538           )
       
   539           #'component:' 
       
   540            #(#SpecCollection
       
   541               #'collection:' 
       
   542                #(
       
   543                  #(#MenuPanelSpec
       
   544                     #'name:' 'menuToolbarView'
       
   545                     #'layout:' #(#LayoutFrame 0 0.0 0 0 0 1.0 34 0)
       
   546                     #'menu:' #menuToolbar
       
   547                     #'style:' #(#FontDescription #helvetica #medium #roman 10)
       
   548                     #'showSeparatingLines:' true
       
   549                 )
       
   550                  #(#VariableHorizontalPanelSpec
       
   551                     #'name:' 'variableHorizontalPanel1'
       
   552                     #'layout:' #(#LayoutFrame 0 0.0 36 0.0 0 1.0 -22 1.0)
       
   553                     #'component:' 
       
   554                      #(#SpecCollection
       
   555                         #'collection:' 
       
   556                          #(
       
   557                            #(#ViewSpec
       
   558                               #'name:' 'view1'
       
   559                               #'component:' 
       
   560                                #(#SpecCollection
       
   561                                   #'collection:' 
       
   562                                    #(
       
   563                                      #(#FramedBoxSpec
       
   564                                         #'name:' 'framedBox1'
       
   565                                         #'layout:' #(#LayoutFrame 1 0.0 3 0.0 110 0 65 0)
       
   566                                         #'component:' 
       
   567                                          #(#SpecCollection
       
   568                                             #'collection:' 
       
   569                                              #(
       
   570                                                #(#ArrowButtonSpec
       
   571                                                   #'name:' 'magnifyDownButton'
       
   572                                                   #'layout:' #(#LayoutFrame 13 0 20 0 35 0 42 0)
       
   573                                                   #'model:' #magnifyDown
       
   574                                                   #'enableChannel:' #imageIsLoaded
       
   575                                                   #'isTriggerOnDown:' true
       
   576                                                   #'direction:' #left
       
   577                                               )
       
   578                                                #(#ArrowButtonSpec
       
   579                                                   #'name:' 'magnifyUpButton'
       
   580                                                   #'layout:' #(#LayoutFrame 73 0 20 0 95 0 42 0)
       
   581                                                   #'model:' #magnifyUp
       
   582                                                   #'enableChannel:' #imageIsLoaded
       
   583                                                   #'isTriggerOnDown:' true
       
   584                                                   #'direction:' #right
       
   585                                               )
       
   586                                                #(#InputFieldSpec
       
   587                                                   #'name:' 'magnificationInputField'
       
   588                                                   #'layout:' #(#LayoutFrame 36 0 20 0.0 72 0 42 0)
       
   589                                                   #'enableChannel:' #imageIsLoaded
       
   590                                                   #'model:' #valueOfMagnification
       
   591                                                   #'type:' #number
       
   592                                                   #'acceptOnReturn:' false
       
   593                                                   #'acceptOnTab:' false
       
   594                                                   #'numChars:' 2
       
   595                                               )
       
   596                                             )
       
   597                                         )
       
   598                                         #'label:' 'Magnification'
       
   599                                         #'labelPosition:' #topLeft
       
   600                                         #'style:' #(#FontDescription #helvetica #medium #roman 12)
       
   601                                     )
       
   602                                      #(#FramedBoxSpec
       
   603                                         #'name:' 'framedBox2'
       
   604                                         #'layout:' #(#LayoutFrame 1 0.0 68 0 0 1.0 -66 1)
       
   605                                         #'component:' 
       
   606                                          #(#SpecCollection
       
   607                                             #'collection:' 
       
   608                                              #(
       
   609                                                #(#DataSetSpec
       
   610                                                   #'name:' 'colorDataSetView'
       
   611                                                   #'layout:' #(#LayoutFrame 11 0.0 19 0.0 20 1.0 -10 1.0)
       
   612                                                   #'model:' #selectionOfColor
       
   613                                                   #'style:' #(#FontDescription #helvetica #medium #roman 12)
       
   614                                                   #'hasHorizontalScrollBar:' true
       
   615                                                   #'hasVerticalScrollBar:' true
       
   616                                                   #'miniScrollerHorizontal:' true
       
   617                                                   #'miniScrollerVertical:' true
       
   618                                                   #'dataList:' #listOfColors
       
   619                                                   #'has3Dsepartors:' true
       
   620                                                   #'verticalSpacing:' 1
       
   621                                                   #'columns:' 
       
   622                                                    #(
       
   623                                                      #(#DataSetColumnSpec
       
   624                                                         #'rendererType:' #rowSelector
       
   625                                                         #'backgroundSelector:' #yourself
       
   626                                                     )
       
   627                                                      #(#DataSetColumnSpec
       
   628                                                         #'label:' ' Red'
       
   629                                                         #'model:' #rowRedByte
       
   630                                                         #'canSelect:' false
       
   631                                                     )
       
   632                                                      #(#DataSetColumnSpec
       
   633                                                         #'label:' ' Green'
       
   634                                                         #'model:' #rowGreenByte
       
   635                                                         #'canSelect:' false
       
   636                                                     )
       
   637                                                      #(#DataSetColumnSpec
       
   638                                                         #'label:' ' Blue'
       
   639                                                         #'model:' #rowBlueByte
       
   640                                                         #'canSelect:' false
       
   641                                                     )
       
   642                                                   )
       
   643                                               )
       
   644                                                #(#MenuPanelSpec
       
   645                                                   #'name:' 'menuColorAssignmentPanel'
       
   646                                                   #'layout:' #(#LayoutFrame 11 0 -10 1 18 1 17 1)
       
   647                                                   #'enableChannel:' #imageIsLoaded
       
   648                                                   #'menu:' #menuColorAssignment
       
   649                                                   #'style:' #(#FontDescription #helvetica #medium #roman 10)
       
   650                                               )
       
   651                                             )
       
   652                                         )
       
   653                                         #'label:' 'Color Map'
       
   654                                         #'labelPosition:' #topLeft
       
   655                                         #'style:' #(#FontDescription #helvetica #medium #roman 12)
       
   656                                     )
       
   657                                      #(#VerticalPanelViewSpec
       
   658                                         #'name:' 'verticalPanelView1'
       
   659                                         #'layout:' #(#LayoutFrame 1 0.0 -68 1 70 0 0 1.0)
       
   660                                         #'component:' 
       
   661                                          #(#SpecCollection
       
   662                                             #'collection:' 
       
   663                                              #(
       
   664                                                #(#LabelSpec
       
   665                                                   #'name:' 'classNameLabel'
       
   666                                                   #'label:' 'Class:'
       
   667                                                   #'adjust:' #right
       
   668                                                   #'extent:' #(#Point 69 21)
       
   669                                               )
       
   670                                                #(#LabelSpec
       
   671                                                   #'name:' 'selectorLabel'
       
   672                                                   #'label:' 'Selector:'
       
   673                                                   #'adjust:' #right
       
   674                                                   #'extent:' #(#Point 69 20)
       
   675                                               )
       
   676                                                #(#LabelSpec
       
   677                                                   #'name:' 'fileNameLabel'
       
   678                                                   #'label:' 'File Name:'
       
   679                                                   #'adjust:' #right
       
   680                                                   #'extent:' #(#Point 69 21)
       
   681                                               )
       
   682                                             )
       
   683                                         )
       
   684                                         #'horizontalLayout:' #fit
       
   685                                         #'verticalLayout:' #fit
       
   686                                         #'horizontalSpace:' 3
       
   687                                         #'verticalSpace:' 3
       
   688                                     )
       
   689                                      #(#VerticalPanelViewSpec
       
   690                                         #'name:' 'verticalPanelView2'
       
   691                                         #'layout:' #(#LayoutFrame 72 0.0 -68 1 -6 1 0 1.0)
       
   692                                         #'component:' 
       
   693                                          #(#SpecCollection
       
   694                                             #'collection:' 
       
   695                                              #(
       
   696                                                #(#InputFieldSpec
       
   697                                                   #'name:' 'resourceClassInputField'
       
   698                                                   #'activeHelpKey:' #classNameInputField
       
   699                                                   #'model:' #valueOfResourceClass
       
   700                                                   #'immediateAccept:' false
       
   701                                                   #'extent:' #(#Point 142 21)
       
   702                                               )
       
   703                                                #(#InputFieldSpec
       
   704                                                   #'name:' 'resourceSelectorInputField'
       
   705                                                   #'activeHelpKey:' #selectorInputFieldHelp
       
   706                                                   #'model:' #valueOfResourceSelector
       
   707                                                   #'immediateAccept:' false
       
   708                                                   #'acceptOnTab:' false
       
   709                                                   #'extent:' #(#Point 142 20)
       
   710                                               )
       
   711                                                #(#InputFieldSpec
       
   712                                                   #'name:' 'fileNameInputField'
       
   713                                                   #'activeHelpKey:' #fileNameInputFieldHelp
       
   714                                                   #'model:' #valueOfFileName
       
   715                                                   #'immediateAccept:' false
       
   716                                                   #'acceptOnTab:' false
       
   717                                                   #'extent:' #(#Point 142 21)
       
   718                                               )
       
   719                                             )
       
   720                                         )
       
   721                                         #'horizontalLayout:' #fit
       
   722                                         #'verticalLayout:' #fit
       
   723                                         #'horizontalSpace:' 3
       
   724                                         #'verticalSpace:' 3
       
   725                                     )
       
   726                                      #(#ArbitraryComponentSpec
       
   727                                         #'name:' 'imagePreView'
       
   728                                         #'layout:' #(#LayoutFrame 111 0.0 9 0.0 -6 1 60 0)
       
   729                                         #'hasHorizontalScrollBar:' true
       
   730                                         #'hasVerticalScrollBar:' true
       
   731                                         #'miniScrollerHorizontal:' true
       
   732                                         #'miniScrollerVertical:' true
       
   733                                         #'component:' #ImageView
       
   734                                         #'hasBorder:' true
       
   735                                     )
       
   736                                   )
       
   737                               )
       
   738                               #'level:' -1
       
   739                           )
       
   740                            #(#ViewSpec
       
   741                               #'name:' 'view2'
       
   742                               #'component:' 
       
   743                                #(#SpecCollection
       
   744                                   #'collection:' 
       
   745                                    #(
       
   746                                      #(#ArbitraryComponentSpec
       
   747                                         #'name:' 'imageEditView'
       
   748                                         #'layout:' #(#LayoutFrame 2 0.0 2 0.0 -2 1.0 1 1.0)
       
   749                                         #'hasHorizontalScrollBar:' true
       
   750                                         #'hasVerticalScrollBar:' true
       
   751                                         #'component:' #ImageEditView
       
   752                                         #'hasBorder:' false
       
   753                                     )
       
   754                                   )
       
   755                               )
       
   756                               #'level:' -1
       
   757                           )
       
   758                         )
       
   759                     )
       
   760                     #'handles:' #(#Any 0.45082 1.0)
       
   761                 )
       
   762                  #(#LabelSpec
       
   763                     #'name:' 'infoLabel'
       
   764                     #'layout:' #(#LayoutFrame 0 0 -22 1 -170 1 0 1.0)
       
   765                     #'labelChannel:' #valueOfInfoLabel
       
   766                     #'level:' 1
       
   767                     #'adjust:' #left
       
   768                 )
       
   769                  #(#LabelSpec
       
   770                     #'name:' 'timeLabel'
       
   771                     #'layout:' #(#LayoutFrame -65 1 -22 1 0 1.0 0 1.0)
       
   772                     #'labelChannel:' #valueOfTimeLabel
       
   773                     #'level:' 1
       
   774                     #'adjust:' #right
       
   775                 )
       
   776                  #(#LabelSpec
       
   777                     #'name:' 'coordLabel'
       
   778                     #'layout:' #(#LayoutFrame -170 1 -22 1 -65 1 0 1.0)
       
   779                     #'labelChannel:' #valueOfCoordLabel
       
   780                     #'level:' 1
       
   781                     #'adjust:' #left
       
   782                 )
       
   783               )
       
   784           )
       
   785       )
       
   786 !
       
   787 
       
   788 windowSpecForNewImage
       
   789     "this window spec was automatically generated by the ST/X UIPainter"
       
   790 
       
   791     "do not manually edit this - the painter/builder may not be able to
       
   792      handle the specification if its corrupted."
       
   793 
       
   794     "
       
   795      UIPainter new openOnClass:ImageEditor andSelector:#windowSpecForNewImage
       
   796      ImageEditor new openInterface:#windowSpecForNewImage
       
   797     "
       
   798 
       
   799     <resource: #canvas>
       
   800 
       
   801     ^
       
   802      
       
   803        #(#FullSpec
       
   804           #'window:' 
       
   805            #(#WindowSpec
       
   806               #'name:' 'New Image'
       
   807               #'layout:' #(#LayoutFrame 194 0 152 0 461 0 248 0)
       
   808               #'label:' 'New Image'
       
   809               #'min:' #(#Point 10 10)
       
   810               #'max:' #(#Point 1152 900)
       
   811               #'bounds:' #(#Rectangle 194 152 462 249)
       
   812               #'usePreferredExtent:' false
       
   813           )
       
   814           #'component:' 
       
   815            #(#SpecCollection
       
   816               #'collection:' 
       
   817                #(
       
   818                  #(#ViewSpec
       
   819                     #'name:' 'View'
       
   820                     #'layout:' #(#LayoutFrame 0 0.0 0 0.0 0 1.0 -38 1.0)
       
   821                     #'component:' 
       
   822                      #(#SpecCollection
       
   823                         #'collection:' 
       
   824                          #(
       
   825                            #(#FramedBoxSpec
       
   826                               #'name:' 'framedBox1'
       
   827                               #'layout:' #(#LayoutFrame 1 0.0 1 0.0 0 0.4 55 0)
       
   828                               #'component:' 
       
   829                                #(#SpecCollection
       
   830                                   #'collection:' 
       
   831                                    #(
       
   832                                      #(#ComboBoxSpec
       
   833                                         #'name:' 'defaultSizesComboBox'
       
   834                                         #'layout:' #(#LayoutFrame 15 0.0 16 0.0 15 1.0 16 1.0)
       
   835                                         #'model:' #selectionOfSize
       
   836                                         #'type:' #string
       
   837                                         #'comboList:' #listOfDefaultSizes
       
   838                                     )
       
   839                                   )
       
   840                               )
       
   841                               #'label:' 'Size'
       
   842                               #'labelPosition:' #topLeft
       
   843                               #'style:' #(#FontDescription #helvetica #medium #roman 12)
       
   844                           )
       
   845                            #(#FramedBoxSpec
       
   846                               #'name:' 'framedBox2'
       
   847                               #'layout:' #(#LayoutFrame 0 0.4 1 0.0 -1 1.0 55 0)
       
   848                               #'component:' 
       
   849                                #(#SpecCollection
       
   850                                   #'collection:' 
       
   851                                    #(
       
   852                                      #(#ComboListSpec
       
   853                                         #'name:' 'colorMapComboBox'
       
   854                                         #'layout:' #(#LayoutFrame 15 0.0 16 0.0 15 1.0 16 1.0)
       
   855                                         #'model:' #selectionOfColorMap
       
   856                                         #'comboList:' #listOfColorMaps
       
   857                                         #'useIndex:' false
       
   858                                     )
       
   859                                   )
       
   860                               )
       
   861                               #'label:' 'Color Map'
       
   862                               #'labelPosition:' #topLeft
       
   863                               #'style:' #(#FontDescription #helvetica #medium #roman 12)
       
   864                           )
       
   865                         )
       
   866                     )
       
   867                     #'level:' 1
       
   868                 )
       
   869                  #(#HorizontalPanelViewSpec
       
   870                     #'name:' 'horizontalPanelView1'
       
   871                     #'layout:' #(#LayoutFrame 0 0.0 -38 1 0 1.0 0 1.0)
       
   872                     #'component:' 
       
   873                      #(#SpecCollection
       
   874                         #'collection:' 
       
   875                          #(
       
   876                            #(#ActionButtonSpec
       
   877                               #'name:' 'actionButton2'
       
   878                               #'label:' 'Cancel'
       
   879                               #'model:' #cancel
       
   880                               #'extent:' #(#Point 100 22)
       
   881                           )
       
   882                            #(#ActionButtonSpec
       
   883                               #'name:' 'actionButton1'
       
   884                               #'label:' 'OK'
       
   885                               #'model:' #accept
       
   886                               #'isDefault:' true
       
   887                               #'extent:' #(#Point 100 22)
       
   888                           )
       
   889                         )
       
   890                     )
       
   891                     #'horizontalLayout:' #center
       
   892                     #'verticalLayout:' #center
       
   893                     #'horizontalSpace:' 2
       
   894                     #'verticalSpace:' 1
       
   895                 )
       
   896               )
       
   897           )
       
   898       )
       
   899 ! !
       
   900 
       
   901 !ImageEditor class methodsFor:'resources'!
       
   902 
       
   903 leftMouseKeyIcon
       
   904     "ImageEditor openOnClass:self andSelector:#leftMouseKeyIcon"
       
   905 
       
   906     <resource: #image>
       
   907     ^(Depth2Image new) width: 16; height: 16; photometric:(#palette); bitsPerSample:(#(2 )); samplesPerPixel:(1); bits:(#[0 0 0 0 0 0 0 0 0 0 0 0 0 161 69 0 0 161 69 0 0 161 69 0 0 0 0 0 0 85 85 0 0 85 85 0 0 85 85 0 0 85 85 0 0 85 85 0 0 85 85 0 0 21 84 0 0 0 0 0 0 0 0 0]) ; colorMap:((OrderedCollection new add:(Color black); add:(Color white); add:(Color red:100.0 green:0.0 blue:0.0); add:(Color red:0.0 green:100.0 blue:0.0); yourself)); mask:((Depth1Image new) width: 16; height: 16; photometric:(#blackIs0); bitsPerSample:(#(1 )); samplesPerPixel:(1); bits:(#[0 0 0 0 15 240 31 248 31 248 31 248 31 248 31 248 31 248 31 248 31 248 31 248 31 248 15 240 7 224 0 0]) ; yourself); yourself
       
   908 !
       
   909 
       
   910 loadFromClassIcon
       
   911     "ImageEditor openOnClass:self andSelector:#loadFromClassIcon"
       
   912 
       
   913     <resource: #image>
       
   914     ^(Depth4Image new) width: 22; height: 22; photometric:(#palette); bitsPerSample:(#(4 )); samplesPerPixel:(1); bits:(#[17 17 17 17 17 17 17 17 17 17 17 17 0 0 0 0 0 0 0 17 17 17 17 15 255 255 255 255 255 255 30 17 17 17 15 255 255 255 255 255 255 30 225 17 17 15 68 71 119 74 71 215 17 17 17 17 15 68 71 119 164 173 125 255 254 17 17 15 68 71 119 74 71 215 255 254 17 17 15 51 54 102 57 54 198 255 254 17 17 15 51 54 102 147 156 108 255 254 17 17 15 51 54 102 57 54 198 255 254 17 17 15 34 37 85 40 37 181 255 254 17 17 15 34 37 85 130 139 91 255 254 17 17 15 34 37 85 40 37 181 255 254 17 17 15 255 255 255 255 255 255 255 254 17 17 15 17 241 255 31 241 31 17 254 17 17 15 31 241 241 241 241 255 31 254 17 17 15 31 241 241 17 241 31 17 254 17 17 15 31 241 241 241 255 31 241 254 17 17 15 17 241 17 241 241 31 17 254 17 17 15 255 255 255 255 255 255 255 254 17 17 254 238 238 238 238 238 238 238 238 17 17 17 17 17 17 17 17 17 17 17 17]) ; colorMap:((OrderedCollection new add:(Color white); add:(Color black); add:(Color red:100.0 green:0.0 blue:0.0); add:(Color red:0.0 green:100.0 blue:0.0); add:(Color red:0.0 green:0.0 blue:100.0); add:(Color red:0.0 green:100.0 blue:100.0); add:(Color red:100.0 green:100.0 blue:0.0); add:(Color red:100.0 green:0.0 blue:100.0); add:(Color red:49.9962 green:0.0 blue:0.0); add:(Color red:0.0 green:49.9962 blue:0.0); add:(Color red:0.0 green:0.0 blue:49.9962); add:(Color red:0.0 green:49.9962 blue:49.9962); add:(Color red:49.9962 green:49.9962 blue:0.0); add:(Color red:49.9962 green:0.0 blue:49.9962); add:(Color grey:49.9962); add:(Color grey:66.9978); add:(Color black); yourself)); mask:((Depth1Image new) width: 22; height: 22; photometric:(#blackIs0); bitsPerSample:(#(1 )); samplesPerPixel:(1); bits:(#[127 255 128 127 255 192 127 255 224 127 255 240 127 255 248 127 255 248 127 255 248 127 255 248 127 255 248 127 255 248 127 255 248 127 255 248 127 255 248 127 255 248 127 255 248 127 255 248 127 255 248 127 255 248 127 255 248 127 255 248 127 255 248 127 255 248]) ; yourself); yourself!
       
   915 
       
   916 loadFromFileIcon
       
   917     "ImageEditor openOnClass:self andSelector:#loadFromFileIcon"
       
   918 
       
   919     <resource: #image>
       
   920     ^(Depth4Image new) width: 22; height: 22; photometric:(#palette); bitsPerSample:(#(4 )); samplesPerPixel:(1); bits:(#[17 17 17 17 17 17 17 17 17 17 17 17 0 0 0 0 0 0 0 17 17 17 17 15 255 255 255 255 255 255 30 17 17 17 15 255 255 255 255 255 255 30 225 17 17 15 68 71 119 74 71 215 17 17 17 17 15 68 71 119 164 173 125 255 254 17 17 15 68 71 119 74 71 215 255 254 17 17 15 51 54 102 57 54 198 255 254 17 17 15 51 54 102 147 156 108 255 254 17 17 15 51 54 102 57 54 198 255 254 17 17 15 34 37 85 40 37 181 255 254 17 17 15 34 37 85 130 139 91 255 254 17 17 15 34 37 85 40 37 181 255 254 17 17 15 255 255 255 255 255 255 255 254 17 17 15 17 31 31 241 255 241 17 254 17 17 15 31 255 31 241 255 241 255 254 17 17 15 17 255 31 241 255 241 31 254 17 17 15 31 255 31 241 255 241 255 254 17 17 15 31 255 31 241 17 241 17 254 17 17 15 255 255 255 255 255 255 255 254 17 17 254 238 238 238 238 238 238 238 238 17 17 17 17 17 17 17 17 17 17 17 17]) ; colorMap:((OrderedCollection new add:(Color white); add:(Color black); add:(Color red:100.0 green:0.0 blue:0.0); add:(Color red:0.0 green:100.0 blue:0.0); add:(Color red:0.0 green:0.0 blue:100.0); add:(Color red:0.0 green:100.0 blue:100.0); add:(Color red:100.0 green:100.0 blue:0.0); add:(Color red:100.0 green:0.0 blue:100.0); add:(Color red:49.9962 green:0.0 blue:0.0); add:(Color red:0.0 green:49.9962 blue:0.0); add:(Color red:0.0 green:0.0 blue:49.9962); add:(Color red:0.0 green:49.9962 blue:49.9962); add:(Color red:49.9962 green:49.9962 blue:0.0); add:(Color red:49.9962 green:0.0 blue:49.9962); add:(Color grey:49.9962); add:(Color grey:66.9978); add:(Color black); yourself)); mask:((Depth1Image new) width: 22; height: 22; photometric:(#blackIs0); bitsPerSample:(#(1 )); samplesPerPixel:(1); bits:(#[127 255 128 127 255 192 127 255 224 127 255 240 127 255 248 127 255 248 127 255 248 127 255 248 127 255 248 127 255 248 127 255 248 127 255 248 127 255 248 127 255 248 127 255 248 127 255 248 127 255 248 127 255 248 127 255 248 127 255 248 127 255 248 127 255 248]) ; yourself); yourself!
       
   921 
       
   922 newImageIcon
       
   923     "ImageEditor openOnClass:self andSelector:#newImageIcon"
       
   924 
       
   925     <resource: #image>
       
   926     ^(Depth4Image new) width: 22; height: 22; photometric:(#palette); bitsPerSample:(#(4 )); samplesPerPixel:(1); bits:(#[17 17 17 17 17 17 17 17 17 17 17 17 0 0 0 0 0 0 0 17 17 17 17 15 255 255 255 255 255 255 30 17 17 17 15 255 255 255 255 255 255 30 225 17 17 15 68 71 119 74 71 215 17 17 17 17 15 68 71 119 164 173 125 255 254 17 17 15 68 71 119 74 71 215 255 254 17 17 15 51 54 102 57 54 198 255 254 17 17 15 51 54 102 147 156 108 255 254 17 17 15 51 54 102 57 54 198 255 254 17 17 15 34 37 85 40 37 181 255 254 17 17 15 34 37 85 130 139 91 255 254 17 17 15 34 37 85 40 37 181 255 254 17 17 15 255 255 255 255 255 255 255 254 17 17 15 31 241 241 17 241 241 241 254 17 17 15 17 241 241 255 241 241 241 254 17 17 15 17 17 241 31 241 241 241 254 17 17 15 31 17 241 255 241 241 241 254 17 17 15 31 241 241 17 255 31 31 254 17 17 15 255 255 255 255 255 255 255 254 17 17 254 238 238 238 238 238 238 238 238 17 17 17 17 17 17 17 17 17 17 17 17]) ; colorMap:((OrderedCollection new add:(Color white); add:(Color black); add:(Color red:100.0 green:0.0 blue:0.0); add:(Color red:0.0 green:100.0 blue:0.0); add:(Color red:0.0 green:0.0 blue:100.0); add:(Color red:0.0 green:100.0 blue:100.0); add:(Color red:100.0 green:100.0 blue:0.0); add:(Color red:100.0 green:0.0 blue:100.0); add:(Color red:49.9962 green:0.0 blue:0.0); add:(Color red:0.0 green:49.9962 blue:0.0); add:(Color red:0.0 green:0.0 blue:49.9962); add:(Color red:0.0 green:49.9962 blue:49.9962); add:(Color red:49.9962 green:49.9962 blue:0.0); add:(Color red:49.9962 green:0.0 blue:49.9962); add:(Color grey:49.9962); add:(Color grey:66.9978); add:(Color black); yourself)); mask:((Depth1Image new) width: 22; height: 22; photometric:(#blackIs0); bitsPerSample:(#(1 )); samplesPerPixel:(1); bits:(#[127 255 128 127 255 192 127 255 224 127 255 240 127 255 248 127 255 248 127 255 248 127 255 248 127 255 248 127 255 248 127 255 248 127 255 248 127 255 248 127 255 248 127 255 248 127 255 248 127 255 248 127 255 248 127 255 248 127 255 248 127 255 248 127 255 248]) ; yourself); yourself!
       
   927 
       
   928 rightMouseKeyIcon
       
   929     "ImageEditor openOnClass:self andSelector:#rightMouseKeyIcon"
       
   930 
       
   931     <resource: #image>
       
   932     ^(Depth2Image new) width: 16; height: 16; photometric:(#palette); bitsPerSample:(#(2 )); samplesPerPixel:(1); bits:(#[0 0 0 0 0 0 0 0 0 0 0 0 0 82 138 0 0 82 138 0 0 82 138 0 0 0 0 0 0 85 85 0 0 85 85 0 0 85 85 0 0 85 85 0 0 85 85 0 0 85 85 0 0 21 84 0 0 0 0 0 0 0 0 0]) ; colorMap:((OrderedCollection new add:(Color black); add:(Color white); add:(Color red:100.0 green:0.0 blue:0.0); add:(Color red:0.0 green:100.0 blue:0.0); yourself)); mask:((Depth1Image new) width: 16; height: 16; photometric:(#blackIs0); bitsPerSample:(#(1 )); samplesPerPixel:(1); bits:(#[0 0 0 0 15 240 31 248 31 248 31 248 31 248 31 248 31 248 31 248 31 248 31 248 31 248 15 240 7 224 0 0]) ; yourself); yourself
       
   933 !
       
   934 
       
   935 saveAsMethodIcon
       
   936     "ImageEditor openOnClass:self andSelector:#saveAsMethodIcon"
       
   937 
       
   938     <resource: #image>
       
   939     ^(Depth4Image new) width: 22; height: 22; photometric:(#palette); bitsPerSample:(#(4 )); samplesPerPixel:(1); bits:(#[17 17 17 17 17 17 17 17 17 17 17 17 17 17 17 17 17 17 17 17 17 17 17 17 17 17 17 17 17 17 17 17 17 17 17 17 17 17 17 17 17 17 17 17 17 17 17 17 17 17 17 17 17 17 17 17 17 17 17 17 17 17 17 17 17 17 17 17 17 17 17 17 17 17 17 17 17 17 17 17 17 17 17 17 17 17 17 17 17 17 17 17 17 17 17 17 17 17 17 17 17 30 225 17 17 17 17 17 17 17 17 17 17 17 17 17 17 17 17 17 17 17 17 17 17 17 17 17 17 17 17 17 17 17 17 17 17 17 17 17 17 17 17 17 17 17 20 68 119 116 164 125 126 30 17 17 17 20 68 119 122 74 215 209 225 17 17 17 20 68 119 116 164 125 126 30 17 17 17 19 51 102 99 147 108 96 240 17 17 17 19 51 102 105 57 198 207 15 17 17 17 19 51 102 99 147 108 96 240 17 17 17 18 34 85 82 130 91 94 238 17 17 17 18 34 85 88 40 181 190 238 17 17 17 18 34 85 82 130 91 94 238]) ; colorMap:((OrderedCollection new add:(Color white); add:(Color black); add:(Color red:100.0 green:0.0 blue:0.0); add:(Color red:0.0 green:100.0 blue:0.0); add:(Color red:0.0 green:0.0 blue:100.0); add:(Color red:0.0 green:100.0 blue:100.0); add:(Color red:100.0 green:100.0 blue:0.0); add:(Color red:100.0 green:0.0 blue:100.0); add:(Color red:49.9962 green:0.0 blue:0.0); add:(Color red:0.0 green:49.9962 blue:0.0); add:(Color red:0.0 green:0.0 blue:49.9962); add:(Color red:0.0 green:49.9962 blue:49.9962); add:(Color red:49.9962 green:49.9962 blue:0.0); add:(Color red:49.9962 green:0.0 blue:49.9962); add:(Color grey:49.9962); add:(Color grey:66.9978); add:(Color black); yourself)); mask:((Depth1Image new) width: 22; height: 22; photometric:(#blackIs0); bitsPerSample:(#(1 )); samplesPerPixel:(1); bits:(#[0 0 0 32 0 0 0 0 0 35 51 128 36 74 64 36 74 64 19 50 64 0 0 0 0 0 0 6 0 0 6 0 0 9 0 0 0 0 0 1 255 252 1 255 252 1 255 252 1 255 252 1 255 252 1 255 252 1 255 252 1 255 252 1 255 252]) ; yourself); yourself! !
       
   940 
       
   941 !ImageEditor methodsFor:'accessing'!
       
   942 
       
   943 image
       
   944 
       
   945     ^self imageEditView image
       
   946 !
       
   947 
       
   948 postOpenAction: anAction
       
   949 
       
   950     postOpenAction := anAction
       
   951 ! !
       
   952 
       
   953 !ImageEditor methodsFor:'accessing - views'!
       
   954 
       
   955 fileNameInputField
       
   956 
       
   957     ^builder componentAt: #fileNameInputField
       
   958 !
       
   959 
       
   960 imageEditView
       
   961 
       
   962     ^(builder componentAt: #imageEditView) subViews first 
       
   963 !
       
   964 
       
   965 imagePreView
       
   966 
       
   967     ^(builder componentAt: #imagePreView) subViews first 
       
   968 
       
   969 !
       
   970 
       
   971 resourceClassInputField
       
   972 
       
   973     ^builder componentAt: #resourceClassInputField
       
   974 !
       
   975 
       
   976 resourceSelectorInputField
       
   977 
       
   978     ^builder componentAt: #resourceSelectorInputField
       
   979 ! !
       
   980 
       
   981 !ImageEditor methodsFor:'accessing menu'!
       
   982 
       
   983 menu
       
   984     "this window spec was automatically generated by the UI Builder"
       
   985 
       
   986     ^ self class menu
       
   987 
       
   988 
       
   989 !
       
   990 
       
   991 menuToolbar
       
   992     "this window spec was automatically generated by the UI Builder"
       
   993 
       
   994     ^ self class menuToolbar
       
   995 
       
   996 
       
   997 ! !
       
   998 
       
   999 !ImageEditor methodsFor:'aspects'!
       
  1000 
       
  1001 imageIsLoaded
       
  1002 
       
  1003     |holder|
       
  1004     (holder := builder bindingAt:#imageIsLoaded) isNil ifTrue:[
       
  1005         builder aspectAt:#imageIsLoaded put:(holder :=  false asValue).
       
  1006     ].
       
  1007     ^ holder
       
  1008 !
       
  1009 
       
  1010 listOfColors
       
  1011 
       
  1012     |holder|
       
  1013     (holder := builder bindingAt:#listOfColors) isNil ifTrue:[
       
  1014         builder aspectAt:#listOfColors put:(holder :=  List new).
       
  1015     ].
       
  1016     ^ holder
       
  1017 !
       
  1018 
       
  1019 selectionOfColor
       
  1020 
       
  1021     |holder|
       
  1022     (holder := builder bindingAt:#selectionOfColor) isNil ifTrue:[
       
  1023         builder aspectAt:#selectionOfColor put:(
       
  1024         holder := AspectAdaptor new subject:self; forAspect:#selectedColorIndex).
       
  1025     ].
       
  1026     ^ holder
       
  1027 !
       
  1028 
       
  1029 valueOfCoordLabel
       
  1030 
       
  1031     |holder|
       
  1032     (holder := builder bindingAt:#valueOfCoordLabel) isNil ifTrue:[
       
  1033         builder aspectAt:#valueOfCoordLabel put:(holder :=  ValueHolder new).
       
  1034     ].
       
  1035     ^ holder
       
  1036 !
       
  1037 
       
  1038 valueOfFileName
       
  1039 
       
  1040     |holder|
       
  1041     (holder := builder bindingAt:#valueOfFileName) isNil ifTrue:[
       
  1042         builder aspectAt:#valueOfFileName put:(holder :=  '' asValue).
       
  1043         holder addDependent: self
       
  1044     ].
       
  1045     ^ holder
       
  1046 !
       
  1047 
       
  1048 valueOfMagnification
       
  1049 
       
  1050     |holder|
       
  1051     (holder := builder bindingAt:#valueOfMagnification) isNil ifTrue:[
       
  1052         builder aspectAt:#valueOfMagnification put:(
       
  1053         holder := AspectAdaptor new subject:self; forAspect:#magnification)
       
  1054     ].
       
  1055     ^ holder
       
  1056 !
       
  1057 
       
  1058 valueOfResourceClass
       
  1059 
       
  1060     |holder|
       
  1061     (holder := builder bindingAt:#valueOfResourceClass) isNil ifTrue:[
       
  1062         builder aspectAt:#valueOfResourceClass put: (holder := '' asValue).
       
  1063         holder addDependent: self
       
  1064     ].
       
  1065     ^ holder
       
  1066 !
       
  1067 
       
  1068 valueOfResourceSelector
       
  1069 
       
  1070     |holder|
       
  1071     (holder := builder bindingAt:#valueOfResourceSelector) isNil ifTrue:[
       
  1072         builder aspectAt:#valueOfResourceSelector put: (holder := '' asValue).
       
  1073         holder addDependent: self
       
  1074     ].
       
  1075     ^ holder
       
  1076 ! !
       
  1077 
       
  1078 !ImageEditor methodsFor:'change & update'!
       
  1079 
       
  1080 update:something with:aParameter from:changedObject
       
  1081 
       
  1082     something == #value
       
  1083     ifTrue:
       
  1084     [   
       
  1085         (changedObject = self valueOfResourceClass)
       
  1086         ifTrue:
       
  1087         [   
       
  1088             |s what m|
       
  1089             s := self resourceClassInputField contents withoutSpaces.
       
  1090             what := Smalltalk classnameCompletion:s.
       
  1091             self resourceClassInputField contents:what first.
       
  1092             (what at:2) size ~~ 1 ifTrue:[
       
  1093                 Display beep
       
  1094             ]
       
  1095         ].
       
  1096         (changedObject = self valueOfResourceClass) | (changedObject = self valueOfResourceSelector)
       
  1097         ifTrue:
       
  1098         [   
       
  1099             self loadFromMessage: self resourceClassInputField contents, ' ', self resourceSelectorInputField contents
       
  1100         ].
       
  1101         (changedObject = self valueOfFileName)
       
  1102         ifTrue:
       
  1103         [   
       
  1104             self loadFromFile: self fileNameInputField contents
       
  1105         ].
       
  1106     ].
       
  1107 
       
  1108     super update:something with:aParameter from:changedObject
       
  1109 
       
  1110 ! !
       
  1111 
       
  1112 !ImageEditor methodsFor:'menu modes'!
       
  1113 
       
  1114 colorMapMode: aMode
       
  1115 
       
  1116     ^colorMapMode = aMode
       
  1117 !
       
  1118 
       
  1119 colorMapMode: aMode value: aValue
       
  1120 
       
  1121     |depth newColorMap newImage image newColors oldFileName| 
       
  1122 
       
  1123     newColorMap := self class listOfColorMaps at: aMode.
       
  1124     depth := (newColorMap size log: 2) asInteger. 
       
  1125     newImage := (Image implementorForDepth: depth) new.  
       
  1126     oldFileName := self image fileName.
       
  1127     Object errorSignal handle:
       
  1128     [:ex|
       
  1129         Object errorSignal handle:
       
  1130         [:ex|
       
  1131             ^self warn: 'Convertation failed!!'
       
  1132         ]
       
  1133         do:
       
  1134         [
       
  1135             self image colorsFromX:0 y:0 toX:(self image width-1) y:(self image height-1) do:
       
  1136             [:x :y :clr |
       
  1137                 (newColorMap includes: clr)
       
  1138                     ifTrue: [self image colorAtX:x y:y put:clr]
       
  1139                     ifFalse: [self image colorAtX:x y:y put: self image colorMap first]
       
  1140             ].
       
  1141             image := newImage fromImage: self image.
       
  1142         ].
       
  1143     ] 
       
  1144     do:
       
  1145     [ 
       
  1146         image := newImage fromImage: self image
       
  1147     ].
       
  1148     (String fromString: aMode) reverse readStream nextWord reverse = 'mask'
       
  1149     ifTrue:
       
  1150     [
       
  1151         image mask isNil
       
  1152         ifTrue:
       
  1153         [
       
  1154             image mask: (Depth1Image fromImage: (image asThresholdMonochromeImage: 0.1)). 
       
  1155         ].
       
  1156     ]
       
  1157     ifFalse:
       
  1158     [ 
       
  1159         image mask: nil.
       
  1160     ].
       
  1161     newColors := (image realColorMap copyFrom: 1 to: (newColorMap size min: image realColorMap size)) asOrderedCollection.
       
  1162     newColorMap do:
       
  1163     [:clr|
       
  1164         ((newColors size < newColorMap size) and: [(newColors includes: clr) not]) 
       
  1165         ifTrue:
       
  1166         [      
       
  1167             newColors add: clr
       
  1168         ]
       
  1169     ].
       
  1170     image colorMap: newColors.
       
  1171     colorMapMode := aMode.
       
  1172     (self imageEditView image: image) notNil
       
  1173     ifTrue:
       
  1174     [
       
  1175         self image fileName: oldFileName.
       
  1176         self listOfColors contents: image colorMap.
       
  1177         self findColorMapMode.
       
  1178         self updateInputFieldsAndLabelsAndHistory.
       
  1179     ]
       
  1180 !
       
  1181 
       
  1182 editMode: aMode
       
  1183 
       
  1184     ^self imageEditView editMode = aMode
       
  1185 !
       
  1186 
       
  1187 editMode: aMode value: aValue
       
  1188 
       
  1189     self imageEditView editMode: aMode
       
  1190 !
       
  1191 
       
  1192 mouseKeyColorMode: aMode
       
  1193 
       
  1194     ^self imageEditView mouseKeyColorMode = aMode
       
  1195 !
       
  1196 
       
  1197 mouseKeyColorMode: aMode value: aValue
       
  1198 
       
  1199     self imageEditView mouseKeyColorMode: aMode.
       
  1200 
       
  1201     self selectionOfColor value: (self listOfColors indexOf: self imageEditView selectedColor).
       
  1202 ! !
       
  1203 
       
  1204 !ImageEditor methodsFor:'private'!
       
  1205 
       
  1206 findColorMapMode
       
  1207 
       
  1208     self image depth > 8 ifTrue: [colorMapMode := ''. self listOfColors removeAll. ^nil].
       
  1209     colorMapMode := self image depth printString, '-plane'.
       
  1210     self listOfColors isEmpty
       
  1211     ifTrue:
       
  1212     [   
       
  1213          self colorMapMode: colorMapMode value: nil
       
  1214     ].       
       
  1215     self imageEditView selectColor: (Array with: (self listOfColors at: 1) with: (self listOfColors at: 2)).
       
  1216     self image mask notNil
       
  1217     ifTrue:
       
  1218     [
       
  1219         colorMapMode := colorMapMode, ' + mask'.
       
  1220         self listOfColors addFirst: (Color basicNew setColorId:0).
       
  1221         self imageEditView selectColor: (Array with: (self listOfColors at: 2) with: (self listOfColors at: 1)).
       
  1222     ].
       
  1223     self selectionOfColor value: 0.
       
  1224     self selectionOfColor value: (self listOfColors indexOf: self imageEditView selectedColor).
       
  1225 !
       
  1226 
       
  1227 sortColorColumn: aColumn
       
  1228 
       
  1229 
       
  1230 
       
  1231 !
       
  1232 
       
  1233 updateInfoLabel
       
  1234 
       
  1235     |usedColors|
       
  1236     self image colorMap isNil ifTrue: [usedColors := '?'] ifFalse: [usedColors := self image usedColors size].
       
  1237     self valueOfInfoLabel value:
       
  1238         self image width printString, 'x',
       
  1239         self image height printString, 'x',
       
  1240         (2 raisedTo: self image depth) printString,
       
  1241         (self image mask notNil ifTrue: [' (mask + '] ifFalse: ['(']),
       
  1242         usedColors printString,
       
  1243         ' used colors)'
       
  1244 
       
  1245 
       
  1246 !
       
  1247 
       
  1248 updateInputFieldsAndLabelsAndHistory
       
  1249 
       
  1250     self imageIsLoaded value: self image notNil.
       
  1251 
       
  1252     self image isNil ifTrue: [^nil].
       
  1253 
       
  1254     self updateInfoLabel.
       
  1255     self imageEditView coordInfoBlock: [:value| self valueOfCoordLabel value: value].
       
  1256 
       
  1257     self valueOfFileName removeDependent: self.
       
  1258     self valueOfFileName value: self image fileName.
       
  1259     self valueOfFileName addDependent: self.
       
  1260 
       
  1261     self valueOfResourceSelector removeDependent: self.
       
  1262     self valueOfResourceSelector value: self imageEditView resourceSelector.
       
  1263     self valueOfResourceSelector addDependent: self.
       
  1264 
       
  1265     self valueOfResourceClass removeDependent: self.
       
  1266     self imageEditView resourceClass notNil
       
  1267         ifTrue: [self valueOfResourceClass value: self imageEditView resourceClass]
       
  1268         ifFalse: [self valueOfResourceClass value: ''].
       
  1269     self valueOfResourceClass addDependent: self.
       
  1270 
       
  1271     self imageEditView resourceMessage asCollectionOfWords size = 2
       
  1272         ifTrue: [self addToHistory: self imageEditView resourceMessage -> #loadFromMessage:].
       
  1273 
       
  1274     self image fileName notNil
       
  1275         ifTrue: [self addToHistory: self image fileName -> #loadFromFile:].
       
  1276 
       
  1277 
       
  1278 
       
  1279 ! !
       
  1280 
       
  1281 !ImageEditor methodsFor:'selection'!
       
  1282 
       
  1283 magnification
       
  1284 
       
  1285     (builder componentAt: #imageEditView) isNil ifTrue: [^1].
       
  1286     ^self imageEditView magnification x
       
  1287 !
       
  1288 
       
  1289 magnification: aValue
       
  1290 
       
  1291     |magnification|
       
  1292     magnification := aValue asInteger asPoint.
       
  1293     (magnification = self imageEditView magnification) | (magnification = (0@0)) ifTrue: [^nil].
       
  1294     self imageEditView magnification: magnification
       
  1295 !
       
  1296 
       
  1297 selectedColorIndex
       
  1298 
       
  1299     ^selectedColorIndex
       
  1300 !
       
  1301 
       
  1302 selectedColorIndex: anIndex
       
  1303 
       
  1304     selectedColorIndex := anIndex.    
       
  1305     self imageEditView selectedColor: (self listOfColors at: anIndex ifAbsent: [^nil])
       
  1306 
       
  1307 ! !
       
  1308 
       
  1309 !ImageEditor methodsFor:'startup / release'!
       
  1310 
       
  1311 closeRequest
       
  1312 
       
  1313     self imageEditView checkModified ifTrue:[super closeRequest]
       
  1314 
       
  1315 !
       
  1316 
       
  1317 open
       
  1318 
       
  1319     super open.
       
  1320 
       
  1321     self imageEditView masterApplication: self.
       
  1322 
       
  1323     self resourceClassInputField entryCompletionBlock:
       
  1324     [:value|
       
  1325         |what|
       
  1326         what := Smalltalk classnameCompletion: value withoutSpaces.
       
  1327         self resourceClassInputField contents:what first.
       
  1328         (what at:2) size ~~ 1 ifTrue:[
       
  1329             Display beep
       
  1330         ]
       
  1331     ].
       
  1332     self resourceSelectorInputField entryCompletionBlock:
       
  1333     [:value|
       
  1334         |cls what|
       
  1335         (cls := Smalltalk at: self resourceClassInputField contents asSymbol) notNil
       
  1336         ifTrue:
       
  1337         [
       
  1338             |firstPossibleSelector resourceType|
       
  1339             what := cls class selectorCompletion: value withoutSpaces.
       
  1340             firstPossibleSelector := what first asSymbol.
       
  1341             (cls class selectors includes: firstPossibleSelector)
       
  1342             ifTrue:
       
  1343             [
       
  1344                 resourceType := (cls class compiledMethodAt: firstPossibleSelector) resourceType.
       
  1345                 ((resourceType = #image) or: [resourceType = #fileImage])
       
  1346                 ifTrue:
       
  1347                 [
       
  1348                     self resourceSelectorInputField contents:firstPossibleSelector.
       
  1349                 ].
       
  1350             ].
       
  1351             (what at:2) size ~~ 1 ifTrue:[
       
  1352                 Display beep
       
  1353             ]
       
  1354         ]
       
  1355     ].
       
  1356 !
       
  1357 
       
  1358 postOpenWith:aBuilder
       
  1359 
       
  1360     postOpenAction notNil ifTrue: [postOpenAction value].
       
  1361     super postOpenWith:aBuilder.
       
  1362 !
       
  1363 
       
  1364 reOpen
       
  1365 
       
  1366     self imageEditView checkModified ifTrue:[super reOpen]
       
  1367 
       
  1368 ! !
       
  1369 
       
  1370 !ImageEditor methodsFor:'user actions - editing'!
       
  1371 
       
  1372 browseClass
       
  1373 
       
  1374     SystemBrowser openInClass: (Smalltalk at: self imageEditView resourceClass ifAbsent: [^nil]) class selector: self imageEditView resourceSelector
       
  1375 !
       
  1376 
       
  1377 flipHorizontal
       
  1378 
       
  1379     self imageEditView flipHorizontal
       
  1380 !
       
  1381 
       
  1382 flipVertical
       
  1383 
       
  1384     self imageEditView flipVertical
       
  1385 !
       
  1386 
       
  1387 magnifyDown
       
  1388 
       
  1389     self valueOfMagnification value > 1
       
  1390     ifTrue:
       
  1391     [
       
  1392         self valueOfMagnification value: self valueOfMagnification value - 1
       
  1393     ]
       
  1394 !
       
  1395 
       
  1396 magnifyImage
       
  1397 
       
  1398     self imageEditView magnifyImage.   
       
  1399     self updateInfoLabel
       
  1400 !
       
  1401 
       
  1402 magnifyUp
       
  1403 
       
  1404     self valueOfMagnification value < 99
       
  1405     ifTrue:
       
  1406     [
       
  1407         self valueOfMagnification value: self valueOfMagnification value + 1
       
  1408     ]
       
  1409 !
       
  1410 
       
  1411 negativeImage
       
  1412 
       
  1413     self imageEditView negativeImage.
       
  1414     self listOfColors removeAll.
       
  1415     self findColorMapMode.     
       
  1416 !
       
  1417 
       
  1418 resizeImage
       
  1419 
       
  1420     self imageEditView resizeImage.   
       
  1421     self updateInfoLabel
       
  1422 !
       
  1423 
       
  1424 rotateImage
       
  1425 
       
  1426     self imageEditView rotateImage.
       
  1427     self updateInfoLabel
       
  1428 !
       
  1429 
       
  1430 undo
       
  1431 
       
  1432     self imageEditView undo
       
  1433 ! !
       
  1434 
       
  1435 !ImageEditor methodsFor:'user actions - loading'!
       
  1436 
       
  1437 loadFromClass
       
  1438 
       
  1439     self loadFromInClassesOf: #Object.
       
  1440    
       
  1441 !
       
  1442 
       
  1443 loadFromClassWithSuperclass
       
  1444 
       
  1445     |box|
       
  1446     box := EnterBox new.
       
  1447     box title:'Name of superclass:'.
       
  1448     box okText:'OK'.
       
  1449     box abortText:'Cancel'.
       
  1450     box initialText: 'ApplicationModel'.
       
  1451     box showAtPointer.
       
  1452     box accepted
       
  1453     ifTrue:
       
  1454     [            
       
  1455         self loadFromInClassesOf: box contents asSymbol
       
  1456     ].
       
  1457 
       
  1458 !
       
  1459 
       
  1460 loadFromFile
       
  1461 
       
  1462     self loadFromFile:
       
  1463         (FileSelectionBrowser
       
  1464             request: 'Load Image From' 
       
  1465             fileFilters: FileSelectionBrowser loadImageFileNameFilters)
       
  1466 !
       
  1467 
       
  1468 loadFromFile: aFileName
       
  1469 
       
  1470     (aFileName notNil and: [(self imageEditView loadFromFile: aFileName) notNil])
       
  1471     ifTrue:
       
  1472     [          
       
  1473         self image colorMap notNil
       
  1474         ifTrue:
       
  1475         [
       
  1476             self listOfColors contents: self image usedColors asSet.
       
  1477         ]
       
  1478         ifFalse:
       
  1479         [
       
  1480             self listOfColors removeAll.
       
  1481         ].
       
  1482         self findColorMapMode.     
       
  1483         self updateInputFieldsAndLabelsAndHistory.
       
  1484     ]
       
  1485 
       
  1486 !
       
  1487 
       
  1488 loadFromImage: image
       
  1489 
       
  1490     (self imageEditView image: image) notNil
       
  1491     ifTrue:
       
  1492     [    
       
  1493         self image colorMap notNil
       
  1494         ifTrue:
       
  1495         [
       
  1496             self listOfColors contents: self image usedColors asSet asOrderedCollection.
       
  1497         ]
       
  1498         ifFalse:
       
  1499         [
       
  1500             self listOfColors removeAll.
       
  1501         ].
       
  1502         self findColorMapMode.
       
  1503         self updateInputFieldsAndLabelsAndHistory.
       
  1504     ]
       
  1505 !
       
  1506 
       
  1507 loadFromInClassesOf: aSuperclassOrSymbol
       
  1508 
       
  1509     self imageEditView loadFromInClassesOf: aSuperclassOrSymbol.
       
  1510     self image notNil
       
  1511     ifTrue:
       
  1512     [
       
  1513         self listOfColors contents: self image usedColors asSet asOrderedCollection.
       
  1514         self findColorMapMode.
       
  1515         self updateInputFieldsAndLabelsAndHistory.
       
  1516     ]
       
  1517 !
       
  1518 
       
  1519 loadFromMessage: aMessage
       
  1520 
       
  1521     (self imageEditView loadFromMessage: aMessage) notNil
       
  1522     ifTrue:
       
  1523     [
       
  1524         self listOfColors contents: self image usedColors asSet asOrderedCollection.
       
  1525         self findColorMapMode.
       
  1526         self updateInputFieldsAndLabelsAndHistory.
       
  1527     ]
       
  1528 !
       
  1529 
       
  1530 newImage
       
  1531 
       
  1532     |aspects|
       
  1533     aspects  := IdentityDictionary new
       
  1534         at:#listOfSizes put: self class listOfDefaultSizes asValue;
       
  1535         at:#listOfColorMaps put: self class listOfColorMaps keys asSortedCollection asValue;
       
  1536         at:#selectionOfSize put: self class listOfDefaultSizes first copy asValue;
       
  1537         at:#selectionOfColorMap put: self class listOfColorMaps keys asSortedCollection first asValue;
       
  1538         yourself.
       
  1539 
       
  1540     (self openDialogInterface:#windowSpecForNewImage withBindings:aspects)
       
  1541     ifTrue:
       
  1542     [
       
  1543         |width height cMap imageClass image|
       
  1544         width := 128 min: (Integer readFromString: ((aspects at:#selectionOfSize) value upTo: $x) onError:[24]).
       
  1545         height := 128 min: (Integer readFromString: ((aspects at:#selectionOfSize) value copy reverse upTo: $x) reverse onError:[24]).
       
  1546 
       
  1547         cMap := (self class listOfColorMaps at: (colorMapMode := (aspects at:#selectionOfColorMap) value)).
       
  1548         imageClass := Image implementorForDepth: ((cMap size log: 2) asInteger).
       
  1549         image := imageClass width: width height: height fromArray: (ByteArray new: width*height).
       
  1550 
       
  1551         (colorMapMode copy reverse readStream nextWord reverse = 'mask')
       
  1552         ifTrue:
       
  1553         [
       
  1554             image mask: (Depth1Image width: width height: height depth: 1 fromArray: (ByteArray new: width*height)) clearMaskedPixels.
       
  1555         ].
       
  1556         image colorMap: cMap.
       
  1557         image fillRectangleX:0 y:0 width:width height:height with:Color white.
       
  1558         (self imageEditView image: image) notNil
       
  1559         ifTrue:
       
  1560         [
       
  1561             self listOfColors contents: cMap.
       
  1562             self findColorMapMode.
       
  1563             self updateInputFieldsAndLabelsAndHistory
       
  1564         ]
       
  1565     ].
       
  1566 ! !
       
  1567 
       
  1568 !ImageEditor methodsFor:'user actions - saving'!
       
  1569 
       
  1570 print
       
  1571 
       
  1572     self imageEditView print
       
  1573 !
       
  1574 
       
  1575 saveImageFile
       
  1576 
       
  1577     self imageEditView saveImageFileAs: self fileNameInputField contents
       
  1578 !
       
  1579 
       
  1580 saveImageFileAs
       
  1581 
       
  1582     self imageEditView saveImageFileAs.
       
  1583     self updateInputFieldsAndLabelsAndHistory
       
  1584 !
       
  1585 
       
  1586 saveImageMaskFileAs
       
  1587 
       
  1588     self imageEditView saveImageMaskFileAs
       
  1589 !
       
  1590 
       
  1591 saveMethod
       
  1592 
       
  1593     (self imageEditView 
       
  1594         resourceSelector: self resourceSelectorInputField contents;
       
  1595         resourceClass: self resourceClassInputField contents;
       
  1596         saveMethod) notNil
       
  1597     ifTrue:
       
  1598     [
       
  1599         self updateInputFieldsAndLabelsAndHistory
       
  1600     ]
       
  1601 !
       
  1602 
       
  1603 saveMethodAs
       
  1604 
       
  1605     self imageEditView saveMethodAs notNil
       
  1606     ifTrue:
       
  1607     [
       
  1608         self updateInputFieldsAndLabelsAndHistory
       
  1609     ]
       
  1610 ! !
       
  1611 
       
  1612 !ImageEditor class methodsFor:'documentation'!
       
  1613 
       
  1614 version
       
  1615     ^ '$Header$'
       
  1616 ! !