]> gitweb.factorcode.org Git - factor.git/commitdiff
Merge branch 'master' of git://factorcode.org/git/factor
authorSlava Pestov <slava@slava-pestovs-macbook-pro.local>
Tue, 17 Mar 2009 01:54:36 +0000 (20:54 -0500)
committerSlava Pestov <slava@slava-pestovs-macbook-pro.local>
Tue, 17 Mar 2009 01:54:36 +0000 (20:54 -0500)
basis/images/bitmap/bitmap.factor
basis/images/test-images/40red24bit.bmp [new file with mode: 0644]
basis/images/test-images/41red24bit.bmp [new file with mode: 0644]
basis/images/test-images/42red24bit.bmp [new file with mode: 0644]
basis/images/test-images/43red24bit.bmp [new file with mode: 0644]
basis/images/test-images/elephants.tiff [new file with mode: 0644]
basis/images/tiff/tiff.factor

index ffe3adff481e7945f9b905a44cdd2d08d7d0facd..8209159a8e4c33386e27f6224d33b370bc54ae82 100755 (executable)
@@ -83,14 +83,15 @@ ERROR: bmp-not-supported n ;
 
 :: fixup-color-index ( loading-bitmap -- loading-bitmap )
     loading-bitmap width>> :> width
+    width 3 * :> width*3
     loading-bitmap height>> abs :> height
     loading-bitmap color-index>> length :> color-index-length
-    height 3 * :> height*3
-    color-index-length width height*3 * - height*3 /i :> misaligned
-    misaligned 0 > [
+    color-index-length height /i :> stride
+    color-index-length width*3 height * - height /i :> padding
+    padding 0 > [
         loading-bitmap [
-            loading-bitmap width>> misaligned + 3 * <sliced-groups>
-            [ 3 misaligned * head* ] map concat
+            stride <sliced-groups>
+            [ width*3 head-slice ] map concat
         ] change-color-index
     ] [
         loading-bitmap
diff --git a/basis/images/test-images/40red24bit.bmp b/basis/images/test-images/40red24bit.bmp
new file mode 100644 (file)
index 0000000..5e69455
Binary files /dev/null and b/basis/images/test-images/40red24bit.bmp differ
diff --git a/basis/images/test-images/41red24bit.bmp b/basis/images/test-images/41red24bit.bmp
new file mode 100644 (file)
index 0000000..6599dcc
Binary files /dev/null and b/basis/images/test-images/41red24bit.bmp differ
diff --git a/basis/images/test-images/42red24bit.bmp b/basis/images/test-images/42red24bit.bmp
new file mode 100644 (file)
index 0000000..e95a4f7
Binary files /dev/null and b/basis/images/test-images/42red24bit.bmp differ
diff --git a/basis/images/test-images/43red24bit.bmp b/basis/images/test-images/43red24bit.bmp
new file mode 100644 (file)
index 0000000..d88f2d4
Binary files /dev/null and b/basis/images/test-images/43red24bit.bmp differ
diff --git a/basis/images/test-images/elephants.tiff b/basis/images/test-images/elephants.tiff
new file mode 100644 (file)
index 0000000..f462a0c
Binary files /dev/null and b/basis/images/test-images/elephants.tiff differ
index 2ea1b08e208e98079455b7e3c0ccbb34b934122e..80eaff81400f30e800d6dbc5296ef9e287431894 100755 (executable)
@@ -477,26 +477,24 @@ ERROR: unknown-component-order ifd ;
         [ unknown-component-order ]
     } case ;
 
+: normalize-alpha-data ( seq -- byte-array )
+    ! [ normalize-alpha-data ] change-bitmap
+    B{ } like dup
+    byte-array>float-array
+    4 <sliced-groups>
+    [
+        dup fourth dup 0 = [
+            2drop
+        ] [
+            [ 3 head-slice ] dip '[ _ / ] change-each
+        ] if
+    ] each ;
+
 : handle-alpha-data ( ifd -- ifd )
     dup extra-samples find-tag {
-        { extra-samples-associated-alpha-data [
-            [
-                B{ } like dup
-                byte-array>float-array
-                4 <sliced-groups>
-                [
-                    dup fourth dup 0 = [
-                        2drop
-                    ] [
-                        [ 3 head-slice ] dip '[ _ / ] change-each
-                    ] if
-                ] each
-            ] change-bitmap
-        ] }
-        { extra-samples-unspecified-alpha-data [
-        ] }
-        { extra-samples-unassociated-alpha-data [
-        ] }
+        { extra-samples-associated-alpha-data [ ] }
+        { extra-samples-unspecified-alpha-data [ ] }
+        { extra-samples-unassociated-alpha-data [ ] }
         [ bad-extra-samples ]
     } case ;