1272 !ImageEditor methodsFor:'data access'! |
1272 !ImageEditor methodsFor:'data access'! |
1273 |
1273 |
1274 blueFromColor:aColor |
1274 blueFromColor:aColor |
1275 "helper used to access a color as a row in the dataSet view" |
1275 "helper used to access a color as a row in the dataSet view" |
1276 |
1276 |
|
1277 aColor isNil ifTrue:[^ 'none']. |
1277 ^ aColor blueByte ? 'mask' |
1278 ^ aColor blueByte ? 'mask' |
1278 |
1279 |
1279 "Created: / 26.7.1998 / 12:30:35 / cg" |
1280 "Created: / 26.7.1998 / 12:30:35 / cg" |
|
1281 "Modified: / 31.7.1998 / 01:11:18 / cg" |
1280 ! |
1282 ! |
1281 |
1283 |
1282 greenFromColor:aColor |
1284 greenFromColor:aColor |
1283 "helper used to access a color as a row in the dataSet view" |
1285 "helper used to access a color as a row in the dataSet view" |
1284 |
1286 |
|
1287 aColor isNil ifTrue:[^ 'none']. |
1285 ^ aColor greenByte ? 'mask' |
1288 ^ aColor greenByte ? 'mask' |
1286 |
1289 |
1287 "Created: / 26.7.1998 / 12:30:29 / cg" |
1290 "Created: / 26.7.1998 / 12:30:29 / cg" |
|
1291 "Modified: / 31.7.1998 / 01:11:31 / cg" |
1288 ! |
1292 ! |
1289 |
1293 |
1290 redFromColor:aColor |
1294 redFromColor:aColor |
1291 "helper used to access a color as a row in the dataSet view" |
1295 "helper used to access a color as a row in the dataSet view" |
1292 |
1296 |
|
1297 aColor isNil ifTrue:[^ 'none']. |
1293 ^ aColor redByte ? 'mask' |
1298 ^ aColor redByte ? 'mask' |
1294 |
1299 |
1295 "Modified: / 26.7.1998 / 12:30:22 / cg" |
1300 "Modified: / 31.7.1998 / 01:11:35 / cg" |
1296 ! ! |
1301 ! ! |
1297 |
1302 |
1298 !ImageEditor methodsFor:'help'! |
1303 !ImageEditor methodsFor:'help'! |
1299 |
1304 |
1300 defaultInfoLabel |
1305 defaultInfoLabel |
1696 |
1701 |
1697 oldImage := self image. |
1702 oldImage := self image. |
1698 depth := oldImage depth. |
1703 depth := oldImage depth. |
1699 |
1704 |
1700 oldImage photometric ~~ #palette ifTrue:[ |
1705 oldImage photometric ~~ #palette ifTrue:[ |
1701 self information:'Only palette images have colormaps.'. |
1706 self information:'Compress colorMap: Only palette images have colormaps.'. |
1702 ^ self |
1707 ^ self |
1703 ]. |
1708 ]. |
1704 |
1709 |
1705 usedColors := oldImage usedColors. |
1710 usedColors := oldImage usedColors. |
1706 usedColors size == (1 bitShift:depth) ifTrue:[ |
1711 usedColors size == (1 bitShift:depth) ifTrue:[ |
1707 self information:'All colors are used - no compression.'. |
1712 self information:'Compress colorMap: All colors are used - no compression.'. |
1708 ^ self |
1713 ^ self |
1709 ]. |
1714 ]. |
1710 usedColors size == oldImage colorMap size ifTrue:[ |
1715 usedColors size == oldImage colorMap size ifTrue:[ |
1711 self information:'Colormap already compressed - no compression.'. |
1716 self information:'Compress colorMap: Colormap already compressed - no compression.'. |
1712 ^ self |
1717 ^ self |
1713 ]. |
1718 ]. |
1714 |
1719 |
1715 imageEditView makeUndo. |
1720 imageEditView makeUndo. |
1716 |
1721 |
1717 self information:('%1 colors used.' bindWith:usedColors size). |
1722 self information:('Compress colorMap: %1 colors used.' bindWith:usedColors size). |
1718 |
1723 |
1719 self withExecuteCursorDo:[ |
1724 self withExecuteCursorDo:[ |
1720 newColorMap := Array new:usedColors size. |
1725 newColorMap := Array new:usedColors size. |
1721 |
1726 |
1722 "/ translation table |
1727 "/ translation table |
1946 |image img| |
1951 |image img| |
1947 |
1952 |
1948 image := Image fromUser. |
1953 image := Image fromUser. |
1949 |
1954 |
1950 image depth > 8 ifTrue:[ |
1955 image depth > 8 ifTrue:[ |
1951 image := Depth8Image fromImage:image. |
1956 Object errorSignal handle:[:ex | |
|
1957 self warn:'Could not convert to depth8 image (too many colors)'. |
|
1958 ^ self |
|
1959 ] do:[ |
|
1960 image := Depth8Image fromImage:image. |
|
1961 ] |
1952 ]. |
1962 ]. |
1953 (imageEditView image: image) notNil |
1963 (imageEditView image: image) notNil |
1954 ifTrue: |
1964 ifTrue: |
1955 [ |
1965 [ |
1956 self listOfColors contents:(image colorMap). |
1966 self listOfColors contents:(image colorMap). |
1957 self findColorMapMode. |
1967 self findColorMapMode. |
1958 self updateLabelsAndHistory |
1968 self updateLabelsAndHistory. |
1959 ] |
1969 ] |
1960 |
1970 |
1961 "Created: / 29.7.1998 / 21:24:42 / cg" |
1971 "Created: / 29.7.1998 / 21:24:42 / cg" |
|
1972 "Modified: / 31.7.1998 / 01:14:33 / cg" |
1962 ! ! |
1973 ! ! |
1963 |
1974 |
1964 !ImageEditor methodsFor:'user actions - saving'! |
1975 !ImageEditor methodsFor:'user actions - saving'! |
1965 |
1976 |
1966 doPrint |
1977 doPrint |