Merge branch 'master' of git://factorcode.org/git/factor
commit
1359f3bcf1
|
@ -1,6 +1,7 @@
|
||||||
USING: images.bitmap images.viewer io.encodings.binary
|
USING: images.bitmap images.viewer io.encodings.binary
|
||||||
io.files io.files.unique kernel tools.test images.loader
|
io.files io.files.unique kernel tools.test images.loader
|
||||||
literals sequences checksums.md5 checksums ;
|
literals sequences checksums.md5 checksums
|
||||||
|
images.normalization ;
|
||||||
IN: images.bitmap.tests
|
IN: images.bitmap.tests
|
||||||
|
|
||||||
CONSTANT: test-bitmap24 "vocab:images/test-images/thiswayup24.bmp"
|
CONSTANT: test-bitmap24 "vocab:images/test-images/thiswayup24.bmp"
|
||||||
|
@ -16,15 +17,6 @@ CONSTANT: test-41 "vocab:images/test-images/41red24bit.bmp"
|
||||||
CONSTANT: test-42 "vocab:images/test-images/42red24bit.bmp"
|
CONSTANT: test-42 "vocab:images/test-images/42red24bit.bmp"
|
||||||
CONSTANT: test-43 "vocab:images/test-images/43red24bit.bmp"
|
CONSTANT: test-43 "vocab:images/test-images/43red24bit.bmp"
|
||||||
|
|
||||||
[ t ]
|
|
||||||
[
|
|
||||||
test-bitmap24
|
|
||||||
[ binary file-contents ] [ load-image ] bi
|
|
||||||
|
|
||||||
"test-bitmap24" unique-file
|
|
||||||
[ save-bitmap ] [ binary file-contents ] bi =
|
|
||||||
] unit-test
|
|
||||||
|
|
||||||
{
|
{
|
||||||
$ test-bitmap8
|
$ test-bitmap8
|
||||||
$ test-bitmap24
|
$ test-bitmap24
|
||||||
|
@ -34,7 +26,7 @@ CONSTANT: test-43 "vocab:images/test-images/43red24bit.bmp"
|
||||||
|
|
||||||
: test-bitmap-save ( path -- ? )
|
: test-bitmap-save ( path -- ? )
|
||||||
[ md5 checksum-file ]
|
[ md5 checksum-file ]
|
||||||
[ load-image ] bi
|
[ load-image normalize-image ] bi
|
||||||
"bitmap-save-test" unique-file
|
"bitmap-save-test" unique-file
|
||||||
[ save-bitmap ]
|
[ save-bitmap ]
|
||||||
[ md5 checksum-file ] bi = ;
|
[ md5 checksum-file ] bi = ;
|
||||||
|
@ -47,5 +39,6 @@ CONSTANT: test-43 "vocab:images/test-images/43red24bit.bmp"
|
||||||
$ test-41
|
$ test-41
|
||||||
$ test-42
|
$ test-42
|
||||||
$ test-43
|
$ test-43
|
||||||
|
$ test-bitmap24
|
||||||
} [ test-bitmap-save ] all?
|
} [ test-bitmap-save ] all?
|
||||||
] unit-test
|
] unit-test
|
||||||
|
|
|
@ -3,7 +3,7 @@
|
||||||
USING: combinators kernel accessors ;
|
USING: combinators kernel accessors ;
|
||||||
IN: images
|
IN: images
|
||||||
|
|
||||||
SINGLETONS: L BGR RGB BGRA RGBA ABGR ARGB RGBX XRGB BGRX XBGR
|
SINGLETONS: L LA BGR RGB BGRA RGBA ABGR ARGB RGBX XRGB BGRX XBGR
|
||||||
R16G16B16 R32G32B32 R16G16B16A16 R32G32B32A32 ;
|
R16G16B16 R32G32B32 R16G16B16A16 R32G32B32A32 ;
|
||||||
|
|
||||||
UNION: alpha-channel BGRA RGBA ABGR ARGB R16G16B16A16 R32G32B32A32 ;
|
UNION: alpha-channel BGRA RGBA ABGR ARGB R16G16B16A16 R32G32B32A32 ;
|
||||||
|
@ -11,6 +11,7 @@ UNION: alpha-channel BGRA RGBA ABGR ARGB R16G16B16A16 R32G32B32A32 ;
|
||||||
: bytes-per-pixel ( component-order -- n )
|
: bytes-per-pixel ( component-order -- n )
|
||||||
{
|
{
|
||||||
{ L [ 1 ] }
|
{ L [ 1 ] }
|
||||||
|
{ LA [ 2 ] }
|
||||||
{ BGR [ 3 ] }
|
{ BGR [ 3 ] }
|
||||||
{ RGB [ 3 ] }
|
{ RGB [ 3 ] }
|
||||||
{ BGRA [ 4 ] }
|
{ BGRA [ 4 ] }
|
||||||
|
@ -33,4 +34,4 @@ TUPLE: image dim component-order upside-down? bitmap ;
|
||||||
|
|
||||||
: has-alpha? ( image -- ? ) component-order>> alpha-channel? ;
|
: has-alpha? ( image -- ? ) component-order>> alpha-channel? ;
|
||||||
|
|
||||||
GENERIC: load-image* ( path tuple -- image )
|
GENERIC: load-image* ( path tuple -- image )
|
||||||
|
|
|
@ -1,8 +1,7 @@
|
||||||
! Copyright (C) 2009 Doug Coleman.
|
! Copyright (C) 2009 Doug Coleman.
|
||||||
! See http://factorcode.org/license.txt for BSD license.
|
! See http://factorcode.org/license.txt for BSD license.
|
||||||
USING: constructors kernel splitting unicode.case combinators
|
USING: constructors kernel splitting unicode.case combinators
|
||||||
accessors images.bitmap images.tiff images images.normalization
|
accessors images.bitmap images.tiff images io.pathnames ;
|
||||||
io.pathnames ;
|
|
||||||
IN: images.loader
|
IN: images.loader
|
||||||
|
|
||||||
ERROR: unknown-image-extension extension ;
|
ERROR: unknown-image-extension extension ;
|
||||||
|
@ -16,4 +15,4 @@ ERROR: unknown-image-extension extension ;
|
||||||
} case ;
|
} case ;
|
||||||
|
|
||||||
: load-image ( path -- image )
|
: load-image ( path -- image )
|
||||||
dup image-class new load-image* normalize-image ;
|
dup image-class new load-image* ;
|
||||||
|
|
|
@ -463,6 +463,7 @@ ERROR: unknown-component-order ifd ;
|
||||||
{ { 16 16 16 } [ 2 seq>native-endianness ] }
|
{ { 16 16 16 } [ 2 seq>native-endianness ] }
|
||||||
{ { 8 8 8 8 } [ ] }
|
{ { 8 8 8 8 } [ ] }
|
||||||
{ { 8 8 8 } [ ] }
|
{ { 8 8 8 } [ ] }
|
||||||
|
{ 8 [ ] }
|
||||||
[ unknown-component-order ]
|
[ unknown-component-order ]
|
||||||
} case >>bitmap ;
|
} case >>bitmap ;
|
||||||
|
|
||||||
|
@ -474,11 +475,11 @@ ERROR: unknown-component-order ifd ;
|
||||||
{ { 16 16 16 } [ R16G16B16 ] }
|
{ { 16 16 16 } [ R16G16B16 ] }
|
||||||
{ { 8 8 8 8 } [ RGBA ] }
|
{ { 8 8 8 8 } [ RGBA ] }
|
||||||
{ { 8 8 8 } [ RGB ] }
|
{ { 8 8 8 } [ RGB ] }
|
||||||
|
{ 8 [ LA ] }
|
||||||
[ unknown-component-order ]
|
[ unknown-component-order ]
|
||||||
} case ;
|
} case ;
|
||||||
|
|
||||||
: normalize-alpha-data ( seq -- byte-array )
|
: normalize-alpha-data ( seq -- byte-array )
|
||||||
! [ normalize-alpha-data ] change-bitmap
|
|
||||||
B{ } like dup
|
B{ } like dup
|
||||||
byte-array>float-array
|
byte-array>float-array
|
||||||
4 <sliced-groups>
|
4 <sliced-groups>
|
||||||
|
|
|
@ -20,6 +20,8 @@ M: RGBA component-order>format drop GL_RGBA GL_UNSIGNED_BYTE ;
|
||||||
M: ARGB component-order>format drop GL_BGRA_EXT GL_UNSIGNED_INT_8_8_8_8_REV ;
|
M: ARGB component-order>format drop GL_BGRA_EXT GL_UNSIGNED_INT_8_8_8_8_REV ;
|
||||||
M: BGRA component-order>format drop GL_BGRA_EXT GL_UNSIGNED_BYTE ;
|
M: BGRA component-order>format drop GL_BGRA_EXT GL_UNSIGNED_BYTE ;
|
||||||
M: BGRX component-order>format drop GL_BGRA_EXT GL_UNSIGNED_BYTE ;
|
M: BGRX component-order>format drop GL_BGRA_EXT GL_UNSIGNED_BYTE ;
|
||||||
|
M: LA component-order>format drop GL_LUMINANCE_ALPHA GL_UNSIGNED_BYTE ;
|
||||||
|
M: L component-order>format drop GL_LUMINANCE GL_UNSIGNED_BYTE ;
|
||||||
|
|
||||||
SLOT: display-list
|
SLOT: display-list
|
||||||
|
|
||||||
|
@ -163,4 +165,4 @@ PRIVATE>
|
||||||
: <texture> ( image loc -- texture )
|
: <texture> ( image loc -- texture )
|
||||||
over dim>> max-texture-size [ <= ] 2all?
|
over dim>> max-texture-size [ <= ] 2all?
|
||||||
[ <single-texture> ]
|
[ <single-texture> ]
|
||||||
[ [ max-texture-size tesselate ] dip <multi-texture> ] if ;
|
[ [ max-texture-size tesselate ] dip <multi-texture> ] if ;
|
||||||
|
|
|
@ -1,10 +1,10 @@
|
||||||
! Copyright (C) 2009 Slava Pestov.
|
! Copyright (C) 2009 Slava Pestov.
|
||||||
! See http://factorcode.org/license.txt for BSD license.
|
! See http://factorcode.org/license.txt for BSD license.
|
||||||
USING: kernel assocs math sequences fry io.encodings.string
|
USING: kernel assocs math sequences fry io.encodings.string
|
||||||
io.encodings.utf16n accessors arrays combinators destructors locals
|
io.encodings.utf16n accessors arrays combinators destructors
|
||||||
cache namespaces init images.normalization fonts alien.c-types
|
cache namespaces init fonts alien.c-types windows windows.usp10
|
||||||
windows windows.usp10 windows.offscreen windows.gdi32
|
windows.offscreen windows.gdi32 windows.ole32 windows.types
|
||||||
windows.ole32 windows.types windows.fonts opengl.textures ;
|
windows.fonts opengl.textures locals ;
|
||||||
IN: windows.uniscribe
|
IN: windows.uniscribe
|
||||||
|
|
||||||
TUPLE: script-string font string metrics ssa size image disposed ;
|
TUPLE: script-string font string metrics ssa size image disposed ;
|
||||||
|
@ -112,4 +112,4 @@ SYMBOL: cached-script-strings
|
||||||
cached-script-strings get-global [ <script-string> ] 2cache ;
|
cached-script-strings get-global [ <script-string> ] 2cache ;
|
||||||
|
|
||||||
[ <cache-assoc> cached-script-strings set-global ]
|
[ <cache-assoc> cached-script-strings set-global ]
|
||||||
"windows.uniscribe" add-init-hook
|
"windows.uniscribe" add-init-hook
|
||||||
|
|
Loading…
Reference in New Issue