packages feed

OpenVG 0.2.1 → 0.3.0

raw patch · 13 files changed

+75/−47 lines, 13 filesdep +OpenGLRawdep +StateVardep ~GLUTdep ~OpenGL

Dependencies added: OpenGLRaw, StateVar

Dependency ranges changed: GLUT, OpenGL

Files

InstallWindows.txt view
@@ -1,9 +1,11 @@-These instructions assume you have Haskell and OpenGL working -(probably via the Haskell Plaform) and have MinGW/msys installed-and are comfortable with them.+*** NOT CURRENTLY WORKING *** +These instructions assume you have Haskell and OpenGL with the +split packages working and have MinGW/msys installed and are +comfortable with them.+ -------------------------------------------------------------------Step 1.+Part 1. The C library.  Download the ShivaVG C library from Sourceforge (version 0.2.1): http://sourceforge.net/projects/shivavg/@@ -49,7 +51,7 @@ You should now be able to build the Haskell binding to Shiva.  -------------------------------------------------------------------+Part 2. The bindings.  I dropped the archive into my home directory C:\msys\1.0\home\stephen
OpenVG.cabal view
@@ -1,5 +1,5 @@ name:             OpenVG-version:          0.2.1+version:          0.3.0 license:          BSD3 license-file:     LICENSE copyright:        Stephen Tetley <stephen.tetley@gmail.com>@@ -11,13 +11,18 @@   A Haskell binding for the OpenVG vector graphics API version 1.0.1   specifically the ShivaVG-0.2.1 implementation.   .-  This version (0.2.1) is compatible with the Haskell Platform -  (2009.2.0.2) and works on Windows with MinGW/msys.+  This version (0.3.0) is NOT compatible with the Haskell Platform +  - it uses the split OpenGL packages (RAW, Tensor, etc.).   .+  ** NOT CURRENTLY WORKING ON WINDOWS **+  .   Changelog+  0.2.1 to 0.3.0 Changes to use the split OpenGL packages, added type coercions +  in the Size data type (these might not be ideal).+  .    0.2 to 0.2.1 .cabal file upper bounds for OpenGL and GLUT, and-   Windows installation instructions updated.-+  Windows installation instructions updated.+  build-type:         Simple stability:          experimental cabal-version:      >= 1.2@@ -31,7 +36,8 @@  library   hs-source-dirs:     src-  build-depends:      base < 5, OpenGL >= 2.2 && < 2.3, GLUT >= 2.1.1.2 && < 2.2+  build-depends:      base < 5, OpenGL >= 2.4 && < 2.5, GLUT >= 2.2 && < 2.3,+                      OpenGLRaw >=1.1.0.1 && < 2, StateVar >= 1.0.0.0 && < 2       exposed-modules:
README.txt view
@@ -2,6 +2,8 @@  Haskell OpenVG 0.1 binds to ShivaVG-0.2.0 Haskell OpenVG 0.2 binds to ShivaVG-0.2.1+Haskell OpenVG 0.2.1 binds to ShivaVG-0.2.1+Haskell OpenVG 0.3.0 binds to ShiaVG-0.2.1  I've tested the bindings on both Windows XP (MinGW/Msys)  and MacOSX Leopard.@@ -9,8 +11,8 @@ On MacOSX both the 0.2 and 0.1 bindings seem work on  their respective libraries. -On Windows I've not been able to get the 0.2 bindings to work,-so go with Haskell OpenVG 0.1 and ShivaVG-0.2.0.+On Windows I've not been able to get the 0.3.0 bindings to +work (yet), 0.2.1 is preferred...   
src/Graphics/Rendering/OpenVG/VG/BasicTypes.hsc view
@@ -35,11 +35,14 @@   -- * Points   Point,   +  -- * Size conversion+  unSize   ) where  #include <vg/openvg.h> -import Graphics.Rendering.OpenGL.GL.BasicTypes+import Graphics.Rendering.OpenGL.Raw.Core31+import Graphics.Rendering.OpenGL.GL.CoordTrans ( Size(..) )  import Foreign.Ptr @@ -89,6 +92,12 @@  -- | Point (VGfloat,VGfloat)  type Point = (VGfloat, VGfloat)+++-- Helper - unwrap Size++unSize :: Size -> (VGint,VGint)+unSize (Size w h) = (fromIntegral w, fromIntegral h)   
src/Graphics/Rendering/OpenVG/VG/Blending.hs view
@@ -31,7 +31,7 @@     seti, ParamType ( BlendMode ) ) import Graphics.Rendering.OpenVG.VG.Utils ( Marshal(..), enumValue ) -import Graphics.Rendering.OpenGL.GL.StateVar (+import Data.StateVar (    SettableStateVar, makeSettableStateVar )   
src/Graphics/Rendering/OpenVG/VG/Extending.hs view
@@ -27,7 +27,7 @@ import Graphics.Rendering.OpenVG.VG.Constants (     vg_VENDOR, vg_RENDERER, vg_VERSION, vg_EXTENSIONS )  -import Graphics.Rendering.OpenGL.GL.StateVar (+import Data.StateVar (    GettableStateVar, makeGettableStateVar )     import Foreign.C.String ( peekCString )
src/Graphics/Rendering/OpenVG/VG/Images.hs view
@@ -58,7 +58,7 @@ ) where  import Graphics.Rendering.OpenVG.VG.BasicTypes ( -    VGenum, VGint, VGImage, marshalBool )+    VGenum, VGint, VGImage, marshalBool, unSize ) import Graphics.Rendering.OpenVG.VG.CFunDecls (      vgCreateImage, vgDestroyImage, vgClearImage,     vgImageSubData, vgGetImageSubData, @@ -91,7 +91,8 @@     Marshal(..), Unmarshal(..), enumValue, unmarshalIntegral, bitwiseOr )  import Graphics.Rendering.OpenGL.GL.CoordTrans ( Position(..), Size (..) )  -import Graphics.Rendering.OpenGL.GL.StateVar (++import Data.StateVar (    GettableStateVar, makeGettableStateVar,    SettableStateVar, makeSettableStateVar )         @@ -218,9 +219,9 @@      -- | @createImage@ corresponds to the OpenVG function @vgCreateImage@.              createImage :: ImageFormat -> Size -> [ImageQuality] -> IO VGImage -createImage SRGBA8888 (Size w h) qs = +createImage SRGBA8888 sz qs = let (w,h) = unSize sz in     vgCreateImage (marshal SRGBA8888) w h (bitwiseOr qs) -createImage _ _ _ = error $ "unsupported image format"+createImage _         _          _  = error $ "unsupported image format"   -- | @destroyImage@ corresponds to the OpenVG function @vgDestroyImage@. @@ -252,21 +253,26 @@ -- | Fill the given rectangle inside the image with the current color setting -- from the @StateVar@ 'clearColor' clearImage :: VGImage -> Position -> Size -> IO () -clearImage handle (Position x y) (Size w h) = vgClearImage handle x y w h+clearImage handle (Position x y) sz = +   let (w,h) = unSize sz in vgClearImage handle x y w h                           -- | @imageSubData@ corresponds to the OpenVG function @vgImageSubData@.  imageSubData :: VGImage -> Ptr a -> VGint -> ImageFormat                   -> Position -> Size -> IO ()-imageSubData image imgdata stride fmt (Position x y) (Size w h) =+imageSubData image imgdata stride fmt (Position x y) sz =     vgImageSubData image imgdata stride (marshalImageFormat fmt) x y w h  -+  where+    (w,h) = unSize sz+    -- | @getImageSubData@ corresponds to the OpenVG function @vgGetImageSubData@.                    getImageSubData :: VGImage -> Ptr a -> VGint -> ImageFormat                     -> Position -> Size -> IO ()-getImageSubData image imgdata stride fmt (Position x y) (Size w h) =-    vgGetImageSubData image imgdata stride (marshalImageFormat fmt) x y w h -+getImageSubData image imgdata stride fmt (Position x y) sz = +     vgGetImageSubData image imgdata stride (marshalImageFormat fmt) x y w h +  where+    (w,h) = unSize sz+    --------------------------------------------------------------------------------  -- childImage - not implemented in shiva-vg@@ -278,8 +284,10 @@ -- | @copyImage@ corresponds to the OpenVG function @vgCopyImage@. copyImage :: VGImage -> Position -> VGImage -> Position                 -> Size -> Bool -> IO ()-copyImage dst (Position dx dy) src (Position sx sy) (Size w h) dither = +copyImage dst (Position dx dy) src (Position sx sy) sz dither =      vgCopyImage dst dx dy src sx sy w h (marshalBool dither)+  where+     (w,h) = unSize sz  -------------------------------------------------------------------------------- -- Drawing iamges to the drawing surface@@ -311,22 +319,22 @@  -- | @setPixels@ corresponds to the OpenVG function @vgSetPixels@.  setPixels :: Position -> VGImage -> Position -> Size -> IO ()-setPixels (Position dx dy) src (Position sx sy) (Size w h) = +setPixels (Position dx dy) src (Position sx sy) sz = let (w,h) = unSize sz in      vgSetPixels dx dy src sx sy w h  -- | @writePixels@ corresponds to the OpenVG function @vgWritePixels@.  writePixels :: Ptr a -> VGint -> ImageFormat -> Position -> Size -> IO ()-writePixels pixeldata stride fmt (Position dx dy) (Size w h) =+writePixels pixeldata stride fmt (Position dx dy) sz = let (w,h) = unSize sz in      vgWritePixels pixeldata stride (marshal fmt) dx dy w h  -- | @getPixels@ corresponds to the OpenVG function @vgGetPixels@.  getPixels :: VGImage  -> Position -> Position -> Size -> IO ()-getPixels dst (Position dx dy) (Position sx sy) (Size w h) = +getPixels dst (Position dx dy) (Position sx sy) sz = let (w,h) = unSize sz in      vgGetPixels dst dx dy sx sy w h  -- | @readPixels@ corresponds to the OpenVG function @vgReadPixels@. readPixels :: Ptr a -> VGint -> ImageFormat -> Position -> Size -> IO ()-readPixels pixeldata stride fmt (Position sx sy) (Size w h) =+readPixels pixeldata stride fmt (Position sx sy) sz = let (w,h) = unSize sz in      vgReadPixels pixeldata stride (marshal fmt) sx sy w h  --------------------------------------------------------------------------------@@ -334,8 +342,8 @@  -- | @copyPixels@ corresponds to the OpenVG function @vgCopyPixels@. copyPixels :: Position -> Position -> Size -> IO ()-copyPixels (Position dx dy) (Position sx sy) (Size w h) = -    vgCopyPixels dx dy sx sy w h+copyPixels (Position dx dy) (Position sx sy) sz = +    let (w,h) = unSize sz in vgCopyPixels dx dy sx sy w h                                     
src/Graphics/Rendering/OpenVG/VG/Paint.hs view
@@ -70,12 +70,12 @@     PaintMode(..) ) import Graphics.Rendering.OpenVG.VG.Utils (      Marshal(..), Unmarshal(..), enumValue, unmarshalIntegral, bitwiseOr )+import Graphics.Rendering.OpenGL.GL.VertexSpec ( Color4(..) ) -import Graphics.Rendering.OpenGL.GL.StateVar (+import Data.StateVar (     StateVar(), makeStateVar,     SettableStateVar, makeSettableStateVar,     GettableStateVar, makeGettableStateVar )-import Graphics.Rendering.OpenGL.GL.VertexSpec ( Color4(..) )  -------------------------------------------------------------------------------- -- Creating and destroying paint objects 
src/Graphics/Rendering/OpenVG/VG/Paths.hs view
@@ -127,7 +127,7 @@     Marshal(..), Unmarshal(..), unmarshalIntegral, enumValue,      bitwiseOr, unbits ) -import Graphics.Rendering.OpenGL.GL.StateVar (+import Data.StateVar (     SettableStateVar, makeSettableStateVar,     GettableStateVar, makeGettableStateVar,     ( $= ) ) 
src/Graphics/Rendering/OpenVG/VG/RenderingQuality.hs view
@@ -63,7 +63,7 @@ import Graphics.Rendering.OpenVG.VG.Utils (      Marshal(..), Unmarshal(..), enumValue, unmarshalIntegral ) -import Graphics.Rendering.OpenGL.GL.StateVar (+import Data.StateVar (     StateVar(), makeStateVar, SettableStateVar, makeSettableStateVar )     import Foreign.Ptr ( Ptr )   
src/Graphics/Rendering/OpenVG/VG/Scissoring.hs view
@@ -33,20 +33,21 @@ ) where  import Graphics.Rendering.OpenVG.VG.BasicTypes ( -    VGint, VGfloat, marshalBool )+    VGint, VGfloat, marshalBool, unSize ) import Graphics.Rendering.OpenVG.VG.CFunDecls ( vgClear ) import Graphics.Rendering.OpenVG.VG.Parameters (      ParamType ( Scissoring, ScissorRects, MaxScissorRects,                  Masking, ClearColor ),        seti, geti, setiv, setfv )-import Graphics.Rendering.OpenGL.GL.StateVar (-    SettableStateVar, makeSettableStateVar,-    GettableStateVar, makeGettableStateVar )   import Graphics.Rendering.OpenGL.GL.CoordTrans ( Position(..), Size(..) ) import Graphics.Rendering.OpenGL.GL.VertexSpec ( Color4(..) ) +import Data.StateVar (+    SettableStateVar, makeSettableStateVar,+    GettableStateVar, makeGettableStateVar )  + -------------------------------------------------------------------------------- -- Scissoring @@ -66,7 +67,7 @@ scissorRects :: SettableStateVar [ScissorRect] scissorRects = makeSettableStateVar $ \ss ->     setiv ScissorRects (foldr f [] ss) where -        f ((Position mx my), (Size w h)) a = mx:my:w:h:a +        f ((Position mx my), sz) a = let (w,h) = unSize sz in mx:my:w:h:a   -------------------------------------------------------------------------------- -- Alpha masking@@ -97,7 +98,7 @@  -- | @clear@ corresponds to the OpenVG function @vgClear@. clear :: Position -> Size -> IO ()-clear (Position x y) (Size w h) = vgClear x y w h+clear (Position x y) sz = let (w,h) = unSize sz in vgClear x y w h   --------------------------------------------------------------------------------
src/Graphics/Rendering/OpenVG/VG/ShivaExtensions.hs view
@@ -25,7 +25,7 @@   destroyContextSH ) where -import Graphics.Rendering.OpenVG.VG.BasicTypes ( vg_TRUE )+import Graphics.Rendering.OpenVG.VG.BasicTypes ( vg_TRUE, unSize ) import Graphics.Rendering.OpenVG.VG.CFunDecls (          vgCreateContextSH, vgResizeSurfaceSH, vgDestroyContextSH )  @@ -44,14 +44,14 @@  -- | Create an OpenVG context on top of an already created OpenGL context.    createContextSH :: Size -> IO Bool-createContextSH (Size w h) = do +createContextSH sz = let (w,h) = unSize sz in do      vgbool <- vgCreateContextSH w h     if vgbool == vg_TRUE then return True else return False  -- | @resizeSurfaceSH@ should be called whenever the size of the  -- surface changes.     resizeSurfaceSH :: Size -> IO ()-resizeSurfaceSH (Size w h) = vgResizeSurfaceSH w h+resizeSurfaceSH sz = let (w,h) = unSize sz in vgResizeSurfaceSH w h  -- | Destroy the OpenVG context. destroyContextSH :: IO ()
src/Graphics/Rendering/OpenVG/VGU/Errors.hs view
@@ -23,7 +23,7 @@ import Graphics.Rendering.OpenVG.VGU.ErrorsInternal (    Error(..), ErrorCategory(..), getErrors )    -import Graphics.Rendering.OpenGL.GL.StateVar (+import Data.StateVar (    GettableStateVar, makeGettableStateVar )