packages feed

AC-EasyRaster-GTK 1.1.1 → 1.1.2

raw patch · 5 files changed

+92/−17 lines, 5 filesdep ~array

Dependency ranges changed: array

Files

AC-EasyRaster-GTK.cabal view
@@ -1,6 +1,6 @@ Cabal-Version: >= 1.6
 Name:          AC-EasyRaster-GTK
-Version:       1.1.1
+Version:       1.1.2
 Stability:     Experimental
 Synopsis:      GTK+ pixel plotting.
 
@@ -13,9 +13,15 @@   reading and writing individual pixels). This is useful for
   applications such as fractal generators, ray tracers, etc.
 
+  Changes:
+
+  * Improved documentation (added sections and example code).
+
+  * Should work with GHC 6.12.1 (not that Gtk2hs does yet!)
+
 Category:      Graphics
 License:       BSD3
-License-file:  Licence.txt
+License-file:  License.txt
 Author:        Andrew Coppin
 Maintainer:    Andrew Coppin <MathematicalOrchid@hotmail.com>
 Build-Type:    Simple
@@ -23,5 +29,5 @@ 
 Library
   Exposed-modules: Graphics.EasyRaster.GTK, Graphics.EasyRaster.GTK.Paranoid
-  Build-Depends:   base >= 4 && < 5, array >= 0.2.0.0 && < 0.3, gtk >= 0.10 && < 0.11
+  Build-Depends:   base >= 4 && < 5, array >= 0.2.0.0 && < 0.4, gtk >= 0.10 && < 0.11
   HS-Source-Dirs:  .
Graphics/EasyRaster/GTK.hs view
@@ -12,19 +12,65 @@   however, this module provides access to the underlying
   GTK resources as well, in case you want to use it as
   part of a larger GTK program.
+
+  Note that /displaying/ an image on screen requires
+  you to run the GTK event loop. If you only want to
+  load, save and process image files, you can completely
+  ignore the GTK event loop. (You do still need to call
+  'init_system', however.)
 -}
 
 module Graphics.EasyRaster.GTK
     (
+      -- * System initialisation
       init_system,
-      process_event, wait_event, main_loop,
+
+      -- * Types
       Coord, Channel,
       ImageFileType (..), type_string,
       ImageBuffer (),
-      ib_new, ib_load, ib_save, ib_display, ib_canvas,
+
+      -- * Image buffer creation
+      ib_new, ib_load,
+
+      -- * Image buffer output
+      ib_save,
+
+      -- * Image buffer queries
       ib_size, ib_coords, ib_coords2, ib_valid_coords,
+
+      -- * Pixel I/O
       ib_write_pixel, ib_read_pixel,
+
+      -- * Image display
+      ib_display, ib_canvas,
+
+      -- * GTK event loop
+      process_event, wait_event, main_loop,
+
+      -- * Low-level GTK access
       ib_pixbuf
+
+      -- * Example code
+
+      {- |
+        The following short program should give you an idea
+        of how to use this library. It draws a simple graphic
+        and saves it to disk.
+
+        > module Main where
+        >
+        > import Graphics.EasyRaster.GTK
+        >
+        > main = do
+        >   init_system
+        >   ibuf <- ib_new (640, 480)
+        >   mapM_ (\p -> ib_write_pixel ibuf p (colour p)) (ib_coords ibuf)
+        >   ib_save ibuf IFT_PNG "Example1.png"
+        >
+        > colour :: (Coord, Coord) -> (Channel, Channel, Channel)
+        > colour (x, y) = (floor $ fromIntegral x / 640 * 255, floor $ fromIntegral y / 480 * 255, 0)
+      -}
     )
   where
 
Graphics/EasyRaster/GTK/Paranoid.hs view
@@ -9,15 +9,38 @@ 
 module Graphics.EasyRaster.GTK.Paranoid
     (
+      -- * System initialisation
       init_system,
-      ER.process_event, ER.wait_event, ER.main_loop,
+
+
+      -- * Types
       ER.Coord, ER.Channel,
       ER.ImageFileType (..), ER.type_string,
       ER.ImageBuffer (),
-      ER.ib_new, ER.ib_load, ER.ib_save, ER.ib_display, ER.ib_canvas,
+
+      -- * Image buffer creation
+      ER.ib_new, ER.ib_load,
+
+      -- * Image buffer output
+      ER.ib_save,
+
+      -- * Image buffer queries
       ER.ib_size, ER.ib_coords, ER.ib_coords2, ER.ib_valid_coords,
+
+      -- * Pixel I/O
       ib_write_pixel, ib_read_pixel,
+
+      -- * Image display
+      ER.ib_display, ER.ib_canvas,
+
+      -- * GTK event loop
+      ER.process_event, ER.wait_event, ER.main_loop,
+
+      -- * Low-level GTK access
       ER.ib_pixbuf
+
+      -- * Example code
+      -- | See "Graphics.EasyRaster.GTK" for examples.
     )
   where
 
− Licence.txt
@@ -1,10 +0,0 @@-Copyright (c) 2009, Andrew Coppin
-All rights reserved.
-
-Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
-
-    * Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
-    * Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.
-    * Neither the name of Andrew Coppin nor the names of the contributors may be used to endorse or promote products derived from this software without specific prior written permission.
-
-THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ License.txt view
@@ -0,0 +1,10 @@+Copyright (c) 2009, Andrew Coppin
+All rights reserved.
+
+Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
+
+    * Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
+    * Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.
+    * Neither the name of Andrew Coppin nor the names of the contributors may be used to endorse or promote products derived from this software without specific prior written permission.
+
+THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.