|
From: <kr_...@us...> - 2003-04-07 21:03:16
|
Update of /cvsroot/htoolkit/gio/src/Graphics/UI/GIO
In directory sc8-pr-cvs1:/tmp/cvs-serv12462/src/Graphics/UI/GIO
Modified Files:
Canvas.hs Bitmap.hs Types.hs
Log Message:
Export some additional bitmap related features from the Port library
Index: Canvas.hs
===================================================================
RCS file: /cvsroot/htoolkit/gio/src/Graphics/UI/GIO/Canvas.hs,v
retrieving revision 1.5
retrieving revision 1.6
diff -C2 -d -r1.5 -r1.6
*** Canvas.hs 8 Feb 2003 08:32:53 -0000 1.5
--- Canvas.hs 7 Apr 2003 21:03:09 -0000 1.6
***************
*** 441,448 ****
-- | Draw a bitmap
bitmap :: Point -> Bitmap -> Canvas -> IO ()
! bitmap p bitmap can
! = do bh <- get bitmap bitmapHandle
! Port.drawBitmap p bh (hcanvas can)
!
{--------------------------------------------------------------------
--- 441,445 ----
-- | Draw a bitmap
bitmap :: Point -> Bitmap -> Canvas -> IO ()
! bitmap p bitmap can = Port.drawBitmap p bitmap (hcanvas can)
{--------------------------------------------------------------------
Index: Bitmap.hs
===================================================================
RCS file: /cvsroot/htoolkit/gio/src/Graphics/UI/GIO/Bitmap.hs,v
retrieving revision 1.1.1.1
retrieving revision 1.2
diff -C2 -d -r1.1.1.1 -r1.2
*** Bitmap.hs 26 Jan 2003 12:41:40 -0000 1.1.1.1
--- Bitmap.hs 7 Apr 2003 21:03:10 -0000 1.2
***************
*** 14,24 ****
(
-- * Bitmaps
! Bitmap, readBitmap
! -- * Internal
! , bitmapHandle
) where
! import qualified Graphics.UI.Port as Port
import Graphics.UI.GIO.Types
import Graphics.UI.GIO.Attributes
--- 14,24 ----
(
-- * Bitmaps
! createBitmap
! , readBitmap, writeBitmap
! , getAvailableCodecs
) where
! import qualified Graphics.UI.Port as Lib
import Graphics.UI.GIO.Types
import Graphics.UI.GIO.Attributes
***************
*** 28,49 ****
Bitmaps
--------------------------------------------------------------------}
! -- | A bitmap.
! data Bitmap = Bitmap{ bitmap :: Port.Bitmap }
-- | Read a bitmap from file.
readBitmap :: FilePath -> [Prop Bitmap] -> IO Bitmap
readBitmap fname props
! = do b <- do bm <- Port.readBitmap fname
! return (Bitmap bm)
set b props
return b
! bitmapHandle :: Attr Bitmap Port.Bitmap
! bitmapHandle
! = readAttr "bitmapHandle" (\b -> return (bitmap b))
instance Dimensions Bitmap where
! frame = newAttr (\b -> do sz <- Port.getBitmapSize (bitmap b); return (rectOfSize sz))
! (\b r -> do Port.resizeBitmap (bitmap b) (rectSize r))
{--------------------------------------------------------------------
--- 28,55 ----
Bitmaps
--------------------------------------------------------------------}
!
! -- | Create an empty bitmap of a certain size.
! createBitmap :: Size -> IO Bitmap
! createBitmap = Lib.createBitmap
-- | Read a bitmap from file.
readBitmap :: FilePath -> [Prop Bitmap] -> IO Bitmap
readBitmap fname props
! = do b <- Lib.readBitmap fname
set b props
return b
+
+ -- | Write a bitmap image to file. Can select different formats with the supplied MIME
+ -- string. The image type \"image\/bmp\" is always supported. See also 'getAvailableCodecs'.
+ writeBitmap :: Bitmap -> FilePath -> String -> IO ()
+ writeBitmap = Lib.writeBitmap
! -- | Return all available codec's on this platform.
! getAvailableCodecs :: IO [Codec]
! getAvailableCodecs = Lib.getAvailableCodecs
instance Dimensions Bitmap where
! frame = newAttr (\b -> do sz <- Lib.getBitmapSize b; return (rectOfSize sz))
! (\b r -> do Lib.setBitmapSize b (rectSize r))
{--------------------------------------------------------------------
Index: Types.hs
===================================================================
RCS file: /cvsroot/htoolkit/gio/src/Graphics/UI/GIO/Types.hs,v
retrieving revision 1.7
retrieving revision 1.8
diff -C2 -d -r1.7 -r1.8
*** Types.hs 24 Mar 2003 17:18:37 -0000 1.7
--- Types.hs 7 Apr 2003 21:03:10 -0000 1.8
***************
*** 67,71 ****
-- ** Bitmaps
! -- , Bitmap
, Codec(..)
--- 67,71 ----
-- ** Bitmaps
! , Bitmap
, Codec(..)
|