Image.st
changeset 2182 9ca11fd1d0fb
parent 2113 c64f89f9ffba
child 2185 756d58c52113
equal deleted inserted replaced
2181:7b07c4a6cad4 2182:9ca11fd1d0fb
    17 		maskedPixelsAre0 fileName imageSequence'
    17 		maskedPixelsAre0 fileName imageSequence'
    18 	classVariableNames:'Lobby DitherAlgorithm NumberOfDitherColors
    18 	classVariableNames:'Lobby DitherAlgorithm NumberOfDitherColors
    19 		CollectGarbageWhenRunningOutOfColors ImageNotFoundQuerySignal
    19 		CollectGarbageWhenRunningOutOfColors ImageNotFoundQuerySignal
    20 		BadImageFormatQuerySignal ImageSaveErrorSignal
    20 		BadImageFormatQuerySignal ImageSaveErrorSignal
    21 		FileCreationErrorSignal CannotRepresentImageSignal
    21 		FileCreationErrorSignal CannotRepresentImageSignal
    22 		InformationLostQuerySignal'
    22 		InformationLostQuerySignal UnrepresentableColorSignal'
    23 	poolDictionaries:''
    23 	poolDictionaries:''
    24 	category:'Graphics-Images'
    24 	category:'Graphics-Images'
    25 !
    25 !
    26 
    26 
    27 !Image class methodsFor:'documentation'!
    27 !Image class methodsFor:'documentation'!
   628         InformationLostQuerySignal := QuerySignal new.
   628         InformationLostQuerySignal := QuerySignal new.
   629         InformationLostQuerySignal nameClass:self message:#informationLostQuerySignal.
   629         InformationLostQuerySignal nameClass:self message:#informationLostQuerySignal.
   630 
   630 
   631         BadImageFormatQuerySignal := QuerySignal new.
   631         BadImageFormatQuerySignal := QuerySignal new.
   632         BadImageFormatQuerySignal nameClass:self message:#badImageFormatQuerySignal.
   632         BadImageFormatQuerySignal nameClass:self message:#badImageFormatQuerySignal.
       
   633 
       
   634         UnrepresentableColorSignal := ErrorSignal newSignalMayProceed:true.
       
   635         UnrepresentableColorSignal nameClass:self message:#unrepresentableColorSignal.
   633     ]
   636     ]
   634 
   637 
   635     "Modified: 27.6.1997 / 16:44:43 / cg"
   638     "Modified: 27.6.1997 / 16:44:43 / cg"
   636 !
   639 !
   637 
   640 
  1095      to proceed or abort the saving."
  1098      to proceed or abort the saving."
  1096 
  1099 
  1097     ^ InformationLostQuerySignal
  1100     ^ InformationLostQuerySignal
  1098 
  1101 
  1099     "Created: 27.2.1997 / 12:43:50 / cg"
  1102     "Created: 27.2.1997 / 12:43:50 / cg"
       
  1103 !
       
  1104 
       
  1105 unrepresentableColorSignal
       
  1106     "return the signal, which is raised if some color is not
       
  1107      representable in the image (when storing a pixel)."
       
  1108 
       
  1109     ^ UnrepresentableColorSignal
       
  1110 
       
  1111     "Created: 1.2.1997 / 14:40:29 / cg"
  1100 ! !
  1112 ! !
  1101 
  1113 
  1102 !Image class methodsFor:'cleanup'!
  1114 !Image class methodsFor:'cleanup'!
  1103 
  1115 
  1104 releaseResourcesOnDevice:aDevice
  1116 releaseResourcesOnDevice:aDevice
  2328      (it is meant to access individual pixels - for example, in a bitmap editor)"
  2340      (it is meant to access individual pixels - for example, in a bitmap editor)"
  2329 
  2341 
  2330     |pixel|
  2342     |pixel|
  2331 
  2343 
  2332     pixel := self valueFromColor:aColor.
  2344     pixel := self valueFromColor:aColor.
       
  2345     pixel isNil ifTrue:[
       
  2346         ^ UnrepresentableColorSignal raiseErrorString:'cannot store color - not in colormap'.
       
  2347     ].
  2333     self pixelAtX:x y:y put:pixel.
  2348     self pixelAtX:x y:y put:pixel.
  2334 
  2349 
  2335     "Modified: 24.4.1997 / 17:36:20 / cg"
  2350     "Modified: 24.4.1997 / 17:36:20 / cg"
  2336 !
  2351 !
  2337 
  2352 
  2349 
  2364 
  2350     self obsoleteMethodWarning.
  2365     self obsoleteMethodWarning.
  2351     bytes := aByteArray
  2366     bytes := aByteArray
  2352 
  2367 
  2353     "Modified: 24.4.1997 / 17:38:18 / cg"
  2368     "Modified: 24.4.1997 / 17:38:18 / cg"
       
  2369 !
       
  2370 
       
  2371 maskAt:aPoint
       
  2372     "retrieve the maskValue at aPoint - an integer number which is
       
  2373      0 for masked pixels (invisible), 1 for unmasked (visible).
       
  2374      For images without mask, 1 is returned for all pixels."
       
  2375 
       
  2376     ^ self maskAtX:aPoint x y:aPoint y
       
  2377 !
       
  2378 
       
  2379 maskAtX:x y:y
       
  2380     "retrieve the maskValue at aPoint - an integer number which is
       
  2381      0 for masked pixels (invisible), 1 for unmasked (visible).
       
  2382      For images without mask, 1 is returned for all pixels."
       
  2383 
       
  2384     mask isNil ifTrue:[^ 1].
       
  2385     ^ mask pixelAtX:x y:y
  2354 !
  2386 !
  2355 
  2387 
  2356 pixelAtX:x y:y
  2388 pixelAtX:x y:y
  2357     "retrieve the pixelValue at aPoint; return an integer number.
  2389     "retrieve the pixelValue at aPoint; return an integer number.
  2358      Pixels start at 0/0 for upper left pixel, and end at
  2390      Pixels start at 0/0 for upper left pixel, and end at
 11320 ! !
 11352 ! !
 11321 
 11353 
 11322 !Image class methodsFor:'documentation'!
 11354 !Image class methodsFor:'documentation'!
 11323 
 11355 
 11324 version
 11356 version
 11325     ^ '$Header: /cvs/stx/stx/libview/Image.st,v 1.246 1998-05-07 17:41:36 cg Exp $'
 11357     ^ '$Header: /cvs/stx/stx/libview/Image.st,v 1.247 1998-07-25 16:40:45 cg Exp $'
 11326 ! !
 11358 ! !
 11327 Image initialize!
 11359 Image initialize!