OpenVG 0.4.0 → 0.5.0
raw patch · 26 files changed
+419/−2345 lines, 26 filesdep +OpenVGRaw
Dependencies added: OpenVGRaw
Files
- Changes +5/−1
- OpenVG.cabal +12/−18
- demo/TestVgu.hs +129/−0
- demo/VguUtils.hs +77/−0
- examples/TestUtils.hs +0/−73
- examples/TestVgu.hs +0/−127
- src/Graphics/Rendering/OpenVG/Util/Colors.hs +0/−633
- src/Graphics/Rendering/OpenVG/Util/PathCommands.hs +0/−182
- src/Graphics/Rendering/OpenVG/VG.hs +0/−2
- src/Graphics/Rendering/OpenVG/VG/BasicTypes.hsc +0/−79
- src/Graphics/Rendering/OpenVG/VG/Blending.hs +4/−8
- src/Graphics/Rendering/OpenVG/VG/CFunDecls.hsc +0/−491
- src/Graphics/Rendering/OpenVG/VG/Constants.hsc +0/−384
- src/Graphics/Rendering/OpenVG/VG/DrawingContext.hs +2/−13
- src/Graphics/Rendering/OpenVG/VG/Extending.hs +3/−4
- src/Graphics/Rendering/OpenVG/VG/Images.hs +18/−37
- src/Graphics/Rendering/OpenVG/VG/Paint.hs +10/−26
- src/Graphics/Rendering/OpenVG/VG/Parameters.hs +30/−28
- src/Graphics/Rendering/OpenVG/VG/Paths.hs +80/−69
- src/Graphics/Rendering/OpenVG/VG/RenderingQuality.hs +11/−21
- src/Graphics/Rendering/OpenVG/VG/Scissoring.hs +21/−16
- src/Graphics/Rendering/OpenVG/VG/ShivaExtensions.hs +5/−6
- src/Graphics/Rendering/OpenVG/VG/Utils.hs +3/−5
- src/Graphics/Rendering/OpenVG/VGU/CInternals.hsc +0/−115
- src/Graphics/Rendering/OpenVG/VGU/ErrorsInternal.hs +3/−4
- src/Graphics/Rendering/OpenVG/VGU/VGU.hs +6/−3
Changes view
@@ -1,4 +1,7 @@ +version 0.5.0 (16 Jan 2010):+ * Split into 2 packages OpenVG (this package) and OpenVGRaw.+ version 0.4.0 (13 Dec 2009): * LinearGradient type changed to be Vector4 VGfloat. @@ -24,7 +27,8 @@ version 0.3.0 (10 Dec 2009): * Changes to use the split OpenGL packages - * Added type coercions for the Size data type (these might not be ideal).+ * Added type coercions for the Size data type (these + might not be ideal). version 0.2.1 (10 Dec 2009):
OpenVG.cabal view
@@ -1,5 +1,5 @@ name: OpenVG-version: 0.4.0+version: 0.5.0 license: BSD3 license-file: LICENSE copyright: Stephen Tetley <stephen.tetley@gmail.com>@@ -11,18 +11,19 @@ A Haskell binding for the OpenVG vector graphics API version 1.0.1, specifically the ShivaVG-0.2.1 implementation. .- This version (0.4.0) is NOT compatible with the Haskell Platform + This version (0.5.0) is NOT compatible with the Haskell Platform (2009.2.0.2) - it uses the split OpenGL packages (RAW, StateVar, etc.). .- \*\* WARNING - the module @Graphics.Rendering.OpenVG.VG.Paths@ - seems flawed in hindsight, as it ammalgamates the OpenVG - @VGPathSegment@ and @VGPathCommand@ data types into one Haskell - type. The binding is thus likely to change in the next major - revision in what is perhaps the worst place. \*\*.+ \*\* WARNING - major changes to previous version. Also + significant changes likely in next revision. \*\*. . Changelog+ 0.4.0 to 0.5.0+ . + * Significantly reworked. Changed to use OpenVGRaw. .+ . 0.3.0 to 0.4.0 . * LinearGradient type changed to be Vector4 VGfloat.@@ -54,8 +55,8 @@ InstallWindows.txt, Changes, README.txt,- examples/TestUtils.hs,- examples/TestVgu.hs+ demo/VguUtils.hs,+ demo/TestVgu.hs library hs-source-dirs: src@@ -64,16 +65,13 @@ GLUT >= 2.2 && < 2.3, OpenGLRaw >= 1.1.0.1 && < 2, StateVar >= 1.0.0.0 && < 2,- Tensor >= 1.0.0.1 && < 2-+ Tensor >= 1.0.0.1 && < 2,+ OpenVGRaw >= 0.1.0 exposed-modules: Graphics.Rendering.OpenVG,- Graphics.Rendering.OpenVG.Util.Colors,- Graphics.Rendering.OpenVG.Util.PathCommands, Graphics.Rendering.OpenVG.VG, Graphics.Rendering.OpenVG.VGU,- Graphics.Rendering.OpenVG.VG.BasicTypes, Graphics.Rendering.OpenVG.VG.Blending, Graphics.Rendering.OpenVG.VG.DrawingContext, Graphics.Rendering.OpenVG.VG.Extending,@@ -87,14 +85,10 @@ Graphics.Rendering.OpenVG.VGU.VGU other-modules:- Graphics.Rendering.OpenVG.VG.Constants, Graphics.Rendering.OpenVG.VG.Utils,- Graphics.Rendering.OpenVG.VG.CFunDecls,- Graphics.Rendering.OpenVG.VGU.CInternals, Graphics.Rendering.OpenVG.VGU.ErrorsInternal extensions:- ForeignFunctionInterface, TypeSynonymInstances, CPP ghc-options: -Wall
+ demo/TestVgu.hs view
@@ -0,0 +1,129 @@+{-# OPTIONS -Wall #-} + +-------------------------------------------------------------------------------- +-- | +-- Module : TestVgu +-- Copyright : (c) Stephen Tetley 2008 +-- License : LGPL - this is a direct translation of Ivan Leben's code +-- (test_vgu.c) so its LGPL +-- +-- Maintainer : Stephen Tetley <stephen.tetley@gmail.com> +-- Stability : highly unstable +-- Portability : GHC +-- +-- Haskell translation of test_vgu from the shivavg examples +-- + +-------------------------------------------------------------------------------- + +-- On Windows copy `openvg32.dll` and `glut32.dll` into this directory, +-- then under MinGW/Msys cd to this directory and run this at the prompt: +-- MinGW> runhaskell.exe -lopenvg32 TestVgu.hs + +-- You can run through GHCi, but closing the display window kills the +-- GHCi session. + +-- On MacOSX runhaskell won't work, a blank window is printed and the +-- shell effectively freezes. You will have to do a compile to see the demo: +-- shell> ghc --make -lopenvg TestVgu.hs +-- the run the compiled app. + +-- GHCi does not work either. + + +module Main where + +import VguUtils + +import Graphics.Rendering.OpenVG ( + ArcType(..), line, polygon, roundRect, ellipse, arc, + destroyContextSH ) +import qualified Graphics.Rendering.OpenVG as VG + + +import Graphics.Rendering.OpenVG.Raw.VG.Core101 ( VGfloat, VGPath ) + +import Graphics.UI.GLUT + +import Control.Monad ( zipWithM_ ) + + +display :: [VGPath] -> IO () +display primitives = do + VG.clearColor $= white + sz <- get $ windowSize + pos <- get $ windowPosition + VG.clear pos sz + VG.matrixMode $= VG.PathUserToSurface + + zipWithM_ fn primitives coords + putStrLn "display - flush..." + swapBuffers + where + white :: Color4 GLfloat + white = Color4 1.0 1.0 1.0 1.0 + + coords = [(x,y) | y <- [0..2], x <- [0..2] ] + + fn :: VGPath -> (VGfloat, VGfloat) -> IO () + fn a (x,y) = do + VG.loadIdentity + VG.translate (100 + x*150) (100 + y*150) + VG.drawPath a [VG.StrokePath] + +points :: [VGfloat] +points = [(-30),(-30), 30,(-30), 0,30] + +createPrimitives :: IO [VGPath] +createPrimitives = do + line1 <- testCreatePath + line line1 (-30.0) (-30.0) 30.0 30.0 + + poly_open <- testCreatePath + polygon poly_open points True + + poly_closed <- testCreatePath + polygon poly_closed points False + + rect1 <- testCreatePath + VG.rect rect1 (-50) (-30) 100 60 + + rect_round <- testCreatePath + roundRect rect_round (-50) (-30) 100 60 30 30 + + ellipse1 <- testCreatePath + ellipse ellipse1 0 0 100 60 + + arc_open <- testCreatePath + arc arc_open 0 0 100 60 0 270 ArcOpen + + arc_chord <- testCreatePath + arc arc_chord 0 0 100 60 0 270 ArcChord + + arc_pie <- testCreatePath + arc arc_pie 0 0 100 60 0 270 ArcPie + + return [ line1, poly_open, poly_closed + , rect1, rect_round, ellipse1 + , arc_open, arc_chord, arc_pie + ] + + + +main :: IO () +main = do + win <- testInit (Position 0 0) (Size 500 500) title + prims <- createPrimitives + displayCallback $= display prims + mainLoop + + -- end + testDestoryPaths prims + destroyContextSH + destroyWindow win + + where + title = "Haskell OpenVG: VGU Primitives test" + +-- testDisplay :: IO () +
+ demo/VguUtils.hs view
@@ -0,0 +1,77 @@+{-# OPTIONS -Wall #-} + +-------------------------------------------------------------------------------- +-- | +-- Module : VguUtils +-- Copyright : (c) Stephen Tetley 2008 +-- License : LGPL - this is a direct translation of Ivan Leben's code +-- (test.c) so its LGPL. +-- +-- Maintainer : Stephen Tetley <stephen.tetley@gmail.com> +-- Stability : highly unstable +-- Portability : GHC +-- +-- Helper functions +-- +-------------------------------------------------------------------------------- + + +module VguUtils ( + testCreatePath, + testDestoryPaths, + + testDrawString, + testInit +) where + +import Graphics.Rendering.OpenVG hiding ( + loadIdentity, lineWidth, scale, translate, matrixMode ) +import qualified Graphics.Rendering.OpenVG as VG + +import Graphics.Rendering.OpenVG.Raw.VG.Core101 ( VGPath ) + +import Graphics.UI.GLUT + + +testCreatePath :: IO VGPath +testCreatePath = createPath VG.Float 1.0 0.0 0 0 [CapabilityAll] + +testDestoryPaths :: [VGPath] -> IO () +testDestoryPaths = mapM_ destroyPath + + +testDrawString :: GLfloat -> GLfloat -> String -> IO () +testDrawString x y test_string = do + + blend $= Enabled + blendFunc $= (SrcAlpha, OneMinusSrcAlpha) + lineSmooth $= Enabled + multisample $= Disabled + + matrixMode $= (Modelview 0) -- eh? + preservingMatrix $ do + loadIdentity + translate (Vector3 (x+0.5) (y+0.5) 0) + scale k k k + lineWidth $= 1.0 + renderString Roman test_string + + lineSmooth $= Disabled + where + k :: GLfloat + k = 0.15 + +testInit :: Position -> Size -> String -> IO Window +testInit xy sz title = do + (_progName, _args) <- getArgsAndInitialize + initialDisplayMode $= [ RGBAMode, DoubleBuffered, WithAlphaComponent, + WithStencilBuffer, Multisampling ] + initialWindowSize $= sz + initialWindowPosition $= xy + win <- createWindow title + -- ... + okb <- VG.createContextSH $ sz + if okb then putStrLn "testInit - okay" else error "testInit - failed" + return win + +
− examples/TestUtils.hs
@@ -1,73 +0,0 @@-{-# OPTIONS -Wall #-} - --------------------------------------------------------------------------------- --- | --- Module : TestUtils --- Copyright : (c) Stephen Tetley 2008 --- License : LGPL - this is a direct translation of Ivan Leben's code --- (test.c) so its LGPL. --- --- Maintainer : Stephen Tetley <stephen.tetley@gmail.com> --- Stability : highly unstable --- Portability : GHC --- --- Helper functions --- --------------------------------------------------------------------------------- - - -module TestUtils ( - testCreatePath, - testDestoryPaths, - - testDrawString, - testInit -) where - -import Graphics.Rendering.OpenVG hiding ( - loadIdentity, lineWidth, scale, translate, matrixMode ) -import qualified Graphics.Rendering.OpenVG as VG -import Graphics.UI.GLUT - -testCreatePath :: IO VGPath -testCreatePath = createPath VG.Float 1.0 0.0 0 0 [CapabilityAll] - -testDestoryPaths :: [VGPath] -> IO () -testDestoryPaths = mapM_ destroyPath - - -testDrawString :: GLfloat -> GLfloat -> String -> IO () -testDrawString x y test_string = do - - blend $= Enabled - blendFunc $= (SrcAlpha, OneMinusSrcAlpha) - lineSmooth $= Enabled - multisample $= Disabled - - matrixMode $= (Modelview 0) -- eh? - preservingMatrix $ do - loadIdentity - translate (Vector3 (x+0.5) (y+0.5) 0) - scale k k k - lineWidth $= 1.0 - renderString Roman test_string - - lineSmooth $= Disabled - where - k :: GLfloat - k = 0.15 - -testInit :: Position -> Size -> String -> IO Window -testInit xy sz title = do - (_progName, _args) <- getArgsAndInitialize - initialDisplayMode $= [ RGBAMode, DoubleBuffered, WithAlphaComponent, - WithStencilBuffer, Multisampling ] - initialWindowSize $= sz - initialWindowPosition $= xy - win <- createWindow title - -- ... - okb <- VG.createContextSH $ sz - if okb then putStrLn "testInit - okay" else error "testInit - failed" - return win - -
− examples/TestVgu.hs
@@ -1,127 +0,0 @@-{-# OPTIONS -Wall #-} - --------------------------------------------------------------------------------- --- | --- Module : TestVgu --- Copyright : (c) Stephen Tetley 2008 --- License : LGPL - this is a direct translation of Ivan Leben's code --- (test_vgu.c) so its LGPL --- --- Maintainer : Stephen Tetley <stephen.tetley@gmail.com> --- Stability : highly unstable --- Portability : GHC --- --- Haskell translation of test_vgu from the shivavg examples --- - --------------------------------------------------------------------------------- - --- On Windows copy `openvg32.dll` and `glut32.dll` into this directory, --- then under MinGW/Msys cd to this directory and run this at the prompt: --- MinGW> runhaskell.exe -lopenvg32 TestVgu.hs - --- You can run through GHCi, but closing the display window kills the --- GHCi session. - --- On MacOSX runhaskell won't work, a blank window is printed and the --- shell effectively freezes. You will have to do a compile to see the demo: --- shell> ghc --make -lopenvg TestVgu.hs --- the run the compiled app. - --- GHCi does not work either. - - -module Main where - -import TestUtils - -import Graphics.Rendering.OpenVG ( - VGPath, VGfloat, - ArcType(..), line, polygon, roundRect, ellipse, arc, - destroyContextSH ) -import qualified Graphics.Rendering.OpenVG as VG -import Graphics.UI.GLUT - -import Control.Monad ( zipWithM_ ) - - -display :: [VGPath] -> IO () -display primitives = do - VG.clearColor $= white - sz <- get $ windowSize - pos <- get $ windowPosition - VG.clear pos sz - VG.matrixMode $= VG.PathUserToSurface - - zipWithM_ fn primitives coords - putStrLn "display - flush..." - swapBuffers - where - white :: Color4 GLfloat - white = Color4 1.0 1.0 1.0 1.0 - - coords = [(x,y) | y <- [0..2], x <- [0..2] ] - - fn :: VGPath -> (VGfloat, VGfloat) -> IO () - fn a (x,y) = do - VG.loadIdentity - VG.translate (100 + x*150) (100 + y*150) - VG.drawPath a [VG.StrokePath] - -points :: [VGfloat] -points = [(-30),(-30), 30,(-30), 0,30] - -createPrimitives :: IO [VGPath] -createPrimitives = do - line1 <- testCreatePath - line line1 (-30.0) (-30.0) 30.0 30.0 - - poly_open <- testCreatePath - polygon poly_open points True - - poly_closed <- testCreatePath - polygon poly_closed points False - - rect1 <- testCreatePath - VG.rect rect1 (-50) (-30) 100 60 - - rect_round <- testCreatePath - roundRect rect_round (-50) (-30) 100 60 30 30 - - ellipse1 <- testCreatePath - ellipse ellipse1 0 0 100 60 - - arc_open <- testCreatePath - arc arc_open 0 0 100 60 0 270 ArcOpen - - arc_chord <- testCreatePath - arc arc_chord 0 0 100 60 0 270 ArcChord - - arc_pie <- testCreatePath - arc arc_pie 0 0 100 60 0 270 ArcPie - - return [ line1, poly_open, poly_closed - , rect1, rect_round, ellipse1 - , arc_open, arc_chord, arc_pie - ] - - - -main :: IO () -main = do - win <- testInit (Position 0 0) (Size 500 500) title - prims <- createPrimitives - displayCallback $= display prims - mainLoop - - -- end - testDestoryPaths prims - destroyContextSH - destroyWindow win - - where - title = "Haskell OpenVG: VGU Primitives test" - --- testDisplay :: IO () - -
− src/Graphics/Rendering/OpenVG/Util/Colors.hs
@@ -1,633 +0,0 @@-{-# OPTIONS -Wall #-}------------------------------------------------------------------------------------- |--- Module : Graphics.Rendering.OpenVG.Util.Colors--- Copyright : (c) Stephen Tetley 2009--- License : BSD3------ Maintainer : Stephen Tetley <stephen.tetley@gmail.com>--- Stability : deprecated--- Portability : GHC------ \*\* This module is deprecated \*\*--- --- Colour definitions named with the SVG \'named colours\'.--- --- If this module is /useful/ it would be better off outside the --- OpenVG bindings package and presented in some /higher-level/ --- package.-----------------------------------------------------------------------------------------module Graphics.Rendering.OpenVG.Util.Colors (- -- * Named colours- aliceblue, - antiquewhite,- aqua,- aquamarine,- azure,- beige,- bisque,- black,- blanchedalmond,- blue,- blueviolet,- brown,- burlywood,- cadetblue,- chartreuse,- chocolate,- coral,- cornflowerblue,- cornsilk,- crimson,- cyan,- darkblue,- darkcyan,- darkgoldenrod,- darkgray,- darkgreen,- darkgrey,- darkkhaki,- darkmagenta,- darkolivegreen,- darkorange,- darkorchid,- darkred,- darksalmon,- darkseagreen,- darkslateblue,- darkslategray,- darkslategrey,- darkturquoise,- darkviolet,- deeppink,- deepskyblue,- dimgray,- dimgrey,- dodgerblue,- firebrick,- floralwhite,- forestgreen,- fuchsia,- gainsboro,- ghostwhite,- gold,- goldenrod,- gray,- grey,- green,- greenyellow,- honeydew,- hotpink,- indianred,- indigo,- ivory,- khaki,- lavender,- lavenderblush,- lawngreen,- lemonchiffon,- lightblue,- lightcoral,- lightcyan,- lightgoldenrodyellow,- lightgray,- lightgreen,- lightgrey,- lightpink,- lightsalmon,- lightseagreen,- lightskyblue,- lightslategray,- lightslategrey,- lightsteelblue,- lightyellow,- lime,- limegreen,- linen,- magenta,- maroon,- mediumaquamarine,- mediumblue,- mediumorchid,- mediumpurple,- mediumseagreen,- mediumslateblue,- mediumspringgreen,- mediumturquoise,- mediumvioletred,- midnightblue,- mintcream,- mistyrose,- moccasin,- navajowhite,- navy,- oldlace,- olive,- olivedrab,- orange,- orangered,- orchid,- palegoldenrod,- palegreen,- paleturquoise,- palevioletred,- papayawhip,- peachpuff,- peru,- pink,- plum,- powderblue,- purple,- red,- rosybrown,- royalblue,- saddlebrown,- salmon,- sandybrown,- seagreen,- seashell,- sienna,- silver,- skyblue,- slateblue,- slategray,- slategrey,- snow,- springgreen,- steelblue,- tan,- teal,- thistle,- tomato,- turquoise,- violet,- wheat,- white,- whitesmoke,- yellow,- yellowgreen-) where--import Graphics.Rendering.OpenGL.GL ( - Color4(..), Color3(..), GLfloat )--import Prelude hiding ( tan )--class RGB t where rgb :: GLfloat -> GLfloat -> GLfloat -> t GLfloat--instance RGB Color4 where- rgb r g b = Color4 (r / 255.0) (g / 255.0) (b / 255.0) 1.0--instance RGB Color3 where- rgb r g b = Color3 (r / 255.0) (g / 255.0) (b / 255.0)- - -aliceblue :: RGB c => c GLfloat-aliceblue = rgb 240 248 255--antiquewhite :: RGB c => c GLfloat-antiquewhite = rgb 250 235 215--aqua :: RGB c => c GLfloat-aqua = rgb 0 255 255--aquamarine :: RGB c => c GLfloat-aquamarine = rgb 127 255 212--azure :: RGB c => c GLfloat-azure = rgb 240 255 255--beige :: RGB c => c GLfloat -beige = rgb 245 245 220--bisque :: RGB c => c GLfloat-bisque = rgb 255 228 196--black :: RGB c => c GLfloat-black = rgb 0 0 0--blanchedalmond :: RGB c => c GLfloat-blanchedalmond = rgb 255 235 205--blue :: RGB c => c GLfloat-blue = rgb 0 0 255--blueviolet :: RGB c => c GLfloat-blueviolet = rgb 138 43 226--brown :: RGB c => c GLfloat-brown = rgb 165 42 42--burlywood :: RGB c => c GLfloat-burlywood = rgb 222 184 135--cadetblue :: RGB c => c GLfloat-cadetblue = rgb 95 158 160--chartreuse :: RGB c => c GLfloat-chartreuse = rgb 127 255 0--chocolate :: RGB c => c GLfloat-chocolate = rgb 210 105 30--coral :: RGB c => c GLfloat-coral = rgb 255 127 80--cornflowerblue :: RGB c => c GLfloat-cornflowerblue = rgb 100 149 237--cornsilk :: RGB c => c GLfloat-cornsilk = rgb 255 248 220--crimson :: RGB c => c GLfloat-crimson = rgb 220 20 60--cyan :: RGB c => c GLfloat-cyan = rgb 0 255 255--darkblue :: RGB c => c GLfloat-darkblue = rgb 0 0 139--darkcyan :: RGB c => c GLfloat-darkcyan = rgb 0 139 139--darkgoldenrod :: RGB c => c GLfloat-darkgoldenrod = rgb 184 134 11--darkgray :: RGB c => c GLfloat-darkgray = rgb 169 169 169--darkgreen :: RGB c => c GLfloat-darkgreen = rgb 0 100 0--darkgrey :: RGB c => c GLfloat-darkgrey = rgb 169 169 169--darkkhaki :: RGB c => c GLfloat-darkkhaki = rgb 189 183 107--darkmagenta :: RGB c => c GLfloat-darkmagenta = rgb 139 0 139--darkolivegreen :: RGB c => c GLfloat-darkolivegreen = rgb 85 107 47--darkorange :: RGB c => c GLfloat-darkorange = rgb 255 140 0--darkorchid :: RGB c => c GLfloat-darkorchid = rgb 153 50 204--darkred :: RGB c => c GLfloat-darkred = rgb 139 0 0--darksalmon :: RGB c => c GLfloat-darksalmon = rgb 233 150 122--darkseagreen :: RGB c => c GLfloat-darkseagreen = rgb 143 188 143--darkslateblue :: RGB c => c GLfloat-darkslateblue = rgb 72 61 139--darkslategray :: RGB c => c GLfloat-darkslategray = rgb 47 79 79--darkslategrey :: RGB c => c GLfloat-darkslategrey = rgb 47 79 79--darkturquoise :: RGB c => c GLfloat-darkturquoise = rgb 0 206 209--darkviolet :: RGB c => c GLfloat-darkviolet = rgb 148 0 211--deeppink :: RGB c => c GLfloat-deeppink = rgb 255 20 147--deepskyblue :: RGB c => c GLfloat-deepskyblue = rgb 0 191 255--dimgray :: RGB c => c GLfloat-dimgray = rgb 105 105 105--dimgrey :: RGB c => c GLfloat-dimgrey = rgb 105 105 105--dodgerblue :: RGB c => c GLfloat-dodgerblue = rgb 30 144 255--firebrick :: RGB c => c GLfloat-firebrick = rgb 178 34 34--floralwhite :: RGB c => c GLfloat-floralwhite = rgb 255 250 240--forestgreen :: RGB c => c GLfloat-forestgreen = rgb 34 139 34--fuchsia :: RGB c => c GLfloat-fuchsia = rgb 255 0 255--gainsboro :: RGB c => c GLfloat-gainsboro = rgb 220 220 220--ghostwhite :: RGB c => c GLfloat-ghostwhite = rgb 248 248 255--gold :: RGB c => c GLfloat-gold = rgb 255 215 0--goldenrod :: RGB c => c GLfloat-goldenrod = rgb 218 165 32--gray :: RGB c => c GLfloat-gray = rgb 128 128 128--grey :: RGB c => c GLfloat-grey = rgb 128 128 128--green :: RGB c => c GLfloat-green = rgb 0 128 0--greenyellow :: RGB c => c GLfloat-greenyellow = rgb 173 255 47--honeydew :: RGB c => c GLfloat-honeydew = rgb 240 255 240--hotpink :: RGB c => c GLfloat-hotpink = rgb 255 105 180--indianred :: RGB c => c GLfloat-indianred = rgb 205 92 92--indigo :: RGB c => c GLfloat-indigo = rgb 75 0 130--ivory :: RGB c => c GLfloat-ivory = rgb 255 255 240--khaki :: RGB c => c GLfloat-khaki = rgb 240 230 140--lavender :: RGB c => c GLfloat-lavender = rgb 230 230 250--lavenderblush :: RGB c => c GLfloat-lavenderblush = rgb 255 240 245--lawngreen :: RGB c => c GLfloat-lawngreen = rgb 124 252 0--lemonchiffon :: RGB c => c GLfloat-lemonchiffon = rgb 255 250 205--lightblue :: RGB c => c GLfloat-lightblue = rgb 173 216 230--lightcoral :: RGB c => c GLfloat-lightcoral = rgb 240 128 128--lightcyan :: RGB c => c GLfloat-lightcyan = rgb 224 255 255--lightgoldenrodyellow :: RGB c => c GLfloat-lightgoldenrodyellow = rgb 250 250 210--lightgray :: RGB c => c GLfloat-lightgray = rgb 211 211 211--lightgreen :: RGB c => c GLfloat-lightgreen = rgb 144 238 144--lightgrey :: RGB c => c GLfloat-lightgrey = rgb 211 211 211--lightpink :: RGB c => c GLfloat-lightpink = rgb 255 182 193--lightsalmon :: RGB c => c GLfloat-lightsalmon = rgb 255 160 122--lightseagreen :: RGB c => c GLfloat-lightseagreen = rgb 32 178 170--lightskyblue :: RGB c => c GLfloat-lightskyblue = rgb 135 206 250--lightslategray :: RGB c => c GLfloat-lightslategray = rgb 119 136 153--lightslategrey :: RGB c => c GLfloat-lightslategrey = rgb 119 136 153--lightsteelblue :: RGB c => c GLfloat-lightsteelblue = rgb 176 196 222--lightyellow :: RGB c => c GLfloat-lightyellow = rgb 255 255 224--lime :: RGB c => c GLfloat-lime = rgb 0 255 0--limegreen :: RGB c => c GLfloat-limegreen = rgb 50 205 50--linen :: RGB c => c GLfloat-linen = rgb 250 240 230--magenta :: RGB c => c GLfloat-magenta = rgb 255 0 255--maroon :: RGB c => c GLfloat-maroon = rgb 128 0 0--mediumaquamarine :: RGB c => c GLfloat-mediumaquamarine = rgb 102 205 170--mediumblue :: RGB c => c GLfloat-mediumblue = rgb 0 0 205--mediumorchid :: RGB c => c GLfloat-mediumorchid = rgb 186 85 211--mediumpurple :: RGB c => c GLfloat-mediumpurple = rgb 147 112 219--mediumseagreen :: RGB c => c GLfloat-mediumseagreen = rgb 60 179 113--mediumslateblue :: RGB c => c GLfloat-mediumslateblue = rgb 123 104 238--mediumspringgreen :: RGB c => c GLfloat-mediumspringgreen = rgb 0 250 154--mediumturquoise :: RGB c => c GLfloat-mediumturquoise = rgb 72 209 204--mediumvioletred :: RGB c => c GLfloat-mediumvioletred = rgb 199 21 133--midnightblue :: RGB c => c GLfloat-midnightblue = rgb 25 25 112--mintcream :: RGB c => c GLfloat-mintcream = rgb 245 255 250--mistyrose :: RGB c => c GLfloat-mistyrose = rgb 255 228 225--moccasin :: RGB c => c GLfloat-moccasin = rgb 255 228 181--navajowhite :: RGB c => c GLfloat-navajowhite = rgb 255 222 173--navy :: RGB c => c GLfloat-navy = rgb 0 0 128--oldlace :: RGB c => c GLfloat-oldlace = rgb 253 245 230--olive :: RGB c => c GLfloat-olive = rgb 128 128 0--olivedrab :: RGB c => c GLfloat-olivedrab = rgb 107 142 35--orange :: RGB c => c GLfloat-orange = rgb 255 165 0--orangered :: RGB c => c GLfloat-orangered = rgb 255 69 0--orchid :: RGB c => c GLfloat-orchid = rgb 218 112 214--palegoldenrod :: RGB c => c GLfloat-palegoldenrod = rgb 238 232 170--palegreen :: RGB c => c GLfloat-palegreen = rgb 152 251 152--paleturquoise :: RGB c => c GLfloat-paleturquoise = rgb 175 238 238--palevioletred :: RGB c => c GLfloat-palevioletred = rgb 219 112 147--papayawhip :: RGB c => c GLfloat-papayawhip = rgb 255 239 213--peachpuff :: RGB c => c GLfloat-peachpuff = rgb 255 218 185--peru :: RGB c => c GLfloat-peru = rgb 205 133 63--pink :: RGB c => c GLfloat-pink = rgb 255 192 203--plum :: RGB c => c GLfloat-plum = rgb 221 160 221--powderblue :: RGB c => c GLfloat-powderblue = rgb 176 224 230--purple :: RGB c => c GLfloat-purple = rgb 128 0 128--red :: RGB c => c GLfloat-red = rgb 255 0 0--rosybrown :: RGB c => c GLfloat-rosybrown = rgb 188 143 143--royalblue :: RGB c => c GLfloat-royalblue = rgb 65 105 225--saddlebrown :: RGB c => c GLfloat-saddlebrown = rgb 139 69 19--salmon :: RGB c => c GLfloat-salmon = rgb 250 128 114--sandybrown :: RGB c => c GLfloat-sandybrown = rgb 244 164 96--seagreen :: RGB c => c GLfloat-seagreen = rgb 46 139 87--seashell :: RGB c => c GLfloat-seashell = rgb 255 245 238--sienna :: RGB c => c GLfloat-sienna = rgb 160 82 45--silver :: RGB c => c GLfloat-silver = rgb 192 192 192--skyblue :: RGB c => c GLfloat-skyblue = rgb 135 206 235--slateblue :: RGB c => c GLfloat-slateblue = rgb 106 90 205--slategray :: RGB c => c GLfloat-slategray = rgb 112 128 144--slategrey :: RGB c => c GLfloat-slategrey = rgb 112 128 144--snow :: RGB c => c GLfloat-snow = rgb 255 250 250--springgreen :: RGB c => c GLfloat-springgreen = rgb 0 255 127--steelblue :: RGB c => c GLfloat-steelblue = rgb 70 130 180--tan :: RGB c => c GLfloat-tan = rgb 210 180 140--teal :: RGB c => c GLfloat-teal = rgb 0 128 128--thistle :: RGB c => c GLfloat-thistle = rgb 216 191 216--tomato :: RGB c => c GLfloat-tomato = rgb 255 99 71--turquoise :: RGB c => c GLfloat-turquoise = rgb 64 224 208--violet :: RGB c => c GLfloat-violet = rgb 238 130 238--wheat :: RGB c => c GLfloat-wheat = rgb 245 222 179--white :: RGB c => c GLfloat-white = rgb 255 255 255--whitesmoke :: RGB c => c GLfloat-whitesmoke = rgb 245 245 245--yellow :: RGB c => c GLfloat-yellow = rgb 255 255 0--yellowgreen :: RGB c => c GLfloat-yellowgreen = rgb 154 205 50-----
− src/Graphics/Rendering/OpenVG/Util/PathCommands.hs
@@ -1,182 +0,0 @@-{-# OPTIONS -Wall #-}------------------------------------------------------------------------------------- |--- Module : Graphics.Rendering.OpenVG.Util.PathCommands--- Copyright : (c) Stephen Tetley 2009--- License : BSD3------ Maintainer : Stephen Tetley <stephen.tetley@gmail.com>--- Stability : deprecated--- Portability : GHC--------- \*\* This module is deprecated \*\*------ Path Segment shorthand commands patterned after section 8.5.2.------ This module is needs more thought - currently it is a sketch --- to help create paths. If it becomes useful in the future it --- is still be better off outside the OpenVG bindings package --- and presented in some higher-level package.---------------------------------------------------------------------------------------module Graphics.Rendering.OpenVG.Util.PathCommands (- -- * Translate Path Commands- pathData,- - -- * Path commands- closePath,- moveAbs, moveRel,- lineAbs, lineRel,- hlineAbs, hlineRel,- vlineAbs, vlineRel,- quadraticAbs, quadraticRel,- cubicAbs, cubicRel,- smoothQuadAbs, smoothQuadRel,- smoothCubicAbs, smoothCubicRel,- smallCcwArcAbs, smallCcwArcRel,- smallCwArcAbs, smallCwArcRel,- largeCcwArcAbs, largeCcwArcRel,- largeCwArcAbs, largeCwArcRel,- - -) where--import Graphics.Rendering.OpenVG.VG.Paths--data SegmentCommand a = - CLOSE_PATH- | MOVE_TO PathAbsRel a a- | LINE_TO PathAbsRel a a- | HLINE_TO PathAbsRel a- | VLINE_TO PathAbsRel a- | QUAD_TO PathAbsRel a a a a- | CUBIC_TO PathAbsRel a a a a a a- | SQUAD_TO PathAbsRel a a- | SCUBIC_TO PathAbsRel a a a a- | SCCWARC_TO PathAbsRel a a a a a- | SCWARC_TO PathAbsRel a a a a a- | LCCWARC_TO PathAbsRel a a a a a- | LCWARC_TO PathAbsRel a a a a a- deriving ( Eq, Show )--pathData :: StorablePathData a => [SegmentCommand a] -> ([PathCommand], [a])-pathData = foldr fn ([],[]) where- fn :: SegmentCommand a -> ([PathCommand], [a]) -> ([PathCommand], [a])- fn CLOSE_PATH (xs,ys) = (ClosePath:xs,ys) - fn (MOVE_TO t x y) (xs,ys) - | t == Absolute = (MoveToAbs : xs, x:y:ys)- | otherwise = (MoveToRel : xs, x:y:ys)- fn (LINE_TO t x y) (xs,ys) - | t == Absolute = (LineToAbs : xs, x:y:ys)- | otherwise = (LineToRel : xs, x:y:ys)- fn (HLINE_TO t x) (xs,ys)- | t == Absolute = (HLineToAbs : xs, x:ys)- | otherwise = (HLineToRel : xs, x:ys)- fn (VLINE_TO t y) (xs,ys)- | t == Absolute = (VLineToAbs : xs, y:ys)- | otherwise = (VLineToRel : xs, y:ys)- fn (QUAD_TO t x y x' y') (xs,ys)- | t == Absolute = (QuadToAbs : xs, x:y:x':y':ys)- | otherwise = (QuadToRel : xs, x:y:x':y':ys)- fn (CUBIC_TO t x y x' y' x'' y'') (xs,ys)- | t == Absolute = (CubicToAbs : xs, x:y:x':y':x'':y'':ys)- | otherwise = (CubicToRel : xs, x:y:x':y':x'':y'':ys)- fn (SQUAD_TO t x y) (xs,ys)- | t == Absolute = (SQuadToAbs : xs, x:y:ys)- | otherwise = (SQuadToRel : xs, x:y:ys)- fn (SCUBIC_TO t x y x' y') (xs,ys)- | t == Absolute = (SCubicToAbs : xs, x:y:x':y':ys)- | otherwise = (SCubicToRel : xs, x:y:x':y':ys)- fn (SCCWARC_TO t rh rv rt x y) (xs,ys)- | t == Absolute = (SCCWArcToAbs : xs, rh:rv:rt:x:y:ys)- | otherwise = (SCCWArcToRel : xs, rh:rv:rt:x:y:ys)- fn (SCWARC_TO t rh rv rt x y) (xs,ys)- | t == Absolute = (SCWArcToAbs : xs, rh:rv:rt:x:y:ys)- | otherwise = (SCWArcToRel : xs, rh:rv:rt:x:y:ys)- fn (LCCWARC_TO t rh rv rt x y) (xs,ys)- | t == Absolute = (LCCWArcToAbs : xs, rh:rv:rt:x:y:ys)- | otherwise = (LCCWArcToRel : xs, rh:rv:rt:x:y:ys)- fn (LCWARC_TO t rh rv rt x y) (xs,ys)- | t == Absolute = (LCWArcToAbs : xs, rh:rv:rt:x:y:ys)- | otherwise = (LCWArcToRel : xs, rh:rv:rt:x:y:ys)---closePath :: SegmentCommand a-closePath = CLOSE_PATH--moveAbs :: StorablePathData a => a -> a -> SegmentCommand a-moveAbs = MOVE_TO Absolute --moveRel :: StorablePathData a => a -> a -> SegmentCommand a-moveRel = MOVE_TO Relative --lineAbs :: StorablePathData a => a -> a -> SegmentCommand a-lineAbs = LINE_TO Absolute --lineRel :: StorablePathData a => a -> a -> SegmentCommand a-lineRel = LINE_TO Relative --hlineAbs :: StorablePathData a => a -> SegmentCommand a-hlineAbs = VLINE_TO Absolute --hlineRel :: StorablePathData a => a -> SegmentCommand a-hlineRel = HLINE_TO Relative --vlineAbs :: StorablePathData a => a -> SegmentCommand a-vlineAbs = VLINE_TO Absolute --vlineRel :: StorablePathData a => a -> SegmentCommand a-vlineRel = VLINE_TO Relative --quadraticAbs :: StorablePathData a => a -> a -> a -> a -> SegmentCommand a-quadraticAbs = QUAD_TO Absolute--quadraticRel :: StorablePathData a => a -> a -> a -> a -> SegmentCommand a-quadraticRel = QUAD_TO Relative--cubicAbs :: StorablePathData a => a -> a -> a -> a -> a -> a -> SegmentCommand a-cubicAbs = CUBIC_TO Absolute--cubicRel :: StorablePathData a => a -> a -> a -> a -> a -> a -> SegmentCommand a-cubicRel = CUBIC_TO Relative--smoothQuadAbs :: StorablePathData a => a -> a -> SegmentCommand a-smoothQuadAbs = SQUAD_TO Absolute--smoothQuadRel :: StorablePathData a => a -> a -> SegmentCommand a-smoothQuadRel = SQUAD_TO Relative--smoothCubicAbs :: StorablePathData a => a -> a -> a -> a -> SegmentCommand a-smoothCubicAbs = SCUBIC_TO Absolute--smoothCubicRel :: StorablePathData a => a -> a -> a -> a -> SegmentCommand a-smoothCubicRel = SCUBIC_TO Relative--smallCcwArcAbs :: StorablePathData a => a -> a -> a -> a -> a -> SegmentCommand a-smallCcwArcAbs = SCCWARC_TO Absolute--smallCcwArcRel :: StorablePathData a => a -> a -> a -> a -> a -> SegmentCommand a-smallCcwArcRel = SCCWARC_TO Relative--smallCwArcAbs :: StorablePathData a => a -> a -> a -> a -> a -> SegmentCommand a-smallCwArcAbs = SCWARC_TO Absolute--smallCwArcRel :: StorablePathData a => a -> a -> a -> a -> a -> SegmentCommand a-smallCwArcRel = SCWARC_TO Relative--largeCcwArcAbs :: StorablePathData a => a -> a -> a -> a -> a -> SegmentCommand a-largeCcwArcAbs = LCCWARC_TO Absolute--largeCcwArcRel :: StorablePathData a => a -> a -> a -> a -> a -> SegmentCommand a-largeCcwArcRel = LCCWARC_TO Relative--largeCwArcAbs :: StorablePathData a => a -> a -> a -> a -> a -> SegmentCommand a-largeCwArcAbs = LCWARC_TO Absolute--largeCwArcRel :: StorablePathData a => a -> a -> a -> a -> a -> SegmentCommand a-largeCwArcRel = LCWARC_TO Relative-
src/Graphics/Rendering/OpenVG/VG.hs view
@@ -15,7 +15,6 @@ -------------------------------------------------------------------------------- module Graphics.Rendering.OpenVG.VG (- module Graphics.Rendering.OpenVG.VG.BasicTypes, module Graphics.Rendering.OpenVG.VG.Blending, module Graphics.Rendering.OpenVG.VG.DrawingContext, module Graphics.Rendering.OpenVG.VG.Extending,@@ -28,7 +27,6 @@ module Graphics.Rendering.OpenVG.VG.ShivaExtensions ) where -import Graphics.Rendering.OpenVG.VG.BasicTypes import Graphics.Rendering.OpenVG.VG.Blending import Graphics.Rendering.OpenVG.VG.DrawingContext import Graphics.Rendering.OpenVG.VG.Extending
− src/Graphics/Rendering/OpenVG/VG/BasicTypes.hsc
@@ -1,79 +0,0 @@-{-# LANGUAGE CPP #-}-{-# LANGUAGE ForeignFunctionInterface #-}-{-# OPTIONS -Wall #-}------------------------------------------------------------------------------------- |--- Module : Graphics.Rendering.OpenVG.VG.BasicTypes--- Copyright : (c) Stephen Tetley 2008, 2009--- License : BSD3------ Maintainer : Stephen Tetley <stephen.tetley@gmail.com>--- Stability : highly unstable--- Portability : GHC------ This module corresponds to sections 3.2 (Primitive Data Types) --- and 3.6 (Handle-based Data Types) of the OpenVG 1.0.1 specs.--- --------------------------------------------------------------------------------------module Graphics.Rendering.OpenVG.VG.BasicTypes (- -- * Primitive Types- VGbyte, VGubyte, VGshort, VGint, VGuint, VGbitfield, - VGboolean, VGfloat,- VGenum,- - vg_FALSE, vg_TRUE,- - -- * Handle-based Types- VGHandle,- vg_INVALID_HANDLE,- - VGPath, VGImage, VGPaint,- - -- * Points- Point,--) where--#include <vg/openvg.h>--import Graphics.Rendering.OpenGL.Raw.Core31--import Foreign.Ptr--type VGfloat = GLfloat-type VGbyte = GLbyte-type VGubyte = GLubyte-type VGshort = GLshort-type VGint = GLint-type VGuint = GLuint-type VGbitfield = GLbitfield--type VGenum = GLenum ----type VGboolean = GLint--#{enum VGboolean,- , vg_FALSE = VG_FALSE- , vg_TRUE = VG_TRUE- }- -newtype VGHandle = VGHandle (Ptr ())---vg_INVALID_HANDLE :: VGHandle -vg_INVALID_HANDLE = VGHandle nullPtr---type VGPath = VGHandle-type VGImage = VGHandle-type VGPaint = VGHandle---type Point = (VGfloat, VGfloat)--
src/Graphics/Rendering/OpenVG/VG/Blending.hs view
@@ -21,14 +21,10 @@ blendMode ) where -import Graphics.Rendering.OpenVG.VG.BasicTypes ( VGenum )-import Graphics.Rendering.OpenVG.VG.Constants (- vg_BLEND_SRC, vg_BLEND_SRC_OVER, vg_BLEND_DST_OVER, - vg_BLEND_SRC_IN, vg_BLEND_DST_IN, vg_BLEND_MULTIPLY, - vg_BLEND_SCREEN, vg_BLEND_DARKEN, vg_BLEND_LIGHTEN, - vg_BLEND_ADDITIVE ) -import Graphics.Rendering.OpenVG.VG.Parameters ( - seti, ParamType ( BlendMode ) )+import Graphics.Rendering.OpenVG.VG.Parameters++import Graphics.Rendering.OpenVG.Raw.VG.Blending+import Graphics.Rendering.OpenVG.Raw.VG.Core101 ( VGenum ) import Data.StateVar ( SettableStateVar, makeSettableStateVar )
− src/Graphics/Rendering/OpenVG/VG/CFunDecls.hsc
@@ -1,491 +0,0 @@-{-# LANGUAGE CPP #-}-{-# LANGUAGE ForeignFunctionInterface #-}-{-# OPTIONS -Wall #-}------------------------------------------------------------------------------------- |--- Module : Graphics.Rendering.OpenVG.VG.CFunDecls--- Copyright : (c) Stephen Tetley 2008, 2009--- License : BSD3------ Maintainer : Stephen Tetley <stephen.tetley@gmail.com>--- Stability : highly unstable--- Portability : GHC------ Internal module declaring all the foreign declarations of the functions--- defined in <vg/openvg.h>.-----------------------------------------------------------------------------------------module Graphics.Rendering.OpenVG.VG.CFunDecls where--#include <vg/openvg.h>--import Graphics.Rendering.OpenVG.VG.BasicTypes--import Foreign.Ptr ( Ptr )-import Foreign.C.String ( CString )---- 'suffix indicates a marshalled enum type.-type VGErrorCode' = VGenum-type VGHardwareQueryResult' = VGenum-type VGHardwareQueryType' = VGenum-type VGImageChannel' = VGenum-type VGImageFormat' = VGenum-type VGMaskOperation' = VGenum-type VGPaintMode' = VGenum-type VGPathDatatype' = VGenum-type VGStringID' = VGenum-type VGTilingMode' = VGenum---foreign import ccall unsafe "vg/openvg.h vgGetError"- vgGetError :: IO VGErrorCode'----foreign import ccall unsafe "vg/openvg.h vgFlush"- vgFlush :: IO ()--foreign import ccall unsafe "vg/openvg.h vgFinish"- vgFinish :: IO ()----- getters and setters-foreign import ccall unsafe "vg/openvg.h vgSeti"- vgSeti :: VGenum -> VGint -> IO ()--foreign import ccall unsafe "vg/openvg.h vgSetf"- vgSetf :: VGenum -> VGfloat -> IO ()--foreign import ccall unsafe "vg/openvg.h vgSetfv"- vgSetfv :: VGenum -> VGint -> Ptr VGfloat -> IO ()--foreign import ccall unsafe "vg/openvg.h vgSetiv"- vgSetiv :: VGenum -> VGint -> Ptr VGint -> IO ()--foreign import ccall unsafe "vg/openvg.h vgGetf"- vgGetf :: VGenum -> IO VGfloat--foreign import ccall unsafe "vg/openvg.h vgGeti"- vgGeti :: VGenum -> IO VGint--foreign import ccall unsafe "vg/openvg.h vgGetVectorSize"- vgGetVectorSize :: VGenum -> IO VGint--foreign import ccall unsafe "vg/openvg.h vgGetfv"- vgGetfv :: VGenum -> VGint -> IO (Ptr VGfloat)--foreign import ccall unsafe "vg/openvg.h vgGetiv"- vgGetiv :: VGenum -> VGint -> IO (Ptr VGint)--foreign import ccall unsafe "vg/openvg.h vgSetParameterf"- vgSetParameterf :: VGHandle -> VGenum -> VGfloat -> IO ()--foreign import ccall unsafe "vg/openvg.h vgSetParameteri"- vgSetParameteri :: VGHandle -> VGenum -> VGint -> IO ()--foreign import ccall unsafe "vg/openvg.h vgSetParameterfv"- vgSetParameterfv :: VGHandle -> VGenum -> VGint -> Ptr VGfloat -> IO ()--foreign import ccall unsafe "vg/openvg.h vgSetParameteriv"- vgSetParameteriv :: VGHandle -> VGenum -> VGint -> Ptr VGint -> IO ()--foreign import ccall unsafe "vg/openvg.h vgGetParameterf"- vgGetParameterf :: VGHandle -> VGenum -> IO VGfloat--foreign import ccall unsafe "vg/openvg.h vgGetParameteri"- vgGetParameteri :: VGHandle -> VGenum -> IO VGint--foreign import ccall unsafe "vg/openvg.h vgGetParameterVectorSize"- vgGetParameterVectorSize :: VGHandle -> VGenum -> IO VGint--foreign import ccall unsafe "vg/openvg.h vgGetParameterfv"- vgGetParameterfv :: VGHandle -> VGenum -> VGint -> IO (Ptr VGfloat)--foreign import ccall unsafe "vg/openvg.h vgGetParameteriv"- vgGetParameteriv :: VGHandle -> VGenum -> VGint -> IO (Ptr VGint)----- | Matrix Manipulation--- set the current matrix to the identity matrix-foreign import ccall unsafe "vg/openvg.h vgLoadIdentity"- vgLoadIdentity :: IO ()--foreign import ccall unsafe "vg/openvg.h vgLoadMatrix"- vgLoadMatrix :: Ptr VGfloat -> IO ()--foreign import ccall unsafe "vg/openvg.h vgGetMatrix"- vgGetMatrix :: IO (Ptr VGfloat)---- multiple the current matrix by the given matrix-foreign import ccall unsafe "vg/openvg.h vgMultMatrix"- vgMultMatrix :: Ptr VGfloat -> IO ()---foreign import ccall unsafe "vg/openvg.h vgTranslate"- vgTranslate :: VGfloat -> VGfloat -> IO ()--foreign import ccall unsafe "vg/openvg.h vgScale"- vgScale :: VGfloat -> VGfloat -> IO ()--foreign import ccall unsafe "vg/openvg.h vgShear"- vgShear :: VGfloat -> VGfloat -> IO ()--foreign import ccall unsafe "vg/openvg.h vgRotate"- vgRotate :: VGfloat -> IO ()---- | Masking and Clearing---- Stubbed in shivaVG 0.2.1 (not implemented)-foreign import ccall unsafe "vg/openvg.h vgMask"- vgMask :: VGImage -> VGMaskOperation' ->- VGint -> VGint -> VGint -> VGint -> IO ()---foreign import ccall unsafe "vg/openvg.h vgClear"- vgClear :: VGint -> VGint -> VGint -> VGint -> IO ()------ | Paths-foreign import ccall unsafe "vg/openvg.h vgCreatePath"- vgCreatePath :: VGint- -> VGPathDatatype'- -> VGfloat- -> VGfloat- -> VGint- -> VGint- -> VGbitfield- -> IO VGPath----foreign import ccall unsafe "vg/openvg.h vgClearPath"- vgClearPath :: VGPath -> VGbitfield -> IO ()--foreign import ccall unsafe "vg/openvg.h vgDestroyPath"- vgDestroyPath :: VGPath -> IO ()--foreign import ccall unsafe "vg/openvg.h vgRemovePathCapabilities"- vgRemovePathCapabilities :: VGPath -> VGbitfield -> IO ()--foreign import ccall unsafe "vg/openvg.h vgGetPathCapabilities"- vgGetPathCapabilities :: VGPath -> IO VGbitfield--foreign import ccall unsafe "vg/openvg.h vgAppendPath"- vgAppendPath :: VGPath -> VGPath -> IO ()---- append the data in /Ptr a/ to the path handle /VGPath/.-foreign import ccall unsafe "vg/openvg.h vgAppendPathData"- vgAppendPathData :: VGPath -> VGint -> Ptr VGubyte -> Ptr a -> IO ()---foreign import ccall unsafe "vg/openvg.h vgModifyPathCoords"- vgModifyPathCoords :: VGPath -> VGint -> VGint -> Ptr a -> IO ()---foreign import ccall unsafe "vg/openvg.h vgTransformPath"- vgTransformPath :: VGPath -> VGPath -> IO ()---foreign import ccall unsafe "vg/openvg.h vgInterpolatePath"- vgInterpolatePath :: VGPath- -> VGPath- -> VGPath- -> VGfloat- -> IO VGboolean---- Stubbed in shivaVG 0.2.1 (not implemented)-foreign import ccall unsafe "vg/openvg.h vgPathLength"- vgPathLength :: VGPath -> VGint -> VGint -> IO VGfloat------ Stubbed in shivaVG 0.2.1 (not implemented)-foreign import ccall unsafe "vg/openvg.h vgPointAlongPath"- vgPointAlongPath :: VGPath- -> VGint- -> VGint- -> VGfloat- -> Ptr VGfloat- -> Ptr VGfloat- -> Ptr VGfloat- -> Ptr VGfloat- -> IO ()---foreign import ccall unsafe "vg/openvg.h vgPathBounds"- vgPathBounds :: VGPath- -> Ptr VGfloat- -> Ptr VGfloat- -> Ptr VGfloat- -> Ptr VGfloat- -> IO ()---foreign import ccall unsafe "vg/openvg.h vgPathTransformedBounds"- vgPathTransformedBounds :: VGPath- -> Ptr VGfloat- -> Ptr VGfloat- -> Ptr VGfloat- -> Ptr VGfloat- -> IO ()--foreign import ccall unsafe "vg/openvg.h vgDrawPath"- vgDrawPath :: VGPath -> VGbitfield -> IO ()------ | Paint-foreign import ccall unsafe "vg/openvg.h vgCreatePaint"- vgCreatePaint :: IO VGPaint--foreign import ccall unsafe "vg/openvg.h vgDestroyPaint"- vgDestroyPaint :: VGPaint -> IO ()--foreign import ccall unsafe "vg/openvg.h vgSetPaint"- vgSetPaint :: VGPaint -> VGbitfield -> IO ()--{---- TODO vgGetPaint seems to be missing in the dll... ?-foreign import ccall unsafe "vg/openvg.h vgGetPaint"- vgGetPaint :: VGPaintMode' -> IO VGPaint--}--{---- TODO vgSetColor seems to be missing in the dll... ?-foreign import ccall unsafe "vg/openvg.h vgSetColor"- vgSetColor :: VGPaint -> VGuint -> IO ()--}--{---- TODO vgGetColor seems to be missing in the dll... ?-foreign import ccall unsafe "vg/openvg.h vgGetColor"- vgGetColor :: VGPaint -> IO VGuint--}--foreign import ccall unsafe "vg/openvg.h vgPaintPattern"- vgPaintPattern :: VGPaint -> VGImage -> IO ()----- | Images--foreign import ccall unsafe "vg/openvg.h vgCreateImage"- vgCreateImage :: VGImageFormat'- -> VGint- -> VGint- -> VGbitfield- -> IO VGImage---foreign import ccall unsafe "vg/openvg.h vgDestroyImage"- vgDestroyImage :: VGImage -> IO ()--foreign import ccall unsafe "vg/openvg.h vgClearImage"- vgClearImage :: VGImage -> VGint -> VGint -> VGint -> VGint -> IO ()--foreign import ccall unsafe "vg/openvg.h vgImageSubData"- vgImageSubData :: VGImage- -> Ptr a- -> VGint- -> VGImageFormat'- -> VGint- -> VGint- -> VGint- -> VGint- -> IO ()---foreign import ccall unsafe "vg/openvg.h vgGetImageSubData"- vgGetImageSubData :: VGImage- -> Ptr a- -> VGint- -> VGImageFormat'- -> VGint- -> VGint- -> VGint- -> VGint- -> IO ()---- Stubbed in shivaVG 0.2.1 (not implemented)-foreign import ccall unsafe "vg/openvg.h vgChildImage"- vgChildImage :: VGImage -> VGint -> VGint -> VGint -> VGint -> IO VGImage----- Stubbed in shivaVG 0.2.1 (not implemented)-foreign import ccall unsafe "vg/openvg.h vgGetParent"- vgGetParent :: VGImage -> IO VGImage----foreign import ccall unsafe "vg/openvg.h vgCopyImage"- vgCopyImage :: VGImage -> VGint -> VGint- -> VGImage -> VGint -> VGint- -> VGint -> VGint- -> VGboolean- -> IO ()---foreign import ccall unsafe "vg/openvg.h vgDrawImage"- vgDrawImage :: VGImage -> IO ()--foreign import ccall unsafe "vg/openvg.h vgSetPixels"- vgSetPixels :: VGint- -> VGint- -> VGImage- -> VGint- -> VGint- -> VGint- -> VGint- -> IO ()--foreign import ccall unsafe "vg/openvg.h vgWritePixels"- vgWritePixels :: Ptr a- -> VGint- -> VGImageFormat'- -> VGint- -> VGint- -> VGint- -> VGint- -> IO ()---foreign import ccall unsafe "vg/openvg.h vgGetPixels"- vgGetPixels :: VGImage- -> VGint- -> VGint- -> VGint- -> VGint- -> VGint- -> VGint- -> IO ()--foreign import ccall unsafe "vg/openvg.h vgReadPixels"- vgReadPixels :: Ptr a- -> VGint- -> VGImageFormat'- -> VGint- -> VGint- -> VGint- -> VGint- -> IO ()---foreign import ccall unsafe "vg/openvg.h vgCopyPixels"- vgCopyPixels :: VGint- -> VGint- -> VGint- -> VGint- -> VGint- -> VGint- -> IO ()----- | Image Filters----- Stubbed in shivaVG 0.2.1 (not implemented)-foreign import ccall unsafe "vg/openvg.h vgColorMatrix"- vgColorMatrix :: VGImage -> VGImage -> Ptr VGfloat -> IO ()----- Stubbed in shivaVG 0.2.1 (not implemented)-foreign import ccall unsafe "vg/openvg.h vgConvolve"- vgConvolve :: VGImage- -> VGImage- -> VGint- -> VGint- -> VGint- -> VGint- -> Ptr VGshort- -> VGfloat- -> VGfloat- -> VGTilingMode'- -> IO ()---- Stubbed in shivaVG 0.2.1 (not implemented)-foreign import ccall unsafe "vg/openvg.h vgSeparableConvolve"- vgSeparableConvolve :: VGImage- -> VGImage- -> VGint- -> VGint- -> VGint- -> VGint- -> Ptr VGshort- -> Ptr VGshort- -> VGfloat- -> VGfloat- -> VGTilingMode'- -> IO ()----- Stubbed in shivaVG 0.2.1 (not implemented)-foreign import ccall unsafe "vg/openvg.h vgGaussianBlur"- vgGaussianBlur :: VGImage- -> VGImage- -> VGfloat- -> VGfloat- -> VGTilingMode'- -> IO ()----- Stubbed in shivaVG 0.2.1 (not implemented)-foreign import ccall unsafe "vg/openvg.h vgLookup"- vgLookup :: VGImage- -> VGImage- -> Ptr VGubyte- -> Ptr VGubyte- -> Ptr VGubyte- -> Ptr VGubyte- -> VGboolean- -> VGboolean- -> IO ()----- Stubbed in shivaVG 0.2.1 (not implemented)-foreign import ccall unsafe "vg/openvg.h vgLookupSingle"- vgLookupSingle :: VGImage- -> VGImage- -> Ptr VGuint- -> VGImageChannel'- -> VGboolean- -> VGboolean- -> IO ()----- | Hardware Queries---- | Query hardware capabilites---- Implemented in shivaVG 0.2.1-foreign import ccall unsafe "vg/openvg.h vgHardwareQuery"- vgHardwareQuery :: VGHardwareQueryType'- -> VGint- -> IO VGHardwareQueryResult'---- | Renderer and Extension Information-foreign import ccall unsafe "vg/openvg.h vgGetString"- vgGetString :: VGStringID' -> IO CString---- | Shiva-VG Extensions--- See the README in the shiva archive.-foreign import ccall unsafe "vg/openvg.h vgCreateContextSH"- vgCreateContextSH :: VGint -> VGint -> IO VGboolean--foreign import ccall unsafe "vg/openvg.h vgResizeSurfaceSH"- vgResizeSurfaceSH :: VGint -> VGint -> IO ()---foreign import ccall unsafe "vg/openvg.h vgDestroyContextSH"- vgDestroyContextSH :: IO ()---------
− src/Graphics/Rendering/OpenVG/VG/Constants.hsc
@@ -1,384 +0,0 @@-{-# LANGUAGE CPP #-}-{-# LANGUAGE ForeignFunctionInterface #-}-{-# OPTIONS -Wall #-}------------------------------------------------------------------------------------- |--- Module : Graphics.Rendering.OpenVG.VG.Constants--- Copyright : (c) Stephen Tetley 2008, 2009--- License : BSD3------ Maintainer : Stephen Tetley <stephen.tetley@gmail.com>--- Stability : highly unstable--- Portability : GHC------ Aliases for constants defined in <vg/openvg.h>.---------------------------------------------------------------------------------------module Graphics.Rendering.OpenVG.VG.Constants where--#include <vg/openvg.h>--import Graphics.Rendering.OpenVG.VG.BasicTypes--vg_PATH_FORMAT_STANDARD :: VGint-vg_PATH_FORMAT_STANDARD = #const VG_PATH_FORMAT_STANDARD--vg_MAXSHORT :: VGshort-vg_MAXSHORT = #const VG_MAXSHORT--vg_MAXINT :: VGint-vg_MAXINT = #const VG_MAXINT---- shiva-vg has no VG_MAXFLOAT--- vg_MAXFLOAT :: VGfloat--- vg_MAXFLOAT = #const VG_MAXFLOAT----- | Enumerations--#{enum VGenum,- , vg_NO_ERROR = VG_NO_ERROR- , vg_BAD_HANDLE_ERROR = VG_BAD_HANDLE_ERROR- , vg_ILLEGAL_ARGUMENT_ERROR = VG_ILLEGAL_ARGUMENT_ERROR- , vg_OUT_OF_MEMORY_ERROR = VG_OUT_OF_MEMORY_ERROR- , vg_PATH_CAPABILITY_ERROR = VG_PATH_CAPABILITY_ERROR- , vg_UNSUPPORTED_IMAGE_FORMAT_ERROR = VG_UNSUPPORTED_IMAGE_FORMAT_ERROR- , vg_UNSUPPORTED_PATH_FORMAT_ERROR = VG_UNSUPPORTED_PATH_FORMAT_ERROR- , vg_IMAGE_IN_USE_ERROR = VG_IMAGE_IN_USE_ERROR- , vg_NO_CONTEXT_ERROR = VG_NO_CONTEXT_ERROR- }- -#{enum VGenum,- , vg_MATRIX_MODE = VG_MATRIX_MODE- , vg_FILL_RULE = VG_FILL_RULE- , vg_IMAGE_QUALITY = VG_IMAGE_QUALITY- , vg_RENDERING_QUALITY = VG_RENDERING_QUALITY- , vg_BLEND_MODE = VG_BLEND_MODE- , vg_IMAGE_MODE = VG_IMAGE_MODE- - , vg_SCISSOR_RECTS = VG_SCISSOR_RECTS-- , vg_STROKE_LINE_WIDTH = VG_STROKE_LINE_WIDTH- , vg_STROKE_CAP_STYLE = VG_STROKE_CAP_STYLE- , vg_STROKE_JOIN_STYLE = VG_STROKE_JOIN_STYLE- , vg_STROKE_MITER_LIMIT = VG_STROKE_MITER_LIMIT- , vg_STROKE_DASH_PATTERN = VG_STROKE_DASH_PATTERN- , vg_STROKE_DASH_PHASE = VG_STROKE_DASH_PHASE- , vg_STROKE_DASH_PHASE_RESET = VG_STROKE_DASH_PHASE_RESET-- , vg_TILE_FILL_COLOR = VG_TILE_FILL_COLOR-- , vg_CLEAR_COLOR = VG_CLEAR_COLOR-- , vg_MASKING = VG_MASKING- , vg_SCISSORING = VG_SCISSORING-- , vg_PIXEL_LAYOUT = VG_PIXEL_LAYOUT- , vg_SCREEN_LAYOUT = VG_SCREEN_LAYOUT-- , vg_FILTER_FORMAT_LINEAR = VG_FILTER_FORMAT_LINEAR- , vg_FILTER_FORMAT_PREMULTIPLIED = VG_FILTER_FORMAT_PREMULTIPLIED-- , vg_FILTER_CHANNEL_MASK = VG_FILTER_CHANNEL_MASK-- , vg_MAX_SCISSOR_RECTS = VG_MAX_SCISSOR_RECTS- , vg_MAX_DASH_COUNT = VG_MAX_DASH_COUNT- , vg_MAX_KERNEL_SIZE = VG_MAX_KERNEL_SIZE- , vg_MAX_SEPARABLE_KERNEL_SIZE = VG_MAX_SEPARABLE_KERNEL_SIZE- , vg_MAX_COLOR_RAMP_STOPS = VG_MAX_COLOR_RAMP_STOPS- , vg_MAX_IMAGE_WIDTH = VG_MAX_IMAGE_WIDTH- , vg_MAX_IMAGE_HEIGHT = VG_MAX_IMAGE_HEIGHT- , vg_MAX_IMAGE_PIXELS = VG_MAX_IMAGE_PIXELS- , vg_MAX_IMAGE_BYTES = VG_MAX_IMAGE_BYTES- , vg_MAX_FLOAT = VG_MAX_FLOAT- , vg_MAX_GAUSSIAN_STD_DEVIATION = VG_MAX_GAUSSIAN_STD_DEVIATION - }- --#{enum VGenum,- , vg_RENDERING_QUALITY_NONANTIALIASED = VG_RENDERING_QUALITY_NONANTIALIASED- , vg_RENDERING_QUALITY_FASTER = VG_RENDERING_QUALITY_FASTER- , vg_RENDERING_QUALITY_BETTER = VG_RENDERING_QUALITY_BETTER - } - ---#{enum VGenum,- , vg_PIXEL_LAYOUT_UNKNOWN = VG_PIXEL_LAYOUT_UNKNOWN- , vg_PIXEL_LAYOUT_RGB_VERTICAL = VG_PIXEL_LAYOUT_RGB_VERTICAL- , vg_PIXEL_LAYOUT_BGR_VERTICAL = VG_PIXEL_LAYOUT_BGR_VERTICAL- , vg_PIXEL_LAYOUT_RGB_HORIZONTAL = VG_PIXEL_LAYOUT_RGB_HORIZONTAL- , vg_PIXEL_LAYOUT_BGR_HORIZONTAL = VG_PIXEL_LAYOUT_BGR_HORIZONTAL- }--#{enum VGenum,- , vg_MATRIX_PATH_USER_TO_SURFACE = VG_MATRIX_PATH_USER_TO_SURFACE- , vg_MATRIX_IMAGE_USER_TO_SURFACE = VG_MATRIX_IMAGE_USER_TO_SURFACE- , vg_MATRIX_FILL_PAINT_TO_USER = VG_MATRIX_FILL_PAINT_TO_USER- , vg_MATRIX_STROKE_PAINT_TO_USER = VG_MATRIX_STROKE_PAINT_TO_USER- }--#{enum VGenum,- , vg_CLEAR_MASK = VG_CLEAR_MASK- , vg_FILL_MASK = VG_FILL_MASK- , vg_SET_MASK = VG_SET_MASK- , vg_UNION_MASK = VG_UNION_MASK- , vg_INTERSECT_MASK = VG_INTERSECT_MASK- , vg_SUBTRACT_MASK = VG_SUBTRACT_MASK- }- - -#{enum VGenum,- , vg_PATH_DATATYPE_S_8 = VG_PATH_DATATYPE_S_8- , vg_PATH_DATATYPE_S_16 = VG_PATH_DATATYPE_S_16- , vg_PATH_DATATYPE_S_32 = VG_PATH_DATATYPE_S_32- , vg_PATH_DATATYPE_F = VG_PATH_DATATYPE_F- }--#{enum VGenum,- , vg_ABSOLUTE = VG_ABSOLUTE- , vg_RELATIVE = VG_RELATIVE- }--#{enum VGenum,- , vg_CLOSE_PATH = VG_CLOSE_PATH- , vg_MOVE_TO = VG_MOVE_TO- , vg_LINE_TO = VG_LINE_TO- , vg_HLINE_TO = VG_HLINE_TO- , vg_VLINE_TO = VG_VLINE_TO- , vg_QUAD_TO = VG_QUAD_TO- , vg_CUBIC_TO = VG_CUBIC_TO- , vg_SQUAD_TO = VG_SQUAD_TO- , vg_SCUBIC_TO = VG_SCUBIC_TO- , vg_SCCWARC_TO = VG_SCCWARC_TO- , vg_SCWARC_TO = VG_SCWARC_TO- , vg_LCCWARC_TO = VG_LCCWARC_TO- , vg_LCWARC_TO = VG_LCWARC_TO- }---#{enum VGenum,- , vg_MOVE_TO_ABS = VG_MOVE_TO_ABS- , vg_MOVE_TO_REL = VG_MOVE_TO_REL- , vg_LINE_TO_ABS = VG_LINE_TO_ABS- , vg_LINE_TO_REL = VG_LINE_TO_REL- , vg_HLINE_TO_ABS = VG_HLINE_TO_ABS- , vg_HLINE_TO_REL = VG_HLINE_TO_REL- , vg_VLINE_TO_ABS = VG_VLINE_TO_ABS- , vg_VLINE_TO_REL = VG_VLINE_TO_REL- , vg_QUAD_TO_ABS = VG_QUAD_TO_ABS- , vg_QUAD_TO_REL = VG_QUAD_TO_REL- , vg_CUBIC_TO_ABS = VG_CUBIC_TO_ABS- , vg_CUBIC_TO_REL = VG_CUBIC_TO_REL- , vg_SQUAD_TO_ABS = VG_SQUAD_TO_ABS- , vg_SQUAD_TO_REL = VG_SQUAD_TO_REL- , vg_SCUBIC_TO_ABS = VG_SCUBIC_TO_ABS- , vg_SCUBIC_TO_REL = VG_SCUBIC_TO_REL- , vg_SCCWARC_TO_ABS = VG_SCCWARC_TO_ABS- , vg_SCCWARC_TO_REL = VG_SCCWARC_TO_REL- , vg_SCWARC_TO_ABS = VG_SCWARC_TO_ABS- , vg_SCWARC_TO_REL = VG_SCWARC_TO_REL- , vg_LCCWARC_TO_ABS = VG_LCCWARC_TO_ABS- , vg_LCCWARC_TO_REL = VG_LCCWARC_TO_REL- , vg_LCWARC_TO_ABS = VG_LCWARC_TO_ABS- , vg_LCWARC_TO_REL = VG_LCWARC_TO_REL- }---- typedef VGHandle VGPath;---#{enum VGenum,- , vg_PATH_CAPABILITY_APPEND_FROM = VG_PATH_CAPABILITY_APPEND_FROM- , vg_PATH_CAPABILITY_APPEND_TO = VG_PATH_CAPABILITY_APPEND_TO- , vg_PATH_CAPABILITY_MODIFY = VG_PATH_CAPABILITY_MODIFY- , vg_PATH_CAPABILITY_TRANSFORM_FROM = VG_PATH_CAPABILITY_TRANSFORM_FROM- , vg_PATH_CAPABILITY_TRANSFORM_TO = VG_PATH_CAPABILITY_TRANSFORM_TO- , vg_PATH_CAPABILITY_INTERPOLATE_FROM = VG_PATH_CAPABILITY_INTERPOLATE_FROM- , vg_PATH_CAPABILITY_INTERPOLATE_TO = VG_PATH_CAPABILITY_INTERPOLATE_TO- , vg_PATH_CAPABILITY_PATH_LENGTH = VG_PATH_CAPABILITY_PATH_LENGTH- , vg_PATH_CAPABILITY_POINT_ALONG_PATH = VG_PATH_CAPABILITY_POINT_ALONG_PATH- , vg_PATH_CAPABILITY_TANGENT_ALONG_PATH = VG_PATH_CAPABILITY_TANGENT_ALONG_PATH- , vg_PATH_CAPABILITY_PATH_BOUNDS = VG_PATH_CAPABILITY_PATH_BOUNDS- , vg_PATH_CAPABILITY_PATH_TRANSFORMED_BOUNDS = VG_PATH_CAPABILITY_PATH_TRANSFORMED_BOUNDS- , vg_PATH_CAPABILITY_ALL = VG_PATH_CAPABILITY_ALL- }--#{enum VGenum,- , vg_PATH_FORMAT = VG_PATH_FORMAT- , vg_PATH_DATATYPE = VG_PATH_DATATYPE- , vg_PATH_SCALE = VG_PATH_SCALE- , vg_PATH_BIAS = VG_PATH_BIAS- , vg_PATH_NUM_SEGMENTS = VG_PATH_NUM_SEGMENTS- , vg_PATH_NUM_COORDS = VG_PATH_NUM_COORDS- }--#{enum VGenum,- , vg_CAP_BUTT = VG_CAP_BUTT- , vg_CAP_ROUND = VG_CAP_ROUND- , vg_CAP_SQUARE = VG_CAP_SQUARE- }--#{enum VGenum,- , vg_JOIN_MITER = VG_JOIN_MITER- , vg_JOIN_ROUND = VG_JOIN_ROUND- , vg_JOIN_BEVEL = VG_JOIN_BEVEL- }--#{enum VGenum,- , vg_EVEN_ODD = VG_EVEN_ODD- , vg_NON_ZERO = VG_NON_ZERO- }--#{enum VGenum,- , vg_STROKE_PATH = VG_STROKE_PATH- , vg_FILL_PATH = VG_FILL_PATH-}---- typedef VGHandle VGPaint;--#{enum VGenum,- , vg_PAINT_TYPE = VG_PAINT_TYPE- , vg_PAINT_COLOR = VG_PAINT_COLOR- , vg_PAINT_COLOR_RAMP_SPREAD_MODE = VG_PAINT_COLOR_RAMP_SPREAD_MODE- , vg_PAINT_COLOR_RAMP_PREMULTIPLIED = VG_PAINT_COLOR_RAMP_PREMULTIPLIED- , vg_PAINT_COLOR_RAMP_STOPS = VG_PAINT_COLOR_RAMP_STOPS-- , vg_PAINT_LINEAR_GRADIENT = VG_PAINT_LINEAR_GRADIENT-- , vg_PAINT_RADIAL_GRADIENT = VG_PAINT_RADIAL_GRADIENT-- , vg_PAINT_PATTERN_TILING_MODE = VG_PAINT_PATTERN_TILING_MODE-}--#{enum VGenum,- , vg_PAINT_TYPE_COLOR = VG_PAINT_TYPE_COLOR- , vg_PAINT_TYPE_LINEAR_GRADIENT = VG_PAINT_TYPE_LINEAR_GRADIENT- , vg_PAINT_TYPE_RADIAL_GRADIENT = VG_PAINT_TYPE_RADIAL_GRADIENT- , vg_PAINT_TYPE_PATTERN = VG_PAINT_TYPE_PATTERN- }--#{enum VGenum,- , vg_COLOR_RAMP_SPREAD_PAD = VG_COLOR_RAMP_SPREAD_PAD- , vg_COLOR_RAMP_SPREAD_REPEAT = VG_COLOR_RAMP_SPREAD_REPEAT- , vg_COLOR_RAMP_SPREAD_REFLECT = VG_COLOR_RAMP_SPREAD_REFLECT- }--#{enum VGenum,- , vg_TILE_FILL = VG_TILE_FILL- , vg_TILE_PAD = VG_TILE_PAD- , vg_TILE_REPEAT = VG_TILE_REPEAT- , vg_TILE_REFLECT = VG_TILE_REFLECT- }--#{enum VGenum,- , vg_sRGBX_8888 = VG_sRGBX_8888- , vg_sRGBA_8888 = VG_sRGBA_8888- , vg_sRGBA_8888_PRE = VG_sRGBA_8888_PRE- , vg_sRGB_565 = VG_sRGB_565- , vg_sRGBA_5551 = VG_sRGBA_5551- , vg_sRGBA_4444 = VG_sRGBA_4444- , vg_sL_8 = VG_sL_8- , vg_lRGBX_8888 = VG_lRGBX_8888- , vg_lRGBA_8888 = VG_lRGBA_8888- , vg_lRGBA_8888_PRE = VG_lRGBA_8888_PRE- , vg_lL_8 = VG_lL_8- , vg_A_8 = VG_A_8- , vg_BW_1 = VG_BW_1-- , vg_sXRGB_8888 = VG_sXRGB_8888- , vg_sARGB_8888 = VG_sARGB_8888- , vg_sARGB_8888_PRE = VG_sARGB_8888_PRE- , vg_sARGB_1555 = VG_sARGB_1555- , vg_sARGB_4444 = VG_sARGB_4444- , vg_lXRGB_8888 = VG_lXRGB_8888- , vg_lARGB_8888 = VG_lARGB_8888- , vg_lARGB_8888_PRE = VG_lARGB_8888_PRE-- , vg_sBGRX_8888 = VG_sBGRX_8888- , vg_sBGRA_8888 = VG_sBGRA_8888- , vg_sBGRA_8888_PRE = VG_sBGRA_8888_PRE- , vg_sBGR_565 = VG_sBGR_565- , vg_sBGRA_5551 = VG_sBGRA_5551- , vg_sBGRA_4444 = VG_sBGRA_4444- , vg_lBGRX_8888 = VG_lBGRX_8888- , vg_lBGRA_8888 = VG_lBGRA_8888- , vg_lBGRA_8888_PRE = VG_lBGRA_8888_PRE-- , vg_sXBGR_8888 = VG_sXBGR_8888- , vg_sABGR_8888 = VG_sABGR_8888- , vg_sABGR_8888_PRE = VG_sABGR_8888_PRE- , vg_sABGR_1555 = VG_sABGR_1555- , vg_sABGR_4444 = VG_sABGR_4444- , vg_lXBGR_8888 = VG_lXBGR_8888- , vg_lABGR_8888 = VG_lABGR_8888- , vg_lABGR_8888_PRE = VG_lABGR_8888_PRE-}----- typedef VGHandle VGImage;---#{enum VGenum,- , vg_IMAGE_QUALITY_NONANTIALIASED = VG_IMAGE_QUALITY_NONANTIALIASED- , vg_IMAGE_QUALITY_FASTER = VG_IMAGE_QUALITY_FASTER- , vg_IMAGE_QUALITY_BETTER = VG_IMAGE_QUALITY_BETTER- }--#{enum VGenum,- , vg_IMAGE_FORMAT = VG_IMAGE_FORMAT- , vg_IMAGE_WIDTH = VG_IMAGE_WIDTH- , vg_IMAGE_HEIGHT = VG_IMAGE_HEIGHT- }--#{enum VGenum,- , vg_DRAW_IMAGE_NORMAL = VG_DRAW_IMAGE_NORMAL- , vg_DRAW_IMAGE_MULTIPLY = VG_DRAW_IMAGE_MULTIPLY- , vg_DRAW_IMAGE_STENCIL = VG_DRAW_IMAGE_STENCIL- }--#{enum VGenum,- , vg_RED = VG_RED- , vg_GREEN = VG_GREEN- , vg_BLUE = VG_BLUE- , vg_ALPHA = VG_ALPHA- }--#{enum VGenum,- , vg_BLEND_SRC = VG_BLEND_SRC- , vg_BLEND_SRC_OVER = VG_BLEND_SRC_OVER- , vg_BLEND_DST_OVER = VG_BLEND_DST_OVER- , vg_BLEND_SRC_IN = VG_BLEND_SRC_IN- , vg_BLEND_DST_IN = VG_BLEND_DST_IN- , vg_BLEND_MULTIPLY = VG_BLEND_MULTIPLY- , vg_BLEND_SCREEN = VG_BLEND_SCREEN- , vg_BLEND_DARKEN = VG_BLEND_DARKEN- , vg_BLEND_LIGHTEN = VG_BLEND_LIGHTEN- , vg_BLEND_ADDITIVE = VG_BLEND_ADDITIVE- , vg_BLEND_SRC_OUT_SH = VG_BLEND_SRC_OUT_SH- , vg_BLEND_DST_OUT_SH = VG_BLEND_DST_OUT_SH- , vg_BLEND_SRC_ATOP_SH = VG_BLEND_SRC_ATOP_SH- , vg_BLEND_DST_ATOP_SH = VG_BLEND_DST_ATOP_SH- }--#{enum VGenum,- , vg_IMAGE_FORMAT_QUERY = VG_IMAGE_FORMAT_QUERY- , vg_PATH_DATATYPE_QUERY = VG_PATH_DATATYPE_QUERY- }--#{enum VGenum,- , vg_HARDWARE_ACCELERATED = VG_HARDWARE_ACCELERATED- , vg_HARDWARE_UNACCELERATED = VG_HARDWARE_UNACCELERATED- }--#{enum VGenum,- , vg_VENDOR = VG_VENDOR- , vg_RENDERER = VG_RENDERER- , vg_VERSION = VG_VERSION- , vg_EXTENSIONS = VG_EXTENSIONS- }---- end of file-
src/Graphics/Rendering/OpenVG/VG/DrawingContext.hs view
@@ -27,20 +27,9 @@ ) where -import Graphics.Rendering.OpenVG.VG.BasicTypes ( VGenum )-import Graphics.Rendering.OpenVG.VG.CFunDecls ( - vgGetError, vgFlush, vgFinish ) -import Graphics.Rendering.OpenVG.VG.Constants (- vg_NO_ERROR, - vg_BAD_HANDLE_ERROR, - vg_ILLEGAL_ARGUMENT_ERROR,- vg_OUT_OF_MEMORY_ERROR, - vg_PATH_CAPABILITY_ERROR,- vg_UNSUPPORTED_IMAGE_FORMAT_ERROR, - vg_UNSUPPORTED_PATH_FORMAT_ERROR,- vg_IMAGE_IN_USE_ERROR,- vg_NO_CONTEXT_ERROR ) +import Graphics.Rendering.OpenVG.Raw.VG.Core101 ( VGenum )+import Graphics.Rendering.OpenVG.Raw.VG.DrawingContext import Control.Monad ( liftM )
src/Graphics/Rendering/OpenVG/VG/Extending.hs view
@@ -22,10 +22,9 @@ stringId, ) where -import Graphics.Rendering.OpenVG.VG.BasicTypes ( VGenum )-import Graphics.Rendering.OpenVG.VG.CFunDecls ( vgGetString ) -import Graphics.Rendering.OpenVG.VG.Constants (- vg_VENDOR, vg_RENDERER, vg_VERSION, vg_EXTENSIONS ) ++import Graphics.Rendering.OpenVG.Raw.VG.Core101 ( VGenum )+import Graphics.Rendering.OpenVG.Raw.VG.Extending import Data.StateVar ( GettableStateVar, makeGettableStateVar )
src/Graphics/Rendering/OpenVG/VG/Images.hs view
@@ -25,7 +25,10 @@ ImageFormat(..), -- * Creating and destroying images- maxImageWidth, maxImageHeight, maxImagePixels, maxImageBytes,+ maxImageWidth, + maxImageHeight, + maxImagePixels, + maxImageBytes, createImage, destroyImage, @@ -33,12 +36,15 @@ -- * Querying images- imageFormat, imageWidth, imageHeight,+ imageFormat, + imageWidth, + imageHeight, -- * Reading and writing image pixels clearImage, - imageSubData, getImageSubData,+ imageSubData, + getImageSubData, -- * Copying pixels between images copyImage, @@ -49,47 +55,22 @@ drawImage, -- * Reading and writing drawing surface pixels- setPixels, writePixels, getPixels, readPixels, + setPixels, + writePixels, + getPixels, + readPixels, -- * Copying portions of the drawing surface- copyPixels,- + copyPixels ) where -import Graphics.Rendering.OpenVG.VG.BasicTypes ( - VGenum, VGint, VGImage )-import Graphics.Rendering.OpenVG.VG.CFunDecls ( - vgCreateImage, vgDestroyImage, vgClearImage,- vgImageSubData, vgGetImageSubData, - vgCopyImage, vgDrawImage, - vgSetPixels, vgWritePixels, vgGetPixels, vgReadPixels, vgCopyPixels )-import Graphics.Rendering.OpenVG.VG.Constants (- vg_sRGBX_8888, vg_sRGBA_8888, vg_sRGBA_8888_PRE, vg_sRGB_565,- vg_sRGBA_5551, vg_sRGBA_4444, vg_sL_8, vg_lRGBX_8888,- vg_lRGBA_8888, vg_lRGBA_8888_PRE, vg_lL_8, vg_A_8, vg_BW_1, - vg_sXRGB_8888, vg_sARGB_8888, vg_sARGB_8888_PRE, vg_sARGB_1555,- vg_sARGB_4444, vg_lXRGB_8888, vg_lARGB_8888, vg_lARGB_8888_PRE,- vg_sBGRX_8888, vg_sBGRA_8888, vg_sBGRA_8888_PRE, vg_sBGR_565,- vg_sBGRA_5551, vg_sBGRA_4444, vg_lBGRX_8888, vg_lBGRA_8888,- vg_lBGRA_8888_PRE, vg_sXBGR_8888, vg_sABGR_8888,- vg_sABGR_8888_PRE, vg_sABGR_1555, vg_sABGR_4444, vg_lXBGR_8888,- vg_lABGR_8888, vg_lABGR_8888_PRE,- - vg_IMAGE_QUALITY_NONANTIALIASED, vg_IMAGE_QUALITY_FASTER, - vg_IMAGE_QUALITY_BETTER, - vg_IMAGE_FORMAT, vg_IMAGE_WIDTH, vg_IMAGE_HEIGHT,- vg_DRAW_IMAGE_NORMAL, vg_DRAW_IMAGE_MULTIPLY, vg_DRAW_IMAGE_STENCIL )--import Graphics.Rendering.OpenVG.VG.Parameters ( - seti, geti, getParameteri, - ParamType ( ImageQuality, ImageMode,- MaxImageWidth, MaxImageHeight, - MaxImagePixels, MaxImageBytes ) )--import Graphics.Rendering.OpenVG.VG.Utils ( bitwiseOr, unSizeM, marshalBool )+import Graphics.Rendering.OpenVG.VG.Parameters+import Graphics.Rendering.OpenVG.VG.Utils ( bitwiseOr, marshalBool, unSizeM ) +import Graphics.Rendering.OpenVG.Raw.VG.Core101 ( VGenum, VGint, VGImage )+import Graphics.Rendering.OpenVG.Raw.VG.Images import Graphics.Rendering.OpenGL.GL.CoordTrans ( Position(..), Size (..) )
src/Graphics/Rendering/OpenVG/VG/Paint.hs view
@@ -18,11 +18,13 @@ module Graphics.Rendering.OpenVG.VG.Paint ( -- * Creating and destroying paint objects - createPaint, destroyPaint, + createPaint, + destroyPaint, withPaint, -- * Setting the current paint - setPaint, getPaint,+ setPaint, + getPaint, -- * Setting paint parameters PaintType(..), @@ -44,34 +46,16 @@ ) where -import Graphics.Rendering.OpenVG.VG.BasicTypes ( - VGenum, VGint, VGfloat, VGImage, VGPaint )-import Graphics.Rendering.OpenVG.VG.CFunDecls ( - vgCreatePaint, vgDestroyPaint, - vgSetPaint,- vgPaintPattern )- -import Graphics.Rendering.OpenVG.VG.Constants (- vg_PAINT_TYPE, vg_PAINT_COLOR, vg_PAINT_COLOR_RAMP_SPREAD_MODE, - vg_PAINT_COLOR_RAMP_STOPS, vg_PAINT_COLOR_RAMP_PREMULTIPLIED, - vg_PAINT_LINEAR_GRADIENT, vg_PAINT_RADIAL_GRADIENT, - vg_PAINT_PATTERN_TILING_MODE, - vg_PAINT_TYPE_COLOR, vg_PAINT_TYPE_LINEAR_GRADIENT, - vg_PAINT_TYPE_RADIAL_GRADIENT, vg_PAINT_TYPE_PATTERN, - vg_COLOR_RAMP_SPREAD_PAD, vg_COLOR_RAMP_SPREAD_REPEAT, - vg_COLOR_RAMP_SPREAD_REFLECT,- - vg_TILE_FILL, vg_TILE_PAD, vg_TILE_REPEAT, vg_TILE_REFLECT ) -import Graphics.Rendering.OpenVG.VG.Parameters ( - ParamType( MaxColorRampStops ),- geti, getParameteri, - setParameteri, setParameterfv ) - -import Graphics.Rendering.OpenVG.VG.Paths ( PaintMode(..), marshalPaintMode )+import Graphics.Rendering.OpenVG.VG.Parameters+import Graphics.Rendering.OpenVG.VG.Paths ( PaintMode, marshalPaintMode ) import Graphics.Rendering.OpenVG.VG.Utils ( bitwiseOr, marshalBool )++import Graphics.Rendering.OpenVG.Raw.VG.Core101 ( + VGenum, VGint, VGfloat, VGImage, VGPaint )+import Graphics.Rendering.OpenVG.Raw.VG.Paint import Graphics.Rendering.OpenGL.GL.VertexSpec ( Color4(..) )
src/Graphics/Rendering/OpenVG/VG/Parameters.hs view
@@ -18,36 +18,38 @@ -------------------------------------------------------------------------------- module Graphics.Rendering.OpenVG.VG.Parameters ( - ParamType(..), marshalParamType,- setf, seti, setfv, setiv,- getf, geti, getVectorSize, getfv, getiv,- setParameterf, setParameteri, setParameterfv, setParameteriv,- getParameterf, getParameteri, getParameterVectorSize,- getParameterfv, getParameteriv+ ParamType(..), + marshalParamType,++ -- * Setting and querying context parameter values+ setf, + seti, + setfv, + setiv,+ getf, + geti, + getVectorSize, + getfv, + getiv,++ -- * Setting and querying object parameters+ setParameterf, + setParameteri, + setParameterfv, + setParameteriv,+ getParameterf, + getParameteri, + getParameterVectorSize,+ getParameterfv, + getParameteriv+ ) where -import Graphics.Rendering.OpenVG.VG.BasicTypes ( - VGenum, VGfloat, VGint, VGHandle )-import Graphics.Rendering.OpenVG.VG.CFunDecls ( - vgSetf, vgSeti, vgSetfv, vgSetiv,- vgGetf, vgGeti, vgGetVectorSize, vgGetfv, vgGetiv,- - vgSetParameterf, vgSetParameteri, vgSetParameterfv, vgSetParameteriv, - vgGetParameterf, vgGetParameteri, vgGetParameterVectorSize,- vgGetParameterfv, vgGetParameteriv )- -import Graphics.Rendering.OpenVG.VG.Constants (- vg_MATRIX_MODE, vg_FILL_RULE, vg_IMAGE_QUALITY, vg_RENDERING_QUALITY,- vg_BLEND_MODE, vg_IMAGE_MODE, vg_SCISSOR_RECTS, vg_STROKE_LINE_WIDTH,- vg_STROKE_CAP_STYLE, vg_STROKE_JOIN_STYLE, vg_STROKE_MITER_LIMIT,- vg_STROKE_DASH_PATTERN, vg_STROKE_DASH_PHASE, vg_STROKE_DASH_PHASE_RESET,- vg_TILE_FILL_COLOR, vg_CLEAR_COLOR, vg_MASKING,- vg_SCISSORING, vg_PIXEL_LAYOUT, vg_SCREEN_LAYOUT, vg_FILTER_FORMAT_LINEAR,- vg_FILTER_FORMAT_PREMULTIPLIED, vg_FILTER_CHANNEL_MASK, - vg_MAX_SCISSOR_RECTS, vg_MAX_DASH_COUNT, vg_MAX_KERNEL_SIZE,- vg_MAX_SEPARABLE_KERNEL_SIZE, vg_MAX_COLOR_RAMP_STOPS,- vg_MAX_IMAGE_WIDTH, vg_MAX_IMAGE_HEIGHT, vg_MAX_IMAGE_PIXELS,- vg_MAX_IMAGE_BYTES, vg_MAX_FLOAT, vg_MAX_GAUSSIAN_STD_DEVIATION )++import Graphics.Rendering.OpenVG.Raw.VG.Core101 ( + VGint, VGfloat, VGenum, VGHandle )+import Graphics.Rendering.OpenVG.Raw.VG.Parameters+ import Foreign.Marshal.Array ( newArray, peekArray )
src/Graphics/Rendering/OpenVG/VG/Paths.hs view
@@ -5,7 +5,7 @@ -------------------------------------------------------------------------------- -- | -- Module : Graphics.Rendering.OpenVG.VG.Paths--- Copyright : (c) Stephen Tetley 2008, 2009+-- Copyright : (c) Stephen Tetley 2008, 2009, 2010 -- License : BSD3 -- -- Maintainer : Stephen Tetley <stephen.tetley@gmail.com>@@ -15,9 +15,7 @@ -- This module corresponds to section 8 (Paths) -- of the OpenVG 1.0.1 specs. ----- \*\* WARNING - this module is due to be changed significantly --- in the next revision so that it is closer to the original --- OpenVG API.+-- \*\* WARNING - this module is due to be changed significantly. -- -- This is unfortunate as the module defines the most significant -- data types for vectors - the @Paths@. \*\*@@ -25,20 +23,29 @@ -- -------------------------------------------------------------------------------- + module Graphics.Rendering.OpenVG.VG.Paths ( -- * Datatypes PathDatatype(..), PathAbsRel(..),+ PathSegment(..), PathCommand(..), -- * Creating and destroying paths PathCapabilities(..), withPath,- createPath, clearPath, destroyPath,+ createPath, + clearPath, + destroyPath, -- * Path queries- format, datatype, pathScale, bias, numSegments, numCoords,+ format, + datatype, + pathScale, + bias, + numSegments, + numCoords, -- * Querying and modifying path capabilities getPathCapabilities, @@ -62,76 +69,36 @@ -- * Setting stroke parameters lineWidth,- CapStyle(..), capStyle,- JoinStyle(..), joinStyle,+ CapStyle(..), + capStyle,+ JoinStyle(..), + joinStyle, miterLimit, maxDashCount, - dashPattern, disableDashPattern,+ dashPattern, + disableDashPattern, dashPhase, dashPhaseReset, -- * Filling or stroking a path- FillRule(..), fillRule,- PaintMode(..), marshalPaintMode,+ FillRule(..),+ fillRule,+ PaintMode(..),+ marshalPaintMode, drawPath, fillPath, strokePath, fillStrokePath+ ) where +import Graphics.Rendering.OpenVG.VG.Parameters+import Graphics.Rendering.OpenVG.VG.Utils ( + bitwiseOr, unbits32, unmarshalBool, marshalBool ) -import Graphics.Rendering.OpenVG.VG.BasicTypes ( +import Graphics.Rendering.OpenVG.Raw.VG.Core101 ( VGenum, VGint, VGfloat, VGPath )-import Graphics.Rendering.OpenVG.VG.CFunDecls ( - vgCreatePath, vgClearPath, vgDestroyPath, - vgRemovePathCapabilities, vgGetPathCapabilities, - vgAppendPath, vgAppendPathData, vgModifyPathCoords,- vgTransformPath, vgInterpolatePath, - vgDrawPath )-import Graphics.Rendering.OpenVG.VG.Constants ( - vg_PATH_DATATYPE_S_8, vg_PATH_DATATYPE_S_16,- vg_PATH_DATATYPE_S_32, vg_PATH_DATATYPE_F,- vg_PATH_FORMAT_STANDARD,- - vg_CLOSE_PATH, - vg_MOVE_TO_ABS, vg_MOVE_TO_REL,- vg_LINE_TO_ABS, vg_LINE_TO_REL,- vg_HLINE_TO_ABS, vg_HLINE_TO_REL,- vg_VLINE_TO_ABS, vg_VLINE_TO_REL,- vg_QUAD_TO_ABS, vg_QUAD_TO_REL,- vg_CUBIC_TO_ABS, vg_CUBIC_TO_REL,- vg_SQUAD_TO_ABS, vg_SQUAD_TO_REL,- vg_SCUBIC_TO_ABS, vg_SCUBIC_TO_REL,- vg_SCCWARC_TO_ABS, vg_SCCWARC_TO_REL,- vg_SCWARC_TO_ABS, vg_SCWARC_TO_REL,- vg_LCCWARC_TO_ABS, vg_LCCWARC_TO_REL,- vg_LCWARC_TO_ABS, vg_LCWARC_TO_REL,- - vg_PATH_CAPABILITY_APPEND_FROM, vg_PATH_CAPABILITY_APPEND_TO,- vg_PATH_CAPABILITY_MODIFY, vg_PATH_CAPABILITY_TRANSFORM_FROM,- vg_PATH_CAPABILITY_TRANSFORM_TO, vg_PATH_CAPABILITY_INTERPOLATE_FROM, - vg_PATH_CAPABILITY_INTERPOLATE_TO, vg_PATH_CAPABILITY_PATH_LENGTH, - vg_PATH_CAPABILITY_POINT_ALONG_PATH, vg_PATH_CAPABILITY_TANGENT_ALONG_PATH, - vg_PATH_CAPABILITY_PATH_BOUNDS, vg_PATH_CAPABILITY_PATH_TRANSFORMED_BOUNDS,- vg_PATH_CAPABILITY_ALL, - - vg_PATH_FORMAT, vg_PATH_DATATYPE, vg_PATH_SCALE, vg_PATH_BIAS, - vg_PATH_NUM_SEGMENTS, vg_PATH_NUM_COORDS,- vg_CAP_BUTT, vg_CAP_ROUND, vg_CAP_SQUARE,- vg_JOIN_MITER, vg_JOIN_ROUND, vg_JOIN_BEVEL,- vg_EVEN_ODD, vg_NON_ZERO,- vg_STROKE_PATH, vg_FILL_PATH )-import Graphics.Rendering.OpenVG.VG.Parameters ( - ParamType ( FillRule, - StrokeLineWidth, StrokeCapStyle,- StrokeJoinStyle, StrokeMiterLimit, - StrokeDashPattern, - StrokeDashPhase, StrokeDashPhaseReset,- MaxDashCount ),- getParameteri, getParameterf, seti, setf, setfv, geti ) - -import Graphics.Rendering.OpenVG.VG.Utils ( - bitwiseOr, unbits32, marshalBool, unmarshalBool )+import Graphics.Rendering.OpenVG.Raw.VG.Paths import Data.StateVar ( SettableStateVar, makeSettableStateVar,@@ -159,19 +126,32 @@ -- | 'PathAbsRel' enumerates the path addressing types, -- @absolute@ or @relative@. +-- data PathAbsRel = Absolute | Relative deriving ( Eq, Ord, Show ) --- There is no Haskell equivalent to @VGPathSegment@. --- It is subsumed by PathCommand +data PathSegment = + ClosePath+ | MoveTo + | LineTo + | HLineTo + | VLineTo+ | QuadTo + | CubicTo + | SQuadTo + | SCubicTo + | SCCWArcTo + | SCWArcTo + | LCCWArcTo + | LCWArcTo+ deriving ( Eq, Ord, Show ) -- | 'PathCommand' corresponds to the OpenVG enumeration @VGPathCommand@, -- but includes ClosePath aka @VG_CLOSE_PATH@. data PathCommand = - ClosePath- | MoveToAbs+ MoveToAbs | MoveToRel | LineToAbs | LineToRel@@ -328,7 +308,21 @@ instance StorablePathData Int16 instance StorablePathData Int32 instance StorablePathData VGfloat- ++data PathData = S_8 Int8+ | S_16 Int16+ | S_32 Int32+ | F_float Float+ deriving (Eq,Ord,Show)++{-+-- final ptr is @const void * pathData@ ++appendPathData :: VGPath -> VGint -> Ptr VGubyte -> Ptr a -> IO ()+appendPathData = vgAppendPathData+-}++ -- | @appendPathData@ - TODO is this implementation valid? appendPathData :: StorablePathData a => VGPath -> [PathCommand] -> [a] -> IO () appendPathData h cs ds = do @@ -478,10 +472,26 @@ | otherwise = error ("unmarshalPathDatatype: illegal value " ++ show x) +marshalPathSegment :: PathSegment -> VGenum+marshalPathSegment x = case x of+ ClosePath -> vg_CLOSE_PATH+ MoveTo -> vg_MOVE_TO+ LineTo -> vg_LINE_TO+ HLineTo -> vg_HLINE_TO+ VLineTo -> vg_VLINE_TO+ QuadTo -> vg_QUAD_TO+ CubicTo -> vg_CUBIC_TO+ SQuadTo -> vg_SQUAD_TO+ SCubicTo -> vg_SCUBIC_TO+ SCCWArcTo -> vg_SCCWARC_TO+ SCWArcTo -> vg_SCWARC_TO+ LCCWArcTo -> vg_LCCWARC_TO+ LCWArcTo -> vg_LCWARC_TO+ + marshalPathCommand :: PathCommand -> VGenum marshalPathCommand x = case x of- ClosePath -> vg_CLOSE_PATH MoveToAbs -> vg_MOVE_TO_ABS MoveToRel -> vg_MOVE_TO_REL LineToAbs -> vg_LINE_TO_ABS@@ -540,7 +550,8 @@ | x == vg_PATH_CAPABILITY_PATH_BOUNDS = PathBounds | x == vg_PATH_CAPABILITY_PATH_TRANSFORMED_BOUNDS = PathTransfomedBounds | x == vg_PATH_CAPABILITY_ALL = CapabilityAll - | otherwise = error ("unmarshalPathCapabilities: illegal value " ++ show x)+ | otherwise = error $ + "unmarshalPathCapabilities: illegal value " ++ show x marshalCapStyle :: CapStyle -> VGenum
src/Graphics/Rendering/OpenVG/VG/RenderingQuality.hs view
@@ -38,29 +38,14 @@ scale, shear, rotate+ ) where -import Graphics.Rendering.OpenVG.VG.BasicTypes ( - VGfloat, VGenum )-import Graphics.Rendering.OpenVG.VG.CFunDecls ( - vgLoadIdentity, vgLoadMatrix, vgGetMatrix, vgMultMatrix, - vgTranslate, vgScale, vgShear, vgRotate- )-import Graphics.Rendering.OpenVG.VG.Constants (- vg_RENDERING_QUALITY_NONANTIALIASED, vg_RENDERING_QUALITY_FASTER,- vg_RENDERING_QUALITY_BETTER,- --- vg_PIXEL_LAYOUT_UNKNOWN, - vg_PIXEL_LAYOUT_RGB_VERTICAL, vg_PIXEL_LAYOUT_BGR_VERTICAL,- vg_PIXEL_LAYOUT_RGB_HORIZONTAL, vg_PIXEL_LAYOUT_BGR_HORIZONTAL,- --- vg_MATRIX_PATH_USER_TO_SURFACE, vg_MATRIX_IMAGE_USER_TO_SURFACE, - vg_MATRIX_FILL_PAINT_TO_USER, vg_MATRIX_STROKE_PAINT_TO_USER, - ) -import Graphics.Rendering.OpenVG.VG.Parameters ( - ParamType ( MatrixMode, RenderingQuality, ScreenLayout ), - seti, geti )+import Graphics.Rendering.OpenVG.VG.Parameters +import Graphics.Rendering.OpenVG.Raw.VG.Core101 ( VGenum, VGfloat )+import Graphics.Rendering.OpenVG.Raw.VG.RenderingQuality+ import Data.StateVar ( StateVar(), makeStateVar, SettableStateVar, makeSettableStateVar ) @@ -147,6 +132,10 @@ loadIdentity :: IO () loadIdentity = vgLoadIdentity +-- NOTE+-- See Graphics.Rendering.OpenGL.GL.CoordTrans++ -- | Set the current matrix to the supplied matrix. -- -- 'loadMatrix' corresponds to the OpenVG function @vgLoadMatrix@.@@ -232,7 +221,8 @@ | x == vg_PIXEL_LAYOUT_BGR_VERTICAL = BgrVertical | x == vg_PIXEL_LAYOUT_RGB_HORIZONTAL = RgbHorizontal | x == vg_PIXEL_LAYOUT_BGR_HORIZONTAL = BgrHorizontal - | otherwise = error ("unmarshalPixelLayout: illegal value " ++ show x)+ | otherwise = error $ + "unmarshalPixelLayout: illegal value " ++ show x marshalMatrixMode :: MatrixMode -> VGenum
src/Graphics/Rendering/OpenVG/VG/Scissoring.hs view
@@ -26,21 +26,22 @@ -- * Alpha masking MaskOperation(..), alphaMasking,+ mask, -- * Fast clearing clearColor, clear + ) where -import Graphics.Rendering.OpenVG.VG.BasicTypes ( VGint, VGfloat )-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.OpenVG.VG.Utils ( unSize, unSizeM, marshalBool )+import Graphics.Rendering.OpenVG.VG.Parameters+import Graphics.Rendering.OpenVG.VG.Utils ( marshalBool, unSize, unSizeM ) +import Graphics.Rendering.OpenVG.Raw.VG.Core101 ( + VGint, VGfloat, VGenum, VGImage )+import Graphics.Rendering.OpenVG.Raw.VG.Scissoring+ import Graphics.Rendering.OpenGL.GL.CoordTrans ( Position(..), Size(..) ) import Graphics.Rendering.OpenGL.GL.VertexSpec ( Color4(..) ) @@ -102,7 +103,12 @@ alphaMasking :: SettableStateVar Bool alphaMasking = makeSettableStateVar $ seti Masking . marshalBool --- vgMask not implemented in shiva-vg+-- | Modify the alpha mask values according to the supplied+-- 'MaskOperation'.+--+mask :: VGImage -> MaskOperation -> Position -> Size -> IO ()+mask img mop (Position x y) = + unSizeM $ vgMask img (marshalMaskOperation mop) x y -------------------------------------------------------------------------------- -- Fast clearing@@ -127,16 +133,15 @@ -------------------------------------------------------------------------------- -{---- Defined but not (YET) used: marshalMaskOperation+ marshalMaskOperation :: MaskOperation -> VGenum marshalMaskOperation x = case x of- ClearMask -> vg_CLEAR_MASK- FillMask -> vg_FILL_MASK- SetMask -> vg_SET_MASK- UnionMask -> vg_UNION_MASK+ ClearMask -> vg_CLEAR_MASK+ FillMask -> vg_FILL_MASK+ SetMask -> vg_SET_MASK+ UnionMask -> vg_UNION_MASK IntersectMask -> vg_INTERSECT_MASK- SubtractMask -> vg_SUBTRACT_MASK--}+ SubtractMask -> vg_SUBTRACT_MASK+
src/Graphics/Rendering/OpenVG/VG/ShivaExtensions.hs view
@@ -25,15 +25,13 @@ ) where -import Graphics.Rendering.OpenVG.VG.CFunDecls ( - vgCreateContextSH, vgResizeSurfaceSH, vgDestroyContextSH ) --import Graphics.Rendering.OpenVG.VG.Utils ( unSizeM, unmarshalBool )+import Graphics.Rendering.OpenVG.VG.Utils ( unmarshalBool, unSizeM ) +import Graphics.Rendering.OpenVG.Raw.VG.ShivaExtensions import Graphics.Rendering.OpenGL.GL.CoordTrans ( Size(..) ) -import Control.Applicative+import Control.Monad ( liftM ) @@ -41,7 +39,8 @@ -- OpenGL context. -- createContextSH :: Size -> IO Bool-createContextSH = unSizeM $ \w h -> unmarshalBool <$> vgCreateContextSH w h+createContextSH = unSizeM $ \w h -> + liftM unmarshalBool $ vgCreateContextSH w h -- | 'resizeSurfaceSH' should be called whenever the size of the -- surface changes.
src/Graphics/Rendering/OpenVG/VG/Utils.hs view
@@ -22,16 +22,14 @@ ) where --import Graphics.Rendering.OpenVG.VG.BasicTypes ( - VGint, VGenum, VGbitfield, VGboolean, vg_TRUE, vg_FALSE )+import Graphics.Rendering.OpenVG.Raw.VG.Core101 ( + VGboolean, VGenum, VGint, VGbitfield, + vg_TRUE, vg_FALSE ) import Graphics.Rendering.OpenGL.GL.CoordTrans ( Size(..) ) import Data.Bits-- marshalBool :: Bool -> VGboolean
− src/Graphics/Rendering/OpenVG/VGU/CInternals.hsc
@@ -1,115 +0,0 @@-{-# LANGUAGE CPP #-}-{-# LANGUAGE ForeignFunctionInterface #-}-{-# OPTIONS -Wall #-}------------------------------------------------------------------------------------- |--- Module : Graphics.Rendering.OpenVG.VGU.CInternals--- Copyright : (c) Stephen Tetley 2008, 2009--- License : BSD3------ Maintainer : Stephen Tetley <stephen.tetley@gmail.com>--- Stability : highly unstable--- Portability : GHC------ Internal module declaring all the datatypes and foreign declarations --- defined in <vg/openvgu.h>.-----------------------------------------------------------------------------------------module Graphics.Rendering.OpenVG.VGU.CInternals where--#include <vg/vgu.h>--import Graphics.Rendering.OpenVG.VG.BasicTypes--import Foreign.Ptr ( Ptr )--type VGUErrorCode' = VGenum---- | Enumerations--#{enum VGenum,- , vgu_NO_ERROR = VGU_NO_ERROR- , vgu_BAD_HANDLE_ERROR = VGU_BAD_HANDLE_ERROR- , vgu_ILLEGAL_ARGUMENT_ERROR = VGU_ILLEGAL_ARGUMENT_ERROR- , vgu_OUT_OF_MEMORY_ERROR = VGU_OUT_OF_MEMORY_ERROR- , vgu_PATH_CAPABILITY_ERROR = VGU_PATH_CAPABILITY_ERROR- , vgu_BAD_WARP_ERROR = VGU_BAD_WARP_ERROR- }--#{enum VGenum,- , vgu_ARC_OPEN = VGU_ARC_OPEN- , vgu_ARC_CHORD = VGU_ARC_CHORD- , vgu_ARC_PIE = VGU_ARC_PIE-} - --foreign import ccall unsafe "vg/openvg.h vguLine" - vguLine :: VGPath - -> VGfloat -> VGfloat -> VGfloat -> VGfloat - -> IO VGUErrorCode'--foreign import ccall unsafe "vg/openvg.h vguPolygon"- vguPolygon :: VGPath - -> Ptr VGfloat -> VGint -> VGboolean - -> IO VGUErrorCode' --foreign import ccall unsafe "vg/openvg.h vguRect"- vguRect :: VGPath - -> VGfloat -> VGfloat -> VGfloat -> VGfloat - -> IO VGUErrorCode' --foreign import ccall unsafe "vg/openvg.h vguRoundRect"- vguRoundRect :: VGPath - -> VGfloat -> VGfloat -> VGfloat -> VGfloat- -> VGfloat -> VGfloat - -> IO VGUErrorCode' --foreign import ccall unsafe "vg/openvg.h vguEllipse"- vguEllipse :: VGPath - -> VGfloat -> VGfloat -> VGfloat -> VGfloat - -> IO VGUErrorCode' --foreign import ccall unsafe "vg/openvg.h vguArc"- vguArc :: VGPath - -> VGfloat -> VGfloat -> VGfloat -> VGfloat- -> VGfloat -> VGfloat- -> VGenum - -> IO VGUErrorCode' ---- Stubbed in shivaVG 0.2.1 (not implemented)-foreign import ccall unsafe "vg/openvg.h vguComputeWarpQuadToSquare"- vguComputeWarpQuadToSquare :: VGfloat -> VGfloat - -> VGfloat -> VGfloat- -> VGfloat -> VGfloat- -> VGfloat -> VGfloat- -> Ptr VGfloat- -> IO VGUErrorCode' ---- Stubbed in shivaVG 0.2.1 (not implemented)-foreign import ccall unsafe "vg/openvg.h vguComputeWarpSquareToQuad"- vguComputeWarpSquareToQuad :: VGfloat -> VGfloat - -> VGfloat -> VGfloat- -> VGfloat -> VGfloat- -> VGfloat -> VGfloat- -> Ptr VGfloat- -> IO VGUErrorCode' ---- Stubbed in shivaVG 0.2.1 (not implemented)-foreign import ccall unsafe "vg/openvg.h vguComputeWarpQuadToQuad"- vguComputeWarpQuadToQuad :: VGfloat -> VGfloat - -> VGfloat -> VGfloat- -> VGfloat -> VGfloat- -> VGfloat -> VGfloat- -> VGfloat -> VGfloat - -> VGfloat -> VGfloat- -> VGfloat -> VGfloat- -> VGfloat -> VGfloat- -> Ptr VGfloat- -> IO VGUErrorCode' ------ end of file
src/Graphics/Rendering/OpenVG/VGU/ErrorsInternal.hs view
@@ -2,7 +2,7 @@ -------------------------------------------------------------------------------- -- |--- Module : Graphics.Rendering.OpenVG.VG.Errors+-- Module : Graphics.Rendering.OpenVG.VG.ErrorsInternal -- Copyright : (c) Stephen Tetley 2008, 2009 -- License : BSD3 --@@ -12,7 +12,6 @@ -- -- VGU error codes. ----- Portions of code have been copied from -- -------------------------------------------------------------------------------- @@ -22,8 +21,8 @@ unmarshalErrorCode ) where -import Graphics.Rendering.OpenVG.VG.BasicTypes ( VGenum )-import Graphics.Rendering.OpenVG.VGU.CInternals+import Graphics.Rendering.OpenVG.Raw.VG.Core101 ( VGenum )+import Graphics.Rendering.OpenVG.Raw.VGU.VGU import Control.Monad ( liftM )
src/Graphics/Rendering/OpenVG/VGU/VGU.hs view
@@ -26,10 +26,13 @@ arc ) where --import Graphics.Rendering.OpenVG.VG.BasicTypes ( VGfloat, VGenum, VGPath ) import Graphics.Rendering.OpenVG.VG.Utils ( marshalBool )-import Graphics.Rendering.OpenVG.VGU.CInternals++import Graphics.Rendering.OpenVG.Raw.VG.Core101 (+ VGenum, VGfloat, VGPath )++import Graphics.Rendering.OpenVG.Raw.VGU.VGU+ import Graphics.Rendering.OpenVG.VGU.ErrorsInternal ( VGU_ErrorCode, withErrorCode )