-- Hoogle documentation, generated by Haddock -- See Hoogle, http://www.haskell.org/hoogle/ -- | Manipulation of FIG files -- -- The Fig library provides parsing and printing for the FIG 3.2 format -- (the format used by the Xfig drawing program) together with a simple -- search-and-replace facility. @package fig @version 1.4.0 -- | Abstract syntax for the FIG format. -- -- For the meaning of the different syntax elements, refer to the FIG -- format description -- (http://www.xfig.org/userman/fig-format.html) and the Xfig user -- interface itself. module Graphics.Fig.Syntax data Fig Fig :: Header -> [Commented Color] -> [Commented Object] -> Fig fig_header :: Fig -> Header fig_colors :: Fig -> [Commented Color] fig_objects :: Fig -> [Commented Object] data Header Header :: Orientation -> Justification -> Units -> PaperSize -> Double -> MultiplePage -> Transparent -> [String] -> Integer -> CoordinateSystem -> Header header_orientation :: Header -> Orientation header_justification :: Header -> Justification header_units :: Header -> Units header_papersize :: Header -> PaperSize header_magnification :: Header -> Double header_multiple_page :: Header -> MultiplePage header_transparent_color :: Header -> Transparent header_comment :: Header -> [String] header_resolution :: Header -> Integer header_coord_system :: Header -> CoordinateSystem data Orientation Landscape :: Orientation Portrait :: Orientation data Justification Center :: Justification FlushLeft :: Justification data Units Metric :: Units Inches :: Units data PaperSize Letter :: PaperSize Legal :: PaperSize Ledger :: PaperSize Tabloid :: PaperSize A :: PaperSize B :: PaperSize C :: PaperSize D :: PaperSize E :: PaperSize A4 :: PaperSize A3 :: PaperSize A2 :: PaperSize A1 :: PaperSize A0 :: PaperSize B5 :: PaperSize data MultiplePage Single :: MultiplePage Multiple :: MultiplePage data Transparent Background :: Transparent None :: Transparent TransparentDefault :: Transparent Transparent :: ColorSpec -> Transparent data CoordinateSystem LowerLeft :: CoordinateSystem UpperLeft :: CoordinateSystem data Commented a Comment :: [String] -> a -> Commented a data Color Color :: Integer -> String -> Color color_number :: Color -> Integer color_rgb_values :: Color -> String data Object Text :: Integer -> ColorSpec -> Integer -> Integer -> Font -> Double -> Double -> FontFlags -> Double -> Double -> Integer -> Integer -> String -> Object text_sub_type :: Object -> Integer text_color :: Object -> ColorSpec text_depth :: Object -> Integer text_pen_style :: Object -> Integer text_font :: Object -> Font text_font_size :: Object -> Double text_angle :: Object -> Double text_font_flags :: Object -> FontFlags text_height :: Object -> Double text_length :: Object -> Double text_x :: Object -> Integer text_y :: Object -> Integer text_string :: Object -> String Arc :: ArcLine -> (Maybe Arrow) -> (Maybe Arrow) -> Object Spline :: SplineLine -> (Maybe Arrow) -> (Maybe Arrow) -> [(Integer, Integer)] -> [Double] -> Object Ellipse :: Common -> Integer -> Double -> Integer -> Integer -> Integer -> Integer -> Integer -> Integer -> Integer -> Integer -> Object ellipse_common :: Object -> Common ellipse_direction :: Object -> Integer ellipse_angle :: Object -> Double ellipse_center_x :: Object -> Integer ellipse_center_y :: Object -> Integer ellipse_radius_x :: Object -> Integer ellipse_radius_y :: Object -> Integer ellipse_start_x :: Object -> Integer ellipse_start_y :: Object -> Integer ellipse_end_x :: Object -> Integer ellipse_end_y :: Object -> Integer Compound :: CompoundLine -> [Commented Object] -> Object Polyline :: PolylineLine -> (Maybe Arrow) -> (Maybe Arrow) -> (Maybe Pic) -> [(Integer, Integer)] -> Object data ArcLine ArcLine :: Common -> CapStyle -> Integer -> Double -> Double -> Integer -> Integer -> Integer -> Integer -> Integer -> Integer -> ArcLine arc_common :: ArcLine -> Common arc_cap_style :: ArcLine -> CapStyle arc_direction :: ArcLine -> Integer arc_center_x :: ArcLine -> Double arc_center_y :: ArcLine -> Double arc_x1 :: ArcLine -> Integer arc_y1 :: ArcLine -> Integer arc_x2 :: ArcLine -> Integer arc_y2 :: ArcLine -> Integer arc_x3 :: ArcLine -> Integer arc_y3 :: ArcLine -> Integer data SplineLine SplineLine :: Common -> CapStyle -> SplineLine spline_common :: SplineLine -> Common spline_cap_style :: SplineLine -> CapStyle data PolylineLine PolylineLine :: Common -> JoinStyle -> CapStyle -> Integer -> PolylineLine polyline_common :: PolylineLine -> Common polyline_join_style :: PolylineLine -> JoinStyle polyline_cap_style :: PolylineLine -> CapStyle polyline_radius :: PolylineLine -> Integer data CompoundLine CompoundLine :: Integer -> Integer -> Integer -> Integer -> CompoundLine compound_upperleft_corner_x :: CompoundLine -> Integer compound_upperleft_corner_y :: CompoundLine -> Integer compound_lowerright_corner_x :: CompoundLine -> Integer compound_lowerright_corner_y :: CompoundLine -> Integer data Common Common :: Integer -> LineStyle -> Integer -> ColorSpec -> ColorSpec -> Integer -> Integer -> AreaFill -> Double -> Common sub_type :: Common -> Integer line_style :: Common -> LineStyle line_thickness :: Common -> Integer pen_color :: Common -> ColorSpec fill_color :: Common -> ColorSpec depth :: Common -> Integer pen_style :: Common -> Integer area_fill :: Common -> AreaFill style_val :: Common -> Double data Arrow Arrow :: ArrowType -> ArrowStyle -> Double -> Double -> Double -> Arrow arrow_type :: Arrow -> ArrowType arrow_style :: Arrow -> ArrowStyle arrow_thickness :: Arrow -> Double arrow_width :: Arrow -> Double arrow_height :: Arrow -> Double data ArrowStyle HollowArrow :: ArrowStyle FilledArrow :: ArrowStyle data ArrowType Stick :: ArrowType Closed :: ArrowType Indented :: ArrowType Pointed :: ArrowType data Pic Pic :: Flipped -> String -> Pic pic_flipped :: Pic -> Flipped pic_file :: Pic -> String data Flipped Normal :: Flipped Flipped :: Flipped data CapStyle Butt :: CapStyle CapRound :: CapStyle Projecting :: CapStyle data JoinStyle Miter :: JoinStyle JoinRound :: JoinStyle Bevel :: JoinStyle data LineStyle LineStyleDefault :: LineStyle Solid :: LineStyle Dashed :: LineStyle Dotted :: LineStyle DashDotted :: LineStyle DashDoubleDotted :: LineStyle DashTripleDotted :: LineStyle data Font Latex :: LatexFont -> Font Ps :: PsFont -> Font data LatexFont LatexDefault :: LatexFont Roman :: LatexFont Bold :: LatexFont Italic :: LatexFont SansSerif :: LatexFont Typewriter :: LatexFont data PsFont PsDefault :: PsFont TimesRoman :: PsFont TimesItalic :: PsFont TimesBold :: PsFont TimesBoldItalic :: PsFont AvantGardeBook :: PsFont AvantGardeBookOblique :: PsFont AvantGardeDemi :: PsFont AvantGardeDemiOblique :: PsFont BookmanLight :: PsFont BookmanLightItalic :: PsFont BookmanDemi :: PsFont BookmanDemiItalic :: PsFont Courier :: PsFont CourierOblique :: PsFont CourierBold :: PsFont CourierBoldOblique :: PsFont Helvetica :: PsFont HelveticaOblique :: PsFont HelveticaBold :: PsFont HelveticaBoldOblique :: PsFont HelveticaNarrow :: PsFont HelveticaNarrowOblique :: PsFont HelveticaNarrowBold :: PsFont HelveticaNarrowBoldOblique :: PsFont NewCenturySchoolbookRoman :: PsFont NewCenturySchoolbookItalic :: PsFont NewCenturySchoolbookBold :: PsFont NewCenturySchoolbookBoldItalic :: PsFont PalatinoRoman :: PsFont PalatinoItalic :: PsFont PalatinoBold :: PsFont PalatinoBoldItalic :: PsFont Symbol :: PsFont ZapfChanceryMediumItalic :: PsFont ZapfDingbats :: PsFont data FontFlags FontFlags :: Bool -> Bool -> Bool -> FontFlags hidden :: FontFlags -> Bool special :: FontFlags -> Bool rigid :: FontFlags -> Bool data ColorSpec ColorSpecDefault :: ColorSpec Black :: ColorSpec Blue :: ColorSpec Green :: ColorSpec Cyan :: ColorSpec Red :: ColorSpec Magenta :: ColorSpec Yellow :: ColorSpec White :: ColorSpec Blue4 :: ColorSpec Blue3 :: ColorSpec Blue2 :: ColorSpec LtBlue :: ColorSpec Green4 :: ColorSpec Green3 :: ColorSpec Green2 :: ColorSpec Cyan4 :: ColorSpec Cyan3 :: ColorSpec Cyan2 :: ColorSpec Red4 :: ColorSpec Red3 :: ColorSpec Red2 :: ColorSpec Magenta4 :: ColorSpec Magenta3 :: ColorSpec Magenta2 :: ColorSpec Brown4 :: ColorSpec Brown3 :: ColorSpec Brown2 :: ColorSpec Pink4 :: ColorSpec Pink3 :: ColorSpec Pink2 :: ColorSpec Pink :: ColorSpec Gold :: ColorSpec UserDefined :: Integer -> ColorSpec data AreaFill NoFill :: AreaFill Filled :: Integer -> AreaFill Pattern :: Integer -> AreaFill instance Show Orientation instance Eq Orientation instance Ord Orientation instance Show Justification instance Eq Justification instance Show Units instance Eq Units instance Ord Units instance Show PaperSize instance Eq PaperSize instance Ord PaperSize instance Show MultiplePage instance Eq MultiplePage instance Ord MultiplePage instance Show CoordinateSystem instance Eq CoordinateSystem instance Ord CoordinateSystem instance Show a => Show (Commented a) instance Eq a => Eq (Commented a) instance Show Color instance Eq Color instance Show CompoundLine instance Eq CompoundLine instance Show ArrowStyle instance Eq ArrowStyle instance Ord ArrowStyle instance Show ArrowType instance Eq ArrowType instance Ord ArrowType instance Show Arrow instance Eq Arrow instance Show Flipped instance Eq Flipped instance Ord Flipped instance Show Pic instance Eq Pic instance Show CapStyle instance Eq CapStyle instance Ord CapStyle instance Show JoinStyle instance Eq JoinStyle instance Ord JoinStyle instance Show LineStyle instance Eq LineStyle instance Ord LineStyle instance Show LatexFont instance Eq LatexFont instance Ord LatexFont instance Show PsFont instance Eq PsFont instance Ord PsFont instance Show Font instance Eq Font instance Ord Font instance Show FontFlags instance Eq FontFlags instance Show ColorSpec instance Eq ColorSpec instance Ord ColorSpec instance Show Transparent instance Eq Transparent instance Show Header instance Eq Header instance Show AreaFill instance Eq AreaFill instance Ord AreaFill instance Show Common instance Eq Common instance Show PolylineLine instance Eq PolylineLine instance Show SplineLine instance Eq SplineLine instance Show ArcLine instance Eq ArcLine instance Show Object instance Eq Object instance Show Fig instance Eq Fig -- | Translations between integer or string values and data types. -- -- This (internal) module converts between the character encodings of the -- FIG files and the primitive types of Graphics.Fig.Syntax -- (PaperSize, CoordinateSystem, etc.). module Graphics.Fig.Values begin_color :: [Char] begin_ellipse :: [Char] begin_polyline :: [Char] begin_spline :: [Char] begin_text :: [Char] begin_arc :: [Char] begin_compound :: [Char] begin_comment :: [Char] end_compound :: [Char] header_version :: [Char] toOrientation :: [Char] -> Either [Char] Orientation toUnits :: [Char] -> Either [Char] Units toPaperSize :: [Char] -> Either [Char] PaperSize toMultiplePage :: [Char] -> Either [Char] MultiplePage toTransparent :: Integer -> Either [Char] Transparent toCoordinateSystem :: Integer -> Either [Char] CoordinateSystem toFontFlags :: Integer -> Either [Char] (FontFlags, Bool) toFont :: Bool -> Integer -> Either [Char] Font toPsFont :: Integer -> Either [Char] PsFont toLatexFont :: Integer -> Either [Char] LatexFont toFlipped :: Integer -> Either [Char] Flipped toArrowStyle :: Integer -> Either [Char] ArrowStyle toArrowType :: Integer -> Either [Char] ArrowType toCapStyle :: Integer -> Either [Char] CapStyle toJoinStyle :: Integer -> Either [Char] JoinStyle toLineStyle :: Integer -> Either [Char] LineStyle toColorSpec :: Integer -> Either [Char] ColorSpec toAreaFill :: Integer -> Either [Char] AreaFill toFromValue :: (Ord k, Ord a, Show a) => [(a, k)] -> (a -> Either [Char] k, k -> a) -- | Pretty printer for the FIG format. module Graphics.Fig.Printer -- | Convert a figure to a string in the FIG format. pretty :: Fig -> String instance Docable Font instance Docable CoordinateSystem instance Docable Transparent instance Docable AreaFill instance Docable ColorSpec instance Docable ArrowStyle instance Docable ArrowType instance Docable Flipped instance Docable CapStyle instance Docable JoinStyle instance Docable LineStyle instance Docable Justification instance Docable MultiplePage instance Docable PaperSize instance Docable Units instance Docable Orientation instance Docable Double instance Docable Integer instance Docable Int -- | Parser for the FIG format. module Graphics.Fig.Parser -- | Parse a string in the FIG format. parse :: FilePath -> String -> Either String Fig -- | The example below illustrates the typical use of the Fig library. The -- program parses a FIG file read from stdin, applies a transformation to -- the figure, and emits the result to stdout. -- --
--   module Main where
--   
--   import Graphics.Fig
--   
--   main = do
--        input <- getContents
--        either fail succeed
--            (parse "stdin" input)
--        where
--        succeed = putStr . pretty . process
--   
--   process = applyReplaceDef replaceDef
--   
--   replaceDef =
--        emptyDef
--            { linePenColor = const Magenta
--            , arrowWidth = (* 1.5)
--            , areaFillColor = x ->
--                case x of
--                    Green4 -> LtBlue
--                    LtBlue -> Green4
--                    _ -> x
--            }
--   
module Graphics.Fig -- | Replacement operations for a figure. -- -- A ReplaceDef value is a record of functions to apply to the -- leaf elements of a Fig syntax tree (see -- applyReplaceDef). data ReplaceDef ReplaceDef :: (Orientation -> Orientation) -> (Justification -> Justification) -> (Units -> Units) -> (PaperSize -> PaperSize) -> (Double -> Double) -> (MultiplePage -> MultiplePage) -> (Transparent -> Transparent) -> (Integer -> Integer) -> (ColorSpec -> ColorSpec) -> (Double -> Double) -> (Font -> Font) -> (FontFlags -> FontFlags) -> (Flipped -> Flipped) -> (FilePath -> FilePath) -> (ArrowType -> ArrowType) -> (ArrowStyle -> ArrowStyle) -> (Double -> Double) -> (Double -> Double) -> (Double -> Double) -> (AreaFill -> AreaFill) -> (ColorSpec -> ColorSpec) -> (LineStyle -> LineStyle) -> (Integer -> Integer) -> (ColorSpec -> ColorSpec) -> (Double -> Double) -> (CapStyle -> CapStyle) -> (JoinStyle -> JoinStyle) -> ReplaceDef headerOrientation :: ReplaceDef -> Orientation -> Orientation headerJustification :: ReplaceDef -> Justification -> Justification headerUnits :: ReplaceDef -> Units -> Units headerPapersize :: ReplaceDef -> PaperSize -> PaperSize headerMagnification :: ReplaceDef -> Double -> Double headerMultiplePage :: ReplaceDef -> MultiplePage -> MultiplePage headerTransparentColor :: ReplaceDef -> Transparent -> Transparent headerResolution :: ReplaceDef -> Integer -> Integer textColor :: ReplaceDef -> ColorSpec -> ColorSpec textFontSize :: ReplaceDef -> Double -> Double textFont :: ReplaceDef -> Font -> Font textFontFlags :: ReplaceDef -> FontFlags -> FontFlags picFlipped :: ReplaceDef -> Flipped -> Flipped picFile :: ReplaceDef -> FilePath -> FilePath arrowType :: ReplaceDef -> ArrowType -> ArrowType arrowStyle :: ReplaceDef -> ArrowStyle -> ArrowStyle arrowThickness :: ReplaceDef -> Double -> Double arrowWidth :: ReplaceDef -> Double -> Double arrowHeight :: ReplaceDef -> Double -> Double areaFill :: ReplaceDef -> AreaFill -> AreaFill areaFillColor :: ReplaceDef -> ColorSpec -> ColorSpec lineStyle :: ReplaceDef -> LineStyle -> LineStyle lineThickness :: ReplaceDef -> Integer -> Integer linePenColor :: ReplaceDef -> ColorSpec -> ColorSpec lineStyleVal :: ReplaceDef -> Double -> Double lineCapStyle :: ReplaceDef -> CapStyle -> CapStyle lineJoinStyle :: ReplaceDef -> JoinStyle -> JoinStyle -- | The empty replacement operation: All functions of the -- ReplaceDef record are equal to the identity function. emptyDef :: ReplaceDef -- | Apply a replacement operation to a figure. applyReplaceDef :: ReplaceDef -> Fig -> Fig -- | Parse a string in the FIG format. parse :: FilePath -> String -> Either String Fig -- | Convert a figure to a string in the FIG format. pretty :: Fig -> String