gegl-0.0.0.1: src/GEGL/Enums.hs
-- | Module containing enums from GEGL
module GEGL.Enums
( GeglAccessMode(..)
, GeglAbyssPolicy(..)
, GeglOrientation(..)
, GeglSamplerType(..)
, GeglBlitFlag(..)
) where
-- | Access mode to buffers
data GeglAccessMode
= GeglAccessRead
| GeglAccessWrite
| GeglAccessReadWrite
deriving (Eq, Show)
instance Enum GeglAccessMode where
fromEnum GeglAccessRead = 1
fromEnum GeglAccessWrite = 2
fromEnum GeglAccessReadWrite = 3
toEnum 1 = GeglAccessRead
toEnum 2 = GeglAccessWrite
toEnum 3 = GeglAccessReadWrite
toEnum unmatched = error ("GeglAccessMode.toEnum: Cannot match " ++ show unmatched)
-- | I don't know
data GeglAbyssPolicy
= GeglAbyssNone
| GeglAbyssClamp
| GeglAbyssLoop
| GeglAbyssBlack
| GeglAbyssWhite
deriving (Eq, Show)
instance Enum GeglAbyssPolicy where
fromEnum GeglAbyssNone = 0
fromEnum GeglAbyssClamp = 1
fromEnum GeglAbyssLoop = 2
fromEnum GeglAbyssBlack = 3
fromEnum GeglAbyssWhite = 4
toEnum 0 = GeglAbyssNone
toEnum 1 = GeglAbyssClamp
toEnum 2 = GeglAbyssLoop
toEnum 3 = GeglAbyssBlack
toEnum 4 = GeglAbyssWhite
toEnum unmatched = error ("GeglAbyssPolicy.toEnum: cannot match " ++ show unmatched)
-- | Orientation of a buffer
data GeglOrientation
= GeglOrientationHorizontal
| GeglOrientationVertical
deriving (Eq, Show)
instance Enum GeglOrientation where
fromEnum GeglOrientationHorizontal = 0
fromEnum GeglOrientationVertical = 1
toEnum 0 = GeglOrientationHorizontal
toEnum 1 = GeglOrientationVertical
toEnum unmatched = error ("GeglOrientation.toEnum: cannot match " ++ show unmatched)
data GeglSamplerType
= GeglSamplerNearest
| GeglSamplerLinear
| GeglSamplerCubic
| GeglSamplerNohalo
| GeglSamplerLohalo
deriving (Eq, Show)
instance Enum GeglSamplerType where
fromEnum GeglSamplerNearest = 0
fromEnum GeglSamplerLinear = 1
fromEnum GeglSamplerCubic = 2
fromEnum GeglSamplerNohalo = 3
fromEnum GeglSamplerLohalo = 4
toEnum 0 = GeglSamplerNearest
toEnum 1 = GeglSamplerLinear
toEnum 2 = GeglSamplerCubic
toEnum 3 = GeglSamplerNohalo
toEnum 4 = GeglSamplerLohalo
toEnum unmatched = error ("GeglSamplerType.toEnum: cannot match " ++ show unmatched)
-- | enum type for blit flags
data GeglBlitFlag
= GeglBlitDefault -- ^ Default blitting. nothing special and sufficient in
-- most cases
| GeglBlitCache -- ^ Set up a cache for any subsequent requests of image
-- data from this node.
| GeglBlitDirty -- ^ Return the latest rendered results in cache without
-- regard to wether the regions had been rendered or not.
instance Enum GeglBlitFlag where
fromEnum GeglBlitDefault = 0
fromEnum GeglBlitCache = 1
fromEnum GeglBlitDirty = 2
toEnum 0 = GeglBlitDefault
toEnum 1 = GeglBlitCache
toEnum 2 = GeglBlitDirty
toEnum u = error ("GeglBlitFlag.toEnum: cannot match " ++ show u)