11 " |
11 " |
12 |
12 |
13 Object subclass:#ImageReader |
13 Object subclass:#ImageReader |
14 instanceVariableNames:'width height data byteOrder inStream outStream photometric |
14 instanceVariableNames:'width height data byteOrder inStream outStream photometric |
15 samplesPerPixel bitsPerSample colorMap mask maskPixel |
15 samplesPerPixel bitsPerSample colorMap mask maskPixel |
16 dimensionCallBack' |
16 dimensionCallBack imageSequence' |
17 classVariableNames:'ReverseBits' |
17 classVariableNames:'ReverseBits' |
18 poolDictionaries:'' |
18 poolDictionaries:'' |
19 category:'Graphics-Images-Support' |
19 category:'Graphics-Images-Support' |
20 ! |
20 ! |
21 |
21 |
1555 |
1556 |
1556 "Modified: 22.4.1996 / 19:15:39 / cg" |
1557 "Modified: 22.4.1996 / 19:15:39 / cg" |
1557 ! |
1558 ! |
1558 |
1559 |
1559 image |
1560 image |
1560 "return the image as represented by myself" |
1561 "return the image as represented by myself; |
|
1562 If my file contained multiple images, return the first one." |
1561 |
1563 |
1562 |image depth| |
1564 |image depth| |
|
1565 |
|
1566 self hasMultipleImages ifTrue:[ |
|
1567 ^ self images first |
|
1568 ]. |
1563 |
1569 |
1564 depth := self bitsPerPixel. |
1570 depth := self bitsPerPixel. |
1565 image := (Image implementorForDepth:depth) new. |
1571 image := (Image implementorForDepth:depth) new. |
1566 image depth:depth. |
1572 image depth:depth. |
1567 image |
1573 image |
1573 colorMap:colorMap |
1579 colorMap:colorMap |
1574 bits:data |
1580 bits:data |
1575 mask:mask. |
1581 mask:mask. |
1576 ^ image |
1582 ^ image |
1577 |
1583 |
1578 "Modified: 24.4.1997 / 14:28:04 / cg" |
1584 "Modified: 21.6.1997 / 18:32:27 / cg" |
1579 ! |
1585 ! |
1580 |
1586 |
1581 images |
1587 images |
1582 "return a collection of all images as represented by myself. |
1588 "return a collection of all images as represented by myself. |
1583 For compatibility with single-image formats, return a collection |
1589 For compatibility with single-image formats, return a collection |
1584 containing my single image here." |
1590 containing my single image here. |
|
1591 This must be redefined in readers for formats which support multiple |
|
1592 images in a single file." |
1585 |
1593 |
1586 |img| |
1594 |img| |
1587 |
1595 |
1588 img := self image. |
1596 img := self image. |
1589 img isNil ifTrue:[ |
1597 img isNil ifTrue:[ |
1590 ^ img |
1598 ^ img |
1591 ]. |
1599 ]. |
1592 ^ Array with:img |
1600 ^ Array with:img |
1593 |
1601 |
1594 "Modified: 4.4.1997 / 22:02:22 / cg" |
1602 "Modified: 21.6.1997 / 18:35:52 / cg" |
1595 ! |
1603 ! |
1596 |
1604 |
1597 mask |
1605 mask |
1598 "return the image mask (or nil)" |
1606 "return the image mask (or nil)" |
1599 |
1607 |
1600 ^ mask |
1608 ^ mask |
1601 |
1609 |
1602 "Modified: 22.4.1996 / 19:15:31 / cg" |
1610 "Modified: 22.4.1996 / 19:15:31 / cg" |
1603 "Created: 20.6.1996 / 17:08:29 / cg" |
1611 "Created: 20.6.1996 / 17:08:29 / cg" |
|
1612 ! |
|
1613 |
|
1614 numberOfImages |
|
1615 "return the number of images as read. |
|
1616 By default (here), I hold a single image; |
|
1617 however, some fileFormats allow for multiple images" |
|
1618 |
|
1619 ^ 1 |
|
1620 |
|
1621 "Created: 21.6.1997 / 18:33:45 / cg" |
|
1622 "Modified: 21.6.1997 / 18:35:19 / cg" |
1604 ! |
1623 ! |
1605 |
1624 |
1606 photometric |
1625 photometric |
1607 "return the photometric interpretation of the image data" |
1626 "return the photometric interpretation of the image data" |
1608 |
1627 |