Copyright | (C) Frank Staals |
---|---|
License | see the LICENSE file |
Maintainer | Frank Staals |
Safe Haskell | Safe-Inferred |
Language | GHC2021 |
Reexports the functionality for reading and writing Ipe files.
Synopsis
- data IpeFile r = IpeFile (Maybe IpePreamble) [IpeStyle] (NonEmpty (IpePage r))
- preamble :: Lens' (IpeFile r) (Maybe IpePreamble)
- styles :: Lens' (IpeFile r) [IpeStyle]
- pages :: Lens (IpeFile r) (IpeFile r') (NonEmpty (IpePage r)) (NonEmpty (IpePage r'))
- ipeFile :: NonEmpty (IpePage r) -> IpeFile r
- singlePageFile :: IpePage r -> IpeFile r
- singlePageFromContent :: [IpeObject r] -> IpeFile r
- readIpeFile :: (Coordinate r, Eq r) => OsPath -> IO (Either ConversionError (IpeFile r))
- readSinglePageFile :: (Coordinate r, Eq r) => OsPath -> IO (Either ConversionError (IpePage r))
- readSinglePageFileThrow :: (Coordinate r, Eq r) => OsPath -> IO (IpePage r)
- readRawIpeFile :: (Coordinate r, Eq r) => OsPath -> IO (Either ConversionError (IpeFile r))
- type ConversionError = Text
- readAll :: forall g r. (HasDefaultFromIpe g, r ~ NumType g) => IpePage r -> [g :+ IpeAttributes (DefaultFromIpe g) r]
- readAllFrom :: forall g r. (HasDefaultFromIpe g, r ~ NumType g, Coordinate r, Eq r) => OsPath -> IO [g :+ IpeAttributes (DefaultFromIpe g) r]
- writeIpeFile :: IpeWriteText r => OsPath -> IpeFile r -> IO ()
- writeIpeFile' :: IpeWrite t => t -> OsPath -> IO ()
- writeIpePage :: IpeWriteText r => OsPath -> IpePage r -> IO ()
- toIpeXML :: IpeWrite t => t -> Maybe ByteString
- printAsIpeSelection :: IpeWrite t => t -> IO ()
- toIpeSelectionXML :: IpeWrite t => t -> Maybe ByteString
- data IpePage r = IpePage [LayerName] [View] [IpeObject r]
- layers :: Lens' (IpePage r) [LayerName]
- views :: Lens' (IpePage r) [View]
- content :: Lens (IpePage r) (IpePage r') [IpeObject r] [IpeObject r']
- emptyPage :: IpePage r
- fromContent :: [IpeObject r] -> IpePage r
- onLayer :: LayerName -> Getting (Endo [IpeObject r]) [IpeObject r] (IpeObject r)
- contentInView :: Word -> Getter (IpePage r) [IpeObject r]
- withDefaults :: IpePage r -> IpePage r
- data IpeObject r
- = IpeGroup (IpeObject' Group r)
- | IpeImage (IpeObject' Image r)
- | IpeTextLabel (IpeObject' TextLabel r)
- | IpeMiniPage (IpeObject' MiniPage r)
- | IpeUse (IpeObject' IpeSymbol r)
- | IpePath (IpeObject' Path r)
- _IpePath :: forall r. Prism' (IpeObject r) (IpeObject' Path r)
- _IpeUse :: forall r. Prism' (IpeObject r) (IpeObject' IpeSymbol r)
- _IpeGroup :: forall r. Prism' (IpeObject r) (IpeObject' Group r)
- _IpeTextLabel :: forall r. Prism' (IpeObject r) (IpeObject' TextLabel r)
- _IpeMiniPage :: forall r. Prism' (IpeObject r) (IpeObject' MiniPage r)
- _IpeImage :: forall r. Prism' (IpeObject r) (IpeObject' Image r)
- type IpeObject' g r = g r :+ IpeAttributes g r
- ipeObject' :: ToObject i => i r -> IpeAttributes i r -> IpeObject r
- class ToObject i where
- mkIpeObject :: IpeObject' i r -> IpeObject r
- newtype Path r = Path (Seq (PathSegment r))
- pathSegments :: Iso (Path r) (Path r') (Seq (PathSegment r)) (Seq (PathSegment r'))
- data PathSegment r
- = PolyLineSegment (PolyLine (Point 2 r))
- | PolygonPath (SimplePolygon (Point 2 r))
- | CubicBezierSegment (CubicBezier (Point 2 r))
- | QuadraticBezierSegment (QuadraticBezier (Point 2 r))
- | EllipseSegment (Ellipse r)
- | ArcSegment
- | SplineSegment
- | ClosedSplineSegment
- data IpeSymbol r = Symbol (Point 2 r) Text
- symbolPoint :: Lens (IpeSymbol r) (IpeSymbol r') (Point 2 r) (Point 2 r')
- symbolName :: Lens' (IpeSymbol r) Text
- newtype Group r = Group [IpeObject r]
- groupItems :: Lens (Group r) (Group s) [IpeObject r] [IpeObject s]
- data TextLabel r = Label Text (Point 2 r)
- data MiniPage r = MiniPage Text (Point 2 r) r
- width :: MiniPage t -> t
- data Image r = Image () (Rectangle (Point 2 r))
- imageData :: Lens' (Image r) ()
- rect :: Lens (Image r) (Image r') (Rectangle (Point 2 r)) (Rectangle (Point 2 r'))
- type IpeBitmap = Text
- type IpeAttributes g r = Attributes' r (AttributesOf g)
- type Attributes' r = Attributes (AttrMapSym1 r)
- type family AttributesOf (t :: Type -> Type) :: [AttributeUniverse] where ...
- type family AttrMap (r :: Type) (l :: AttributeUniverse) :: Type where ...
- data AttrMapSym1 (a6989586621679250930 :: Type) :: (~>) AttributeUniverse Type
- attributes :: Lens' (IpeObject' g r) (IpeAttributes g r)
- traverseIpeAttrs :: (Applicative f, AllConstrained TraverseIpeAttr (AttributesOf g)) => proxy g -> (r -> f s) -> IpeAttributes g r -> f (IpeAttributes g s)
- commonAttributes :: Lens' (IpeObject r) (Attributes (AttrMapSym1 r) CommonAttributes)
- newtype LayerName = LayerName Text
- layerName :: Iso' LayerName Text
- data View = View [LayerName] LayerName
- layerNames :: Lens' View [LayerName]
- activeLayer :: Lens' View LayerName
- data IpeStyle = IpeStyle (Maybe Text) (Node Text Text)
- styleName :: Lens' IpeStyle (Maybe Text)
- styleData :: Lens' IpeStyle (Node Text Text)
- basicIpeStyle :: IpeStyle
- opacitiesStyle :: IpeStyle
- readIpeStylesheet :: OsPath -> IO (Either ConversionError IpeStyle)
- addStyleSheet :: IpeStyle -> IpeFile r -> IpeFile r
- addStyleSheetFrom :: OsPath -> IpeFile r -> IO (IpeFile r)
- data IpePreamble = IpePreamble (Maybe Text) Text
- encoding :: Lens' IpePreamble (Maybe Text)
- preambleData :: Lens' IpePreamble Text
- class IpeRead t where
- _asPoint :: Prism' (IpeSymbol r) (Point 2 r)
- _asLineSegment :: Prism' (Path r) (LineSegment AnEndPoint (Point 2 r))
- _asClosedLineSegment :: Prism' (Path r) (ClosedLineSegment (Point 2 r))
- _asRectangle :: forall r. (Num r, Ord r) => Prism' (Path r) (Rectangle (Point 2 r))
- _asTriangle :: Prism' (Path r) (Triangle (Point 2 r))
- _asPolyLine :: Prism' (Path r) (PolyLine (Point 2 r))
- _asSimplePolygon :: Prism' (Path r) (SimplePolygon (Point 2 r))
- _asConvexPolygon :: (Num r, Ord r) => Prism' (Path r) (ConvexPolygon (Point 2 r))
- _withAttrs :: Prism' (IpeObject r) (i r :+ IpeAttributes i r) -> Prism' (i r) g -> Prism' (IpeObject r) (g :+ IpeAttributes i r)
- class HasDefaultFromIpe g where
- type DefaultFromIpe g :: Type -> Type
- defaultFromIpe :: r ~ NumType g => Prism' (IpeObject r) (g :+ IpeAttributes (DefaultFromIpe g) r)
- class IpeWrite t where
- class IpeWriteText t where
- ipeWriteText :: t -> Maybe Text
- module Ipe.IpeOut
- module Ipe.Attributes
- module Ipe.Value
- newtype IpeColor r = IpeColor (IpeValue (RGB r))
- named :: Text -> IpeColor r
Ipe Files
A complete ipe file
Instances
Generic (IpeFile r) Source # | |
Show r => Show (IpeFile r) Source # | |
Eq r => Eq (IpeFile r) Source # | |
(Coordinate r, Eq r) => IpeRead (IpeFile r) Source # | |
Defined in Ipe.Reader | |
IpeWriteText r => IpeWrite (IpeFile r) Source # | |
type Rep (IpeFile r) Source # | |
Defined in Ipe.Types type Rep (IpeFile r) = D1 ('MetaData "IpeFile" "Ipe.Types" "hgeometry-1.0.0.0-inplace-ipe" 'False) (C1 ('MetaCons "IpeFile" 'PrefixI 'True) (S1 ('MetaSel ('Just "_preamble") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 (Maybe IpePreamble)) :*: (S1 ('MetaSel ('Just "_styles") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 [IpeStyle]) :*: S1 ('MetaSel ('Just "_pages") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 (NonEmpty (IpePage r)))))) |
preamble :: Lens' (IpeFile r) (Maybe IpePreamble) Source #
Lens to access the preamble of an ipe file
pages :: Lens (IpeFile r) (IpeFile r') (NonEmpty (IpePage r)) (NonEmpty (IpePage r')) Source #
Lens to access the pages of an ipe file
ipeFile :: NonEmpty (IpePage r) -> IpeFile r Source #
Convenience constructor for creating an ipe file without preamble and with the default stylesheet.
singlePageFile :: IpePage r -> IpeFile r Source #
Convenience function to construct an ipe file consisting of a single page.
singlePageFromContent :: [IpeObject r] -> IpeFile r Source #
Create a single page ipe file from a list of IpeObjects
Reading Ipe files
readIpeFile :: (Coordinate r, Eq r) => OsPath -> IO (Either ConversionError (IpeFile r)) Source #
Given a file path, tries to read an ipe file.
This function applies all matrices to objects.
readSinglePageFile :: (Coordinate r, Eq r) => OsPath -> IO (Either ConversionError (IpePage r)) Source #
Since most Ipe file contain only one page, we provide a shortcut for that as well.
This function applies all matrices, and it makes sure there is at least one layer and view in the page.
readSinglePageFileThrow :: (Coordinate r, Eq r) => OsPath -> IO (IpePage r) Source #
Tries to read a single page file, throws an error when this
fails. See readSinglePageFile
for further details.
readRawIpeFile :: (Coordinate r, Eq r) => OsPath -> IO (Either ConversionError (IpeFile r)) Source #
Given a file path, tries to read an ipe file
type ConversionError = Text Source #
Reading all Geometries from a single page ipe file
readAll :: forall g r. (HasDefaultFromIpe g, r ~ NumType g) => IpePage r -> [g :+ IpeAttributes (DefaultFromIpe g) r] Source #
Read all g's from some ipe page(s).
readAllFrom :: forall g r. (HasDefaultFromIpe g, r ~ NumType g, Coordinate r, Eq r) => OsPath -> IO [g :+ IpeAttributes (DefaultFromIpe g) r] Source #
Convenience function from reading all g's from an ipe file. If there is an error reading or parsing the file the error is "thrown away".
Writing ipe files
writeIpeFile :: IpeWriteText r => OsPath -> IpeFile r -> IO () Source #
Write an IpeFiele to file.
writeIpeFile' :: IpeWrite t => t -> OsPath -> IO () Source #
Convert to ipe XML and write the output to a file.
writeIpePage :: IpeWriteText r => OsPath -> IpePage r -> IO () Source #
Creates a single page ipe file with the given page
printAsIpeSelection :: IpeWrite t => t -> IO () Source #
Convert the input to ipeXml, and prints it to standard out in such a way that the copied text can be pasted into ipe as a geometry object.
toIpeSelectionXML :: IpeWrite t => t -> Maybe ByteString Source #
Convert input into an ipe selection.
Ipe Pages
An IpePage is essentially a Group, together with a list of layers and a list of views.
Instances
Generic (IpePage r) Source # | |
Show r => Show (IpePage r) Source # | |
Eq r => Eq (IpePage r) Source # | |
(Coordinate r, Eq r) => IpeRead (IpePage r) Source # | |
Defined in Ipe.Reader | |
IpeWriteText r => IpeWrite (IpePage r) Source # | |
type Rep (IpePage r) Source # | |
Defined in Ipe.Types type Rep (IpePage r) = D1 ('MetaData "IpePage" "Ipe.Types" "hgeometry-1.0.0.0-inplace-ipe" 'False) (C1 ('MetaCons "IpePage" 'PrefixI 'True) (S1 ('MetaSel ('Just "_layers") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 [LayerName]) :*: (S1 ('MetaSel ('Just "_views") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 [View]) :*: S1 ('MetaSel ('Just "_content") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 [IpeObject r])))) |
content :: Lens (IpePage r) (IpePage r') [IpeObject r] [IpeObject r'] Source #
Lens to access the content of an ipe page
fromContent :: [IpeObject r] -> IpePage r Source #
Creates a simple page with a single view.
onLayer :: LayerName -> Getting (Endo [IpeObject r]) [IpeObject r] (IpeObject r) Source #
This allows you to filter the objects on some layer.
>>>
let page = IpePage [] [] []
>>>
page^..content.onLayer "myLayer"
[]
contentInView :: Word -> Getter (IpePage r) [IpeObject r] Source #
Gets all objects that are visible in the given view.
Note that views are indexed starting from 0. If the page does not have any explicit view definitions, this function returns an empty list.
>>>
let page = IpePage [] [] []
>>>
page^.contentInView 0
[]
withDefaults :: IpePage r -> IpePage r Source #
Makes sure that the page has at least one layer and at least one view, essentially matching the behaviour of ipe. In particular,
- if the page does not have any layers, it creates a layer named "alpha", and
- if the page does not have any views, it creates a view in which all layers are visible.
Content: Ipe Objects
IpeGroup (IpeObject' Group r) | |
IpeImage (IpeObject' Image r) | |
IpeTextLabel (IpeObject' TextLabel r) | |
IpeMiniPage (IpeObject' MiniPage r) | |
IpeUse (IpeObject' IpeSymbol r) | |
IpePath (IpeObject' Path r) |
Instances
_IpeTextLabel :: forall r. Prism' (IpeObject r) (IpeObject' TextLabel r) Source #
_IpeMiniPage :: forall r. Prism' (IpeObject r) (IpeObject' MiniPage r) Source #
type IpeObject' g r = g r :+ IpeAttributes g r Source #
An IpeObject' is essentially the oject ogether with its attributes
ipeObject' :: ToObject i => i r -> IpeAttributes i r -> IpeObject r Source #
Shorthand for constructing ipeObjects
class ToObject i where Source #
mkIpeObject :: IpeObject' i r -> IpeObject r Source #
Instances
ToObject Group Source # | |
Defined in Ipe.Content mkIpeObject :: IpeObject' Group r -> IpeObject r Source # | |
ToObject Image Source # | |
Defined in Ipe.Content mkIpeObject :: IpeObject' Image r -> IpeObject r Source # | |
ToObject IpeSymbol Source # | |
Defined in Ipe.Content mkIpeObject :: IpeObject' IpeSymbol r -> IpeObject r Source # | |
ToObject MiniPage Source # | |
Defined in Ipe.Content mkIpeObject :: IpeObject' MiniPage r -> IpeObject r Source # | |
ToObject TextLabel Source # | |
Defined in Ipe.Content mkIpeObject :: IpeObject' TextLabel r -> IpeObject r Source # | |
ToObject Path Source # | |
Defined in Ipe.Content mkIpeObject :: IpeObject' Path r -> IpeObject r Source # |
Specific Ipe-Objects
A path is a non-empty sequence of PathSegments.
Path (Seq (PathSegment r)) |
Instances
pathSegments :: Iso (Path r) (Path r') (Seq (PathSegment r)) (Seq (PathSegment r')) Source #
Lens/Iso to access the sequcne of segments of the path
data PathSegment r Source #
Paths
Paths consist of Path Segments. PathSegments come in the following forms:
PolyLineSegment (PolyLine (Point 2 r)) | |
PolygonPath (SimplePolygon (Point 2 r)) | |
CubicBezierSegment (CubicBezier (Point 2 r)) | |
QuadraticBezierSegment (QuadraticBezier (Point 2 r)) | |
EllipseSegment (Ellipse r) | |
ArcSegment | |
SplineSegment | |
ClosedSplineSegment |
Instances
Ipe Symbols, i.e. Points
A symbol (point) in ipe
Instances
symbolPoint :: Lens (IpeSymbol r) (IpeSymbol r') (Point 2 r) (Point 2 r') Source #
Lens to access the position of the symbol
Groups and Objects
Group Attributes
A group is essentially a list of IpeObjects.
Instances
Foldable Group Source # | |
Defined in Ipe.Content fold :: Monoid m => Group m -> m # foldMap :: Monoid m => (a -> m) -> Group a -> m # foldMap' :: Monoid m => (a -> m) -> Group a -> m # foldr :: (a -> b -> b) -> b -> Group a -> b # foldr' :: (a -> b -> b) -> b -> Group a -> b # foldl :: (b -> a -> b) -> b -> Group a -> b # foldl' :: (b -> a -> b) -> b -> Group a -> b # foldr1 :: (a -> a -> a) -> Group a -> a # foldl1 :: (a -> a -> a) -> Group a -> a # elem :: Eq a => a -> Group a -> Bool # maximum :: Ord a => Group a -> a # minimum :: Ord a => Group a -> a # | |
Traversable Group Source # | |
Functor Group Source # | |
ToObject Group Source # | |
Defined in Ipe.Content mkIpeObject :: IpeObject' Group r -> IpeObject r Source # | |
Generic (Group r) Source # | |
Show r => Show (Group r) Source # | |
Eq r => Eq (Group r) Source # | |
HasDefaultIpeOut (Group r) Source # | |
Defined in Ipe.IpeOut | |
(Coordinate r, Eq r) => IpeRead (Group r) Source # | |
Defined in Ipe.Reader | |
IpeWriteText r => IpeWrite (Group r) Source # | |
Fractional r => IsTransformable (Group r) Source # | |
Defined in Ipe.Content transformBy :: Transformation (Dimension (Group r)) (NumType (Group r)) -> Group r -> Group r | |
type Rep (Group r) Source # | |
Defined in Ipe.Content | |
type DefaultIpeOut (Group r) Source # | |
Defined in Ipe.IpeOut | |
type Dimension (Group r) Source # | |
Defined in Ipe.Content type Dimension (Group r) = 2 | |
type NumType (Group r) Source # | |
Defined in Ipe.Content type NumType (Group r) = r |
Text Objects
A text label
Instances
A Minipage
Instances
Image Objects
bitmap image objects in Ipe
Image () (Rectangle (Point 2 r)) |
Instances
Foldable Image Source # | |
Defined in Ipe.Content fold :: Monoid m => Image m -> m # foldMap :: Monoid m => (a -> m) -> Image a -> m # foldMap' :: Monoid m => (a -> m) -> Image a -> m # foldr :: (a -> b -> b) -> b -> Image a -> b # foldr' :: (a -> b -> b) -> b -> Image a -> b # foldl :: (b -> a -> b) -> b -> Image a -> b # foldl' :: (b -> a -> b) -> b -> Image a -> b # foldr1 :: (a -> a -> a) -> Image a -> a # foldl1 :: (a -> a -> a) -> Image a -> a # elem :: Eq a => a -> Image a -> Bool # maximum :: Ord a => Image a -> a # minimum :: Ord a => Image a -> a # | |
Traversable Image Source # | |
Functor Image Source # | |
ToObject Image Source # | |
Defined in Ipe.Content mkIpeObject :: IpeObject' Image r -> IpeObject r Source # | |
Generic (Image r) Source # | |
Show r => Show (Image r) Source # | |
Eq r => Eq (Image r) Source # | |
Ord r => Ord (Image r) Source # | |
Coordinate r => IpeRead (Image r) Source # | |
Defined in Ipe.Reader | |
IpeWriteText r => IpeWrite (Image r) Source # | |
Fractional r => IsTransformable (Image r) Source # | |
Defined in Ipe.Content transformBy :: Transformation (Dimension (Image r)) (NumType (Image r)) -> Image r -> Image r | |
type Rep (Image r) Source # | |
Defined in Ipe.Content type Rep (Image r) = D1 ('MetaData "Image" "Ipe.Content" "hgeometry-1.0.0.0-inplace-ipe" 'False) (C1 ('MetaCons "Image" 'PrefixI 'True) (S1 ('MetaSel ('Just "_imageData") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 ()) :*: S1 ('MetaSel ('Just "_rect") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 (Rectangle (Point 2 r))))) | |
type Dimension (Image r) Source # | |
Defined in Ipe.Content type Dimension (Image r) = 2 | |
type NumType (Image r) Source # | |
Defined in Ipe.Content type NumType (Image r) = r |
rect :: Lens (Image r) (Image r') (Rectangle (Point 2 r)) (Rectangle (Point 2 r')) Source #
Lens to access the rectangle of the image
Attributes
type IpeAttributes g r = Attributes' r (AttributesOf g) Source #
type Attributes' r = Attributes (AttrMapSym1 r) Source #
Attributes' :: Type -> [AttributeUniverse] -> Type
type family AttributesOf (t :: Type -> Type) :: [AttributeUniverse] where ... Source #
type family AttrMap (r :: Type) (l :: AttributeUniverse) :: Type where ... Source #
The mapping between the labels of the the attributes and the types of the
attributes with these labels. For example, the Matrix
label/attribute should
have a value of type 'Matrix 3 3 r'.
AttrMap r 'Layer = LayerName | |
AttrMap r Matrix = Matrix 3 3 r | |
AttrMap r Pin = PinType | |
AttrMap r Transformations = TransformationTypes | |
AttrMap r Stroke = IpeColor r | |
AttrMap r Pen = IpePen r | |
AttrMap r Fill = IpeColor r | |
AttrMap r Size = IpeSize r | |
AttrMap r Dash = IpeDash r | |
AttrMap r LineCap = Int | |
AttrMap r LineJoin = Int | |
AttrMap r FillRule = FillType | |
AttrMap r Arrow = IpeArrow r | |
AttrMap r RArrow = IpeArrow r | |
AttrMap r StrokeOpacity = IpeOpacity | |
AttrMap r Opacity = IpeOpacity | |
AttrMap r Tiling = IpeTiling | |
AttrMap r Gradient = IpeGradient | |
AttrMap r Width = TextSizeUnit r | |
AttrMap r Height = TextSizeUnit r | |
AttrMap r Depth = TextSizeUnit r | |
AttrMap r VAlign = VerticalAlignment | |
AttrMap r HAlign = HorizontalAlignment | |
AttrMap r Style = TeXStyle | |
AttrMap r Clip = Path r |
data AttrMapSym1 (a6989586621679250930 :: Type) :: (~>) AttributeUniverse Type Source #
Instances
SuppressUnusedWarnings (AttrMapSym1 a6989586621679250930 :: TyFun AttributeUniverse Type -> Type) Source # | |
Defined in Ipe.Content suppressUnusedWarnings :: () Source # | |
type Apply (AttrMapSym1 a6989586621679250930 :: TyFun AttributeUniverse Type -> Type) (a6989586621679250931 :: AttributeUniverse) Source # | |
Defined in Ipe.Content type Apply (AttrMapSym1 a6989586621679250930 :: TyFun AttributeUniverse Type -> Type) (a6989586621679250931 :: AttributeUniverse) = AttrMap a6989586621679250930 a6989586621679250931 |
attributes :: Lens' (IpeObject' g r) (IpeAttributes g r) Source #
traverseIpeAttrs :: (Applicative f, AllConstrained TraverseIpeAttr (AttributesOf g)) => proxy g -> (r -> f s) -> IpeAttributes g r -> f (IpeAttributes g s) Source #
traverse for ipe attributes
commonAttributes :: Lens' (IpeObject r) (Attributes (AttrMapSym1 r) CommonAttributes) Source #
Layers and Views
Defines an Layer in Ipe.
Instances
IsString LayerName Source # | |
Defined in Ipe.Layer fromString :: String -> LayerName # | |
Read LayerName Source # | |
Show LayerName Source # | |
Eq LayerName Source # | |
Ord LayerName Source # | |
Defined in Ipe.Layer | |
IpeRead LayerName Source # | |
Defined in Ipe.Reader | |
IpeReadText LayerName Source # | |
Defined in Ipe.Reader | |
IpeWrite LayerName Source # | |
IpeWriteText LayerName Source # | |
Defined in Ipe.Writer |
The definition of a view make active layer into an index ?
Instances
Generic View Source # | |
Show View Source # | |
Eq View Source # | |
Ord View Source # | |
IpeRead View Source # | |
Defined in Ipe.Reader | |
IpeWrite View Source # | |
type Rep View Source # | |
Defined in Ipe.Types type Rep View = D1 ('MetaData "View" "Ipe.Types" "hgeometry-1.0.0.0-inplace-ipe" 'False) (C1 ('MetaCons "View" 'PrefixI 'True) (S1 ('MetaSel ('Just "_layerNames") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 [LayerName]) :*: S1 ('MetaSel ('Just "_activeLayer") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 LayerName))) |
Ipe Syles and Preamble
for now we pretty much ignore these
Instances
Generic IpeStyle Source # | |
Show IpeStyle Source # | |
Eq IpeStyle Source # | |
IpeRead IpeStyle Source # | |
Defined in Ipe.Reader | |
IpeWrite IpeStyle Source # | |
type Rep IpeStyle Source # | |
Defined in Ipe.Types type Rep IpeStyle = D1 ('MetaData "IpeStyle" "Ipe.Types" "hgeometry-1.0.0.0-inplace-ipe" 'False) (C1 ('MetaCons "IpeStyle" 'PrefixI 'True) (S1 ('MetaSel ('Just "_styleName") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 (Maybe Text)) :*: S1 ('MetaSel ('Just "_styleData") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 (Node Text Text)))) |
basicIpeStyle :: IpeStyle Source #
The "basic" ipe stylesheet
opacitiesStyle :: IpeStyle Source #
A stylesheet with some convenient predefined opacities. In particular the opacities "10%","20%",..,"90%".
readIpeStylesheet :: OsPath -> IO (Either ConversionError IpeStyle) Source #
Reads an Ipe stylesheet from Disk.
addStyleSheet :: IpeStyle -> IpeFile r -> IpeFile r Source #
Adds a stylesheet to the ipe file. This will be the first stylesheet, i.e. it has priority over all previously imported stylesheets.
addStyleSheetFrom :: OsPath -> IpeFile r -> IO (IpeFile r) Source #
Given a path to a stylesheet, add it to the ipe file with the highest priority. Throws an error when this fails.
data IpePreamble Source #
The maybe string is the encoding
Instances
preambleData :: Lens' IpePreamble Text Source #
Lens to access the preambleData
Reading Geometries *From* Ipe
class IpeRead t where Source #
Reading an ipe lement from Xml
Instances
IpeRead LayerName Source # | |
Defined in Ipe.Reader | |
IpeRead IpeStyle Source # | |
Defined in Ipe.Reader | |
IpeRead View Source # | |
Defined in Ipe.Reader | |
(Coordinate r, Eq r) => IpeRead (Group r) Source # | |
Defined in Ipe.Reader | |
Coordinate r => IpeRead (Image r) Source # | |
Defined in Ipe.Reader | |
(Coordinate r, Fractional r, Eq r) => IpeRead (IpeObject r) Source # | |
Defined in Ipe.Reader | |
Coordinate r => IpeRead (IpeSymbol r) Source # | Ipe read instances |
Defined in Ipe.Reader | |
Coordinate r => IpeRead (MiniPage r) Source # | |
Defined in Ipe.Reader | |
Coordinate r => IpeRead (TextLabel r) Source # | |
Defined in Ipe.Reader | |
(Coordinate r, Fractional r, Eq r) => IpeRead (Path r) Source # | |
Defined in Ipe.Reader | |
(Coordinate r, Eq r) => IpeRead (IpeFile r) Source # | |
Defined in Ipe.Reader | |
(Coordinate r, Eq r) => IpeRead (IpePage r) Source # | |
Defined in Ipe.Reader |
Converting *from* IpeObjects
_asPoint :: Prism' (IpeSymbol r) (Point 2 r) Source #
Extracts the point from a Symbol. When creating a symbol this creates a disk that supports a stroke color.
_asLineSegment :: Prism' (Path r) (LineSegment AnEndPoint (Point 2 r)) Source #
Try to convert a path into a line segment, fails if the path is not a line segment or a polyline with more than two points.
_asClosedLineSegment :: Prism' (Path r) (ClosedLineSegment (Point 2 r)) Source #
Try to convert a path into a line segment, fails if the path is not a line segment or a polyline with more than two points.
_asRectangle :: forall r. (Num r, Ord r) => Prism' (Path r) (Rectangle (Point 2 r)) Source #
Tries to convert a path into a rectangle.
_asTriangle :: Prism' (Path r) (Triangle (Point 2 r)) Source #
Convert to a triangle
_asPolyLine :: Prism' (Path r) (PolyLine (Point 2 r)) Source #
Convert to a polyline. Ignores all non-polyline parts
>>>
testPath ^? _asPolyLine
Just (PolyLine [Point2 0 0,Point2 10 10,Point2 200 100])
_asSimplePolygon :: Prism' (Path r) (SimplePolygon (Point 2 r)) Source #
Convert to a simple polygon
_asConvexPolygon :: (Num r, Ord r) => Prism' (Path r) (ConvexPolygon (Point 2 r)) Source #
Convert to a convex polygon
Dealing with Attributes
_withAttrs :: Prism' (IpeObject r) (i r :+ IpeAttributes i r) -> Prism' (i r) g -> Prism' (IpeObject r) (g :+ IpeAttributes i r) Source #
Use the first prism to select the ipe object to depicle with, and the second how to select the geometry object from there on. Then we can select the geometry object, directly with its attributes here.
>>>
testObject ^? _withAttrs _IpePath _asPolyLine
Just (PolyLine [Point2 0 0,Point2 10 10,Point2 200 100] :+ Attrs {NoAttr, NoAttr, NoAttr, NoAttr, Attr IpeColor (Named "red"), NoAttr, NoAttr, NoAttr, NoAttr, NoAttr, NoAttr, NoAttr, NoAttr, NoAttr, NoAttr, NoAttr, NoAttr})
Default readers
class HasDefaultFromIpe g where Source #
type DefaultFromIpe g :: Type -> Type Source #
defaultFromIpe :: r ~ NumType g => Prism' (IpeObject r) (g :+ IpeAttributes (DefaultFromIpe g) r) Source #
Instances
HasDefaultFromIpe (PolyLine (Point 2 r)) Source # | |
Defined in Ipe.FromIpe defaultFromIpe :: r0 ~ NumType (PolyLine (Point 2 r)) => Prism' (IpeObject r0) (PolyLine (Point 2 r) :+ IpeAttributes (DefaultFromIpe (PolyLine (Point 2 r))) r0) Source # | |
HasDefaultFromIpe (SimplePolygon (Point 2 r)) Source # | |
Defined in Ipe.FromIpe type DefaultFromIpe (SimplePolygon (Point 2 r)) :: Type -> Type Source # defaultFromIpe :: r0 ~ NumType (SimplePolygon (Point 2 r)) => Prism' (IpeObject r0) (SimplePolygon (Point 2 r) :+ IpeAttributes (DefaultFromIpe (SimplePolygon (Point 2 r))) r0) Source # | |
(Radical r, Eq r) => HasDefaultFromIpe (Circle (Point 2 r)) Source # | |
Defined in Ipe.FromIpe type DefaultFromIpe (Circle (Point 2 r)) :: Type -> Type Source # defaultFromIpe :: r0 ~ NumType (Circle (Point 2 r)) => Prism' (IpeObject r0) (Circle (Point 2 r) :+ IpeAttributes (DefaultFromIpe (Circle (Point 2 r))) r0) Source # | |
(Radical r, Eq r) => HasDefaultFromIpe (Disk (Point 2 r)) Source # | |
Defined in Ipe.FromIpe type DefaultFromIpe (Disk (Point 2 r)) :: Type -> Type Source # defaultFromIpe :: r0 ~ NumType (Disk (Point 2 r)) => Prism' (IpeObject r0) (Disk (Point 2 r) :+ IpeAttributes (DefaultFromIpe (Disk (Point 2 r))) r0) Source # | |
(Num r, Ord r) => HasDefaultFromIpe (Rectangle (Point 2 r)) Source # | |
Defined in Ipe.FromIpe type DefaultFromIpe (Rectangle (Point 2 r)) :: Type -> Type Source # defaultFromIpe :: r0 ~ NumType (Rectangle (Point 2 r)) => Prism' (IpeObject r0) (Rectangle (Point 2 r) :+ IpeAttributes (DefaultFromIpe (Rectangle (Point 2 r))) r0) Source # | |
HasDefaultFromIpe (Ellipse r) Source # | |
Defined in Ipe.FromIpe type DefaultFromIpe (Ellipse r) :: Type -> Type Source # defaultFromIpe :: r0 ~ NumType (Ellipse r) => Prism' (IpeObject r0) (Ellipse r :+ IpeAttributes (DefaultFromIpe (Ellipse r)) r0) Source # | |
HasDefaultFromIpe (ClosedLineSegment (Point 2 r)) Source # | |
Defined in Ipe.FromIpe type DefaultFromIpe (ClosedLineSegment (Point 2 r)) :: Type -> Type Source # defaultFromIpe :: r0 ~ NumType (ClosedLineSegment (Point 2 r)) => Prism' (IpeObject r0) (ClosedLineSegment (Point 2 r) :+ IpeAttributes (DefaultFromIpe (ClosedLineSegment (Point 2 r))) r0) Source # | |
HasDefaultFromIpe (LineSegment AnEndPoint (Point 2 r)) Source # | |
Defined in Ipe.FromIpe type DefaultFromIpe (LineSegment AnEndPoint (Point 2 r)) :: Type -> Type Source # defaultFromIpe :: r0 ~ NumType (LineSegment AnEndPoint (Point 2 r)) => Prism' (IpeObject r0) (LineSegment AnEndPoint (Point 2 r) :+ IpeAttributes (DefaultFromIpe (LineSegment AnEndPoint (Point 2 r))) r0) Source # | |
HasDefaultFromIpe (Point 2 r) Source # | |
Defined in Ipe.FromIpe type DefaultFromIpe (Point 2 r) :: Type -> Type Source # defaultFromIpe :: r0 ~ NumType (Point 2 r) => Prism' (IpeObject r0) (Point 2 r :+ IpeAttributes (DefaultFromIpe (Point 2 r)) r0) Source # |
Converting *to* IpeObjects
IpeWrite
class IpeWrite t where Source #
Types that correspond to an XML Element. All instances should produce an
Element. If the type should produce a Node with the Text constructor, use
the IpeWriteText
typeclass instead.
Instances
class IpeWriteText t where Source #
For types that can produce a text value
ipeWriteText :: t -> Maybe Text Source #
Instances
IpeOut
module Ipe.IpeOut
Batch reexports
module Ipe.Attributes
module Ipe.Value
Defines a color in Ipe. Colors are either RGB Values or Named values.