.
--- a/Make.proto Mon Oct 23 18:00:19 1995 +0100
+++ b/Make.proto Wed Oct 25 11:16:32 1995 +0100
@@ -1,4 +1,4 @@
-# $Header: /cvs/stx/stx/libview2/Make.proto,v 1.2 1995-09-23 11:31:09 claus Exp $
+# $Header: /cvs/stx/stx/libview2/Make.proto,v 1.3 1995-10-25 10:16:32 cg Exp $
#
# -------------- no need to change anything below ----------
@@ -8,6 +8,7 @@
LIBNAME=libview2
STCOPT=$(LIBVIEW_STCOPT)
STCLOCALOPT='-Pview-support-classes-(libview2)' $(COMMONSYMBOLS)
+O_RULE=$(SPEEDOPT_O_RULE)
RCSSOURCES=*.st Make.proto
--- a/TIFFRdr.st Mon Oct 23 18:00:19 1995 +0100
+++ b/TIFFRdr.st Wed Oct 25 11:16:32 1995 +0100
@@ -41,7 +41,7 @@
version
"
-$Header: /cvs/stx/stx/libview2/Attic/TIFFRdr.st,v 1.23 1995-09-17 18:00:56 claus Exp $
+$Header: /cvs/stx/stx/libview2/Attic/TIFFRdr.st,v 1.24 1995-10-25 10:16:18 cg Exp $
"
!
@@ -1403,7 +1403,9 @@
].
'TIFFReader: ignoring alpha plane' errorPrintNL.
nPlanes := 1.
- bitsPerPixel := bitsPerSample at:1
+ bitsPerPixel := bitsPerSample at:1.
+ bitsPerSample := Array with:bitsPerPixel.
+ samplesPerPixel := 1.
] ifFalse:[
(nPlanes == 3) ifTrue:[
(planarConfiguration ~~ 1) ifTrue:[
@@ -1420,7 +1422,7 @@
self error:'format not supported'.
^ nil
].
- bitsPerPixel := bitsPerSample at:1
+ bitsPerPixel := bitsPerSample at:1.
]
].
--- a/TIFFReader.st Mon Oct 23 18:00:19 1995 +0100
+++ b/TIFFReader.st Wed Oct 25 11:16:32 1995 +0100
@@ -41,7 +41,7 @@
version
"
-$Header: /cvs/stx/stx/libview2/TIFFReader.st,v 1.23 1995-09-17 18:00:56 claus Exp $
+$Header: /cvs/stx/stx/libview2/TIFFReader.st,v 1.24 1995-10-25 10:16:18 cg Exp $
"
!
@@ -1403,7 +1403,9 @@
].
'TIFFReader: ignoring alpha plane' errorPrintNL.
nPlanes := 1.
- bitsPerPixel := bitsPerSample at:1
+ bitsPerPixel := bitsPerSample at:1.
+ bitsPerSample := Array with:bitsPerPixel.
+ samplesPerPixel := 1.
] ifFalse:[
(nPlanes == 3) ifTrue:[
(planarConfiguration ~~ 1) ifTrue:[
@@ -1420,7 +1422,7 @@
self error:'format not supported'.
^ nil
].
- bitsPerPixel := bitsPerSample at:1
+ bitsPerPixel := bitsPerSample at:1.
]
].
--- a/TargaReader.st Mon Oct 23 18:00:19 1995 +0100
+++ b/TargaReader.st Wed Oct 25 11:16:32 1995 +0100
@@ -37,7 +37,7 @@
version
"
-$Header: /cvs/stx/stx/libview2/TargaReader.st,v 1.3 1995-08-29 17:45:06 claus Exp $
+$Header: /cvs/stx/stx/libview2/TargaReader.st,v 1.4 1995-10-25 10:16:21 cg Exp $
"
!
@@ -103,7 +103,7 @@
"read a targa-image from aFileName. return the receiver (with all
relevant instance variables set for the image) or nil on error"
- |depth flags|
+ |depth flags nBytes ok|
inStream := aStream.
aStream binary.
@@ -126,11 +126,31 @@
"
mhmh - order is blue-green-red
"
- 1 to:(data size - 2) by:3 do:[:i |
- |t|
- t := data at:i.
- data at:i put:(data at:i+2).
- data at:i+2 put:t
+ nBytes := data size.
+ ok := false.
+
+%{ /* OPTIONAL */
+ if (__isByteArray(_INST(data))) {
+ int lastIndex = __intVal(nBytes) - 2;
+ unsigned char *cp = __ByteArrayInstPtr(_INST(data))->ba_element;
+ int i;
+ unsigned char t;
+
+ for (i=0; i<lastIndex; i+=3, cp+=3) {
+ t = cp[0];
+ cp[0] = cp[2];
+ cp[2] = t;
+ }
+ ok = true;
+ }
+%}.
+ ok ifFalse:[
+ 1 to:(data size - 2) by:3 do:[:i |
+ |t|
+ t := data at:i.
+ data at:i put:(data at:i+2).
+ data at:i+2 put:t
+ ]
].
photometric := #rgb.
--- a/XPMReader.st Mon Oct 23 18:00:19 1995 +0100
+++ b/XPMReader.st Wed Oct 25 11:16:32 1995 +0100
@@ -37,7 +37,7 @@
version
"
-$Header: /cvs/stx/stx/libview2/XPMReader.st,v 1.9 1995-08-30 17:54:40 claus Exp $
+$Header: /cvs/stx/stx/libview2/XPMReader.st,v 1.10 1995-10-25 10:16:29 cg Exp $
"
!
@@ -55,6 +55,9 @@
Does not (currently) handle none-colors (i.e. for image-masks).
+ Only understands single-word color names (i.e. names with spaces
+ are not supported)
+
Save not supported
Suggestions: adapt & use the XPM library here.
@@ -130,7 +133,7 @@
].
line := aStream nextLine.
- [line notNil and:[line startsWith:'/*']] whileTrue:[
+ [line notNil and:[(line startsWith:'/*') or:[line isBlank]]] whileTrue:[
line := aStream nextLine.
].
(line notNil and:[line startsWith:'static char']) ifFalse:[
@@ -138,8 +141,11 @@
^ nil
].
line := aStream nextLine.
- [line notNil and:[line startsWith:'/*']] whileTrue:[
- line := aStream nextLine.
+ (line notNil and:[line startsWith:'/*']) ifTrue:[
+ [line notNil
+ and:[(line startsWith:'/*') or:[line startsWith:' *']]] whileTrue:[
+ line := aStream nextLine.
+ ].
].
(line notNil and:[line startsWith:'"']) ifFalse:[
'XPM: format error (expected "ww hh nn mm)' errorPrintNL.
@@ -157,13 +163,13 @@
].
xlation := Array new:256.
- redMap := Array new:colorMapSize.
- greenMap := Array new:colorMapSize.
- blueMap := Array new:colorMapSize.
+ redMap := ByteArray new:colorMapSize.
+ greenMap := ByteArray new:colorMapSize.
+ blueMap := ByteArray new:colorMapSize.
colorMap := Colormap redVector:redMap greenVector:greenMap blueVector:blueMap.
1 to:colorMapSize do:[:colorIndex |
- |index line color|
+ |index line color t|
line := aStream nextLine.
[line notNil and:[line startsWith:'/*']] whileTrue:[
@@ -240,9 +246,9 @@
] ifFalse:[
color := Color name:colorName.
].
- redMap at:colorIndex put:(color red * 255 // 100).
- greenMap at:colorIndex put:(color green * 255 // 100).
- blueMap at:colorIndex put:(color blue * 255 // 100).
+ redMap at:colorIndex put:(color red asFloat * 255.0 // 100).
+ greenMap at:colorIndex put:(color green asFloat * 255.0 // 100).
+ blueMap at:colorIndex put:(color blue asFloat * 255.0 // 100).
].
"actually, could make it an image with less depth most of the time ..."
@@ -283,7 +289,10 @@
XPMReader fromStream:('bitmaps/magtape.xpm' asFilename readStream)
XPMReader fromStream:('bitmaps/pixmap.xpm' asFilename readStream)
XPMReader fromStream:('bitmaps/SBrowser.xbm' asFilename readStream)
- "
+ "
+
+ "Created: 24.9.1995 / 06:20:06 / claus"
+ "Modified: 24.9.1995 / 07:07:33 / claus"
! !
XPMReader initialize!