images: adding "2x" images.

db4
John Benediktsson 2012-11-01 16:11:55 -07:00
parent 44b7bbc76d
commit e5d325df44
2 changed files with 11 additions and 8 deletions

View File

@ -65,10 +65,13 @@ UNION: alpha-channel-precedes-colors ABGR ARGB XBGR XRGB ;
TUPLE: image
dim component-order component-type
upside-down? premultiplied-alpha?
bitmap ;
bitmap 2x? ;
: <image> ( -- image ) image new ; inline
: image-dim ( image -- dim )
[ dim>> ] [ 2x?>> ] bi [ [ 2/ ] map ] when ;
: has-alpha? ( image -- ? ) component-order>> alpha-channel? ;
: bytes-per-component ( component-type -- n )

View File

@ -1,16 +1,16 @@
! Copyright (C) 2007, 2009 Doug Coleman.
! See http://factorcode.org/license.txt for BSD license.
USING: accessors images images.loader io.pathnames kernel
models namespaces opengl opengl.gl opengl.textures opengl.textures.private
sequences math arrays
strings ui ui.gadgets ui.gadgets.panes ui.images ui.render
constructors locals combinators.short-circuit
literals destructors ui.gadgets.worlds continuations ;
USING: accessors arrays combinators.short-circuit continuations
destructors images images.loader io.pathnames kernel locals
math models opengl.gl opengl.textures opengl.textures.private
sequences strings ui ui.gadgets ui.gadgets.panes
ui.gadgets.worlds ui.render ;
FROM: images => image-dim ;
IN: images.viewer
TUPLE: image-gadget < gadget image texture ;
<PRIVATE
M: image-gadget pref-dim* image>> [ dim>> ] [ { 640 480 } ] if* ;
M: image-gadget pref-dim* image>> [ image-dim ] [ { 640 480 } ] if* ;
: (image-gadget-texture) ( gadget -- texture )
dup image>> { 0 0 } <texture> >>texture texture>> ;