Image.st
branchjv
changeset 7765 b8189ae681df
parent 7716 3dba89415c91
parent 7755 75f5eba88e77
child 7855 46203abe7d57
equal deleted inserted replaced
7743:fa3c8eb0bc1d 7765:b8189ae681df
  4185     map := Array new:256.
  4185     map := Array new:256.
  4186     fixColors do:[:clr |
  4186     fixColors do:[:clr |
  4187         map at:clr colorId + 1 put:clr
  4187         map at:clr colorId + 1 put:clr
  4188     ].
  4188     ].
  4189     f colorMap:map.
  4189     f colorMap:map.
  4190     f initGC.
       
  4191     f bits:pseudoBits.
  4190     f bits:pseudoBits.
  4192     aDevice
  4191     aDevice
  4193         drawBits:pseudoBits
  4192         drawBits:pseudoBits
  4194         bitsPerPixel:8
  4193         bitsPerPixel:8
  4195         depth:deviceDepth
  4194         depth:deviceDepth
  4196         padding:8
  4195         padding:8
  4197         width:width height:height
  4196         width:width height:height
  4198         x:0 y:0
  4197         x:0 y:0
  4199         into:(f id) x:0 y:0
  4198         into:(f id) x:0 y:0
  4200         width:width height:height
  4199         width:width height:height
  4201         with:(f gcId).
  4200         with:(f initGC).
  4202     ^ f
  4201     ^ f
  4203 
  4202 
  4204     "
  4203     "
  4205      example:
  4204      example:
  4206         color reduction from Depth8 to Depth4 (dithering) can be done by:
  4205         color reduction from Depth8 to Depth4 (dithering) can be done by:
  4268     map := Array new:256.
  4267     map := Array new:256.
  4269     fixColors do:[:clr |
  4268     fixColors do:[:clr |
  4270         map at:clr colorId + 1 put:clr
  4269         map at:clr colorId + 1 put:clr
  4271     ].
  4270     ].
  4272     f colorMap:map.
  4271     f colorMap:map.
  4273     f initGC.
       
  4274     f bits:pseudoBits.
  4272     f bits:pseudoBits.
  4275     aDevice
  4273     aDevice
  4276         drawBits:pseudoBits
  4274         drawBits:pseudoBits
  4277         bitsPerPixel:8
  4275         bitsPerPixel:8
  4278         depth:deviceDepth
  4276         depth:deviceDepth
  4279         padding:8
  4277         padding:8
  4280         width:width height:height
  4278         width:width height:height
  4281         x:0 y:0
  4279         x:0 y:0
  4282         into:(f id) x:0 y:0
  4280         into:(f id) x:0 y:0
  4283         width:width height:height
  4281         width:width height:height
  4284         with:(f gcId).
  4282         with:(f initGC).
  4285     ^ f
  4283     ^ f
  4286 
  4284 
  4287     "
  4285     "
  4288      example:
  4286      example:
  4289         color reduction from Depth8 to Depth4 (dithering) can be done by:
  4287         color reduction from Depth8 to Depth4 (dithering) can be done by:
  4581         clr notNil ifTrue:[
  4579         clr notNil ifTrue:[
  4582             map at:clr colorId + 1 put:clr
  4580             map at:clr colorId + 1 put:clr
  4583         ]
  4581         ]
  4584     ].
  4582     ].
  4585     f colorMap:map.
  4583     f colorMap:map.
  4586     f initGC.
       
  4587     f bits:pseudoBits.
  4584     f bits:pseudoBits.
  4588     aDevice
  4585     aDevice
  4589         drawBits:pseudoBits
  4586         drawBits:pseudoBits
  4590         bitsPerPixel:d
  4587         bitsPerPixel:d
  4591         depth:deviceDepth
  4588         depth:deviceDepth
  4592         padding:8
  4589         padding:8
  4593         width:width height:height
  4590         width:width height:height
  4594         x:0 y:0
  4591         x:0 y:0
  4595         into:(f id) x:0 y:0
  4592         into:(f id) x:0 y:0
  4596         width:width height:height
  4593         width:width height:height
  4597         with:(f gcId).
  4594         with:(f initGC).
  4598     ^ f
  4595     ^ f
  4599 
  4596 
  4600     "
  4597     "
  4601      |i|
  4598      |i|
  4602 
  4599 
  4962     map := Array new:256.
  4959     map := Array new:256.
  4963     fixColors do:[:clr |
  4960     fixColors do:[:clr |
  4964         map at:clr colorId + 1 put:clr
  4961         map at:clr colorId + 1 put:clr
  4965     ].
  4962     ].
  4966     f colorMap:map.
  4963     f colorMap:map.
  4967     f initGC.
       
  4968     f bits:pseudoBits.
  4964     f bits:pseudoBits.
  4969     aDevice
  4965     aDevice
  4970         drawBits:pseudoBits
  4966         drawBits:pseudoBits
  4971         bitsPerPixel:8
  4967         bitsPerPixel:8
  4972         depth:deviceDepth
  4968         depth:deviceDepth
  4973         padding:8
  4969         padding:8
  4974         width:width height:height
  4970         width:width height:height
  4975         x:0 y:0
  4971         x:0 y:0
  4976         into:(f id) x:0 y:0
  4972         into:(f id) x:0 y:0
  4977         width:width height:height
  4973         width:width height:height
  4978         with:(f gcId).
  4974         with:(f initGC).
  4979     ^ f
  4975     ^ f
  4980 
  4976 
  4981     "
  4977     "
  4982      example:
  4978      example:
  4983         color reduction from Depth8 to Depth4 (dithering) can be done by:
  4979         color reduction from Depth8 to Depth4 (dithering) can be done by:
  5466 
  5462 
  5467     f := Form width:w height:h depth:dDev onDevice:aDevice.
  5463     f := Form width:w height:h depth:dDev onDevice:aDevice.
  5468     f isNil ifTrue:[^ nil].
  5464     f isNil ifTrue:[^ nil].
  5469 
  5465 
  5470     f colorMap:cMap.
  5466     f colorMap:cMap.
  5471     f initGC.
       
  5472 
  5467 
  5473     aDevice
  5468     aDevice
  5474         drawBits:temp
  5469         drawBits:temp
  5475         depth:dDev
  5470         depth:dDev
  5476         padding:8
  5471         padding:8
  5478         height:h
  5473         height:h
  5479         x:0 y:0
  5474         x:0 y:0
  5480         into:(f id) x:0 y:0
  5475         into:(f id) x:0 y:0
  5481         width:w
  5476         width:w
  5482         height:h
  5477         height:h
  5483         with:(f gcId).
  5478         with:(f initGC).
  5484 
  5479 
  5485     ^ f
  5480     ^ f
  5486 
  5481 
  5487     "
  5482     "
  5488      (
  5483      (
  6319         mapping:map.
  6314         mapping:map.
  6320 
  6315 
  6321     f := Form width:width height:height depth:8 onDevice:aDevice.
  6316     f := Form width:width height:height depth:8 onDevice:aDevice.
  6322     f isNil ifTrue:[^ nil].
  6317     f isNil ifTrue:[^ nil].
  6323     f colorMap:colorMap.
  6318     f colorMap:colorMap.
  6324     f initGC.
       
  6325     aDevice
  6319     aDevice
  6326         drawBits:wideBits
  6320         drawBits:wideBits
  6327         depth:8
  6321         depth:8
  6328         padding:8
  6322         padding:8
  6329         width:width height:height
  6323         width:width height:height
  6330         x:0 y:0
  6324         x:0 y:0
  6331         into:(f id)
  6325         into:(f id)
  6332         x:0 y:0
  6326         x:0 y:0
  6333         width:width height:height
  6327         width:width height:height
  6334         with:(f gcId).
  6328         with:(f initGC).
  6335     ^ f
  6329     ^ f
  6336 
  6330 
  6337     "Modified: 19.10.1997 / 05:19:44 / cg"
  6331     "Modified: 19.10.1997 / 05:19:44 / cg"
  6338 !
  6332 !
  6339 
  6333 
 13270 makeDeviceGrayPixmapOn:aDevice depth:depth fromArray:bits
 13264 makeDeviceGrayPixmapOn:aDevice depth:depth fromArray:bits
 13271     "given the bits of a grey/color bitmap, 8-bit padded and
 13265     "given the bits of a grey/color bitmap, 8-bit padded and
 13272      pixels interpreted as greyValues, 0 is black,
 13266      pixels interpreted as greyValues, 0 is black,
 13273      create a device form for it"
 13267      create a device form for it"
 13274 
 13268 
 13275     |f|
 13269     |f gcId|
 13276 
 13270 
 13277     f := Form width:width height:height depth:depth onDevice:aDevice.
 13271     f := Form width:width height:height depth:depth onDevice:aDevice.
 13278     f isNil ifTrue:[^ nil].
 13272     f isNil ifTrue:[^ nil].
 13279 
 13273 
 13280     f bits:bits.
 13274     f bits:bits.
 13281     f initGC.
 13275     gcId := f initGC.
 13282 
 13276 
 13283     (aDevice blackpixel ~~ 0) ifTrue:[
 13277     (aDevice blackpixel ~~ 0) ifTrue:[
 13284         "/ have to invert bits
 13278         "/ have to invert bits
 13285         f function:#copyInverted
 13279         f function:#copyInverted
 13286     ].
 13280     ].
 13291         width:width height:height
 13285         width:width height:height
 13292         x:0 y:0
 13286         x:0 y:0
 13293         into:(f id)
 13287         into:(f id)
 13294         x:0 y:0
 13288         x:0 y:0
 13295         width:width height:height
 13289         width:width height:height
 13296         with:(f gcId).
 13290         with:gcId.
 13297     ^ f
 13291     ^ f
 13298 
 13292 
 13299     "Created: 10.6.1996 / 20:10:31 / cg"
 13293     "Created: 10.6.1996 / 20:10:31 / cg"
 13300 !
 13294 !
 13301 
 13295 
 13318 
 13312 
 13319     |f|
 13313     |f|
 13320 
 13314 
 13321     f := Form width:width height:height depth:depth onDevice:aDevice.
 13315     f := Form width:width height:height depth:depth onDevice:aDevice.
 13322     f isNil ifTrue:[^ nil].
 13316     f isNil ifTrue:[^ nil].
 13323 
       
 13324     f bits:bits.
 13317     f bits:bits.
 13325     f initGC.
       
 13326 
 13318 
 13327     aDevice
 13319     aDevice
 13328         drawBits:bits
 13320         drawBits:bits
 13329         depth:depth
 13321         depth:depth
 13330         padding:8
 13322         padding:8
 13331         width:width height:height
 13323         width:width height:height
 13332         x:0 y:0
 13324         x:0 y:0
 13333         into:(f id)
 13325         into:(f id)
 13334         x:0 y:0
 13326         x:0 y:0
 13335         width:width height:height
 13327         width:width height:height
 13336         with:(f gcId).
 13328         with:(f initGC).
 13337     ^ f
 13329     ^ f
 13338 
 13330 
 13339     "Created: 10.6.1996 / 17:56:08 / cg"
 13331     "Created: 10.6.1996 / 17:56:08 / cg"
 13340     "Modified: 10.6.1996 / 20:11:27 / cg"
 13332     "Modified: 10.6.1996 / 20:11:27 / cg"
 13341 !
 13333 !