Skip to content

Commit

Permalink
Merge pull request #199 from taruti/master
Browse files Browse the repository at this point in the history
Add Native images to Diagrams.TwoD.Image
  • Loading branch information
byorgey committed Jun 23, 2014
2 parents 34d0272 + f1e9edb commit 32fa6ec
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 3 deletions.
2 changes: 1 addition & 1 deletion src/Diagrams/TwoD.hs
Original file line number Diff line number Diff line change
Expand Up @@ -163,7 +163,7 @@ module Diagrams.TwoD

-- * Images
, DImage(..), ImageData(..)
, Embedded, External
, Embedded, External, Native
, image
, loadImageEmb
, loadImageExt
Expand Down
7 changes: 5 additions & 2 deletions src/Diagrams/TwoD/Image.hs
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
module Diagrams.TwoD.Image
(
DImage(..), ImageData(..)
, Embedded, External
, Embedded, External, Native
, image
, loadImageEmb
, loadImageExt
Expand Down Expand Up @@ -49,12 +49,15 @@ import Data.Semigroup

data Embedded deriving Typeable
data External deriving Typeable
data Native (t :: *) deriving Typeable

-- | 'ImageData' is either a JuicyPixels @DynamicImage@ tagged as 'Embedded' or
-- a reference tagged as 'External'.
-- a reference tagged as 'External'. Additionally 'Native' is provided for
-- external libraries to hook into.
data ImageData :: * -> * where
ImageRaster :: DynamicImage -> ImageData Embedded
ImageRef :: FilePath -> ImageData External
ImageNative :: t -> ImageData (Native t)

-------------------------------------------------------------------------------
-- | An image primitive, the two ints are width followed by height.
Expand Down

0 comments on commit 32fa6ec

Please sign in to comment.