#FEATURE by cg
class: MacOSXIconReader
added:
#read_ic12_from:
#read_ic13_from:
#read_ic14_from:
comment/format in:
#common_read_paletteImage_from:size:width:height:depth:
#read_ic11_from:
changed:
#readSingleIcon:from:
#read_l8mk_from:
--- a/MacOSXIconReader.st Wed Feb 22 12:06:45 2017 +0100
+++ b/MacOSXIconReader.st Wed Feb 22 12:15:04 2017 +0100
@@ -233,7 +233,7 @@
self fileFormatError:'unsupported icon format: ',iconType.
nil
].
- img inspect.
+ "/ img inspect.
img
].
@@ -243,7 +243,7 @@
"
"Modified: / 08-02-2017 / 19:08:05 / stefan"
- "Modified: / 22-02-2017 / 10:26:42 / cg"
+ "Modified: / 22-02-2017 / 12:11:30 / cg"
! !
!MacOSXIconReader methodsFor:'image writing'!
@@ -635,7 +635,10 @@
"
self fromFile:'/Applications/TextEdit.app/Contents/Resources/txt.icns'
+ self fromFile:'/Applications/TextEdit.app/Contents/Resources/html.icns'
"
+
+ "Modified (comment): / 22-02-2017 / 12:09:40 / cg"
!
readPNGOrJPEGFrom:bytes expectedSize:expectedSizeOrNil
@@ -860,6 +863,42 @@
"Created: / 22-02-2017 / 11:04:18 / cg"
!
+read_ic12_from:bytes
+ "read an ic12 (PNG or JPEG, 64) format icon"
+
+ ^ self readPNGOrJPEGFrom:bytes expectedSize:64.
+
+ "
+ self fromFile:'/Applications/TextEdit.app/Contents/Resources/txt.icns'
+ "
+
+ "Created: / 22-02-2017 / 12:10:10 / cg"
+!
+
+read_ic13_from:bytes
+ "read an ic12 (PNG or JPEG, 256x256) format icon"
+
+ ^ self readPNGOrJPEGFrom:bytes expectedSize:256.
+
+ "
+ self fromFile:'/Applications/TextEdit.app/Contents/Resources/txt.icns'
+ "
+
+ "Created: / 22-02-2017 / 12:11:06 / cg"
+!
+
+read_ic14_from:bytes
+ "read an ic12 (PNG or JPEG, 512x512) format icon"
+
+ ^ self readPNGOrJPEGFrom:bytes expectedSize:512.
+
+ "
+ self fromFile:'/Applications/TextEdit.app/Contents/Resources/txt.icns'
+ "
+
+ "Created: / 22-02-2017 / 12:13:59 / cg"
+!
+
read_ich4_from:bytes
"read an ich4 format icon;
1152 bytes; 48x48x4bit"
@@ -1051,12 +1090,12 @@
offset := 0.
(bytes from:1 to:4) = #[0 0 0 0] ifTrue:[
- self halt.
+ "/ self halt.
offset := 4.
].
^ self readPackBitsImageFrom:bytes asByteArray offset:offset width:32 height:32 depth:8.
- "Modified: / 22-02-2017 / 10:32:34 / cg"
+ "Modified: / 22-02-2017 / 12:08:08 / cg"
!
read_s8mk_from:bytes