Copyright | (c) 2018 Francisco Vallarino |
---|---|
License | BSD-3-Clause (see the LICENSE file) |
Maintainer | fjvallarino@gmail.com |
Stability | experimental |
Portability | non-portable |
Safe Haskell | Safe-Inferred |
Language | Haskell2010 |
Basic types for Graphics.
Angles are always expressed in degrees, not radians.
Synopsis
- data Winding
- data Color = Color {}
- data FontDef
- = FontDefFile {
- _fntFontName :: !Text
- _fntFontPath :: !Text
- | FontDefMem {
- _fntFontName :: !Text
- _fntFontBytes :: !ByteString
- = FontDefFile {
- newtype Font = Font {}
- newtype FontSize = FontSize {
- unFontSize :: Double
- newtype FontSpace = FontSpace {}
- data RectSide
- data RectCorner
- data AlignH
- data AlignV
- data AlignTH
- data AlignTV
- data GlyphPos = GlyphPos {}
- data TextMode
- data TextTrim
- data TextOverflow
- data TextMetrics = TextMetrics {}
- data TextLine = TextLine {
- _tlFont :: !Font
- _tlFontSize :: !FontSize
- _tlFontSpaceH :: !FontSpace
- _tlFontSpaceV :: !FontSpace
- _tlMetrics :: !TextMetrics
- _tlText :: !Text
- _tlSize :: !Size
- _tlRect :: !Rect
- _tlGlyphs :: !(Seq GlyphPos)
- data ImageFlag
- data ImageDef = ImageDef {
- _idfName :: Text
- _idfSize :: Size
- _idfImgData :: ByteString
- _idfFlags :: [ImageFlag]
- data FontManager = FontManager {
- computeTextMetrics :: Font -> FontSize -> TextMetrics
- computeTextMetrics_ :: Double -> Font -> FontSize -> TextMetrics
- computeTextSize :: Font -> FontSize -> FontSpace -> Text -> Size
- computeTextSize_ :: Double -> Font -> FontSize -> FontSpace -> Text -> Size
- computeGlyphsPos :: Font -> FontSize -> FontSpace -> Text -> Seq GlyphPos
- computeGlyphsPos_ :: Double -> Font -> FontSize -> FontSpace -> Text -> Seq GlyphPos
- data Renderer = Renderer {
- beginFrame :: Double -> Double -> IO ()
- endFrame :: IO ()
- beginPath :: IO ()
- closePath :: IO ()
- saveContext :: IO ()
- restoreContext :: IO ()
- createOverlay :: IO () -> IO ()
- renderOverlays :: IO ()
- createRawTask :: IO () -> IO ()
- renderRawTasks :: IO ()
- createRawOverlay :: IO () -> IO ()
- renderRawOverlays :: IO ()
- intersectScissor :: Rect -> IO ()
- setTranslation :: Point -> IO ()
- setScale :: Point -> IO ()
- setRotation :: Double -> IO ()
- setGlobalAlpha :: Double -> IO ()
- setPathWinding :: Winding -> IO ()
- stroke :: IO ()
- setStrokeWidth :: Double -> IO ()
- setStrokeColor :: Color -> IO ()
- setStrokeLinearGradient :: Point -> Point -> Color -> Color -> IO ()
- setStrokeRadialGradient :: Point -> Double -> Double -> Color -> Color -> IO ()
- setStrokeBoxGradient :: Rect -> Double -> Double -> Color -> Color -> IO ()
- setStrokeImagePattern :: Text -> Point -> Size -> Double -> Double -> IO ()
- fill :: IO ()
- setFillColor :: Color -> IO ()
- setFillLinearGradient :: Point -> Point -> Color -> Color -> IO ()
- setFillRadialGradient :: Point -> Double -> Double -> Color -> Color -> IO ()
- setFillBoxGradient :: Rect -> Double -> Double -> Color -> Color -> IO ()
- setFillImagePattern :: Text -> Point -> Size -> Double -> Double -> IO ()
- moveTo :: Point -> IO ()
- renderLine :: Point -> Point -> IO ()
- renderLineTo :: Point -> IO ()
- renderRect :: Rect -> IO ()
- renderRoundedRect :: Rect -> Double -> Double -> Double -> Double -> IO ()
- renderArc :: Point -> Double -> Double -> Double -> Winding -> IO ()
- renderQuadTo :: Point -> Point -> IO ()
- renderEllipse :: Rect -> IO ()
- renderText :: Point -> Font -> FontSize -> FontSpace -> Text -> IO ()
- getImage :: Text -> IO (Maybe ImageDef)
- addImage :: Text -> Size -> ByteString -> [ImageFlag] -> IO ()
- updateImage :: Text -> Size -> ByteString -> IO ()
- deleteImage :: Text -> IO ()
Documentation
Direction in which triangles and arcs are drawn.
An RGBA color.
Instances
FontDefFile | |
| |
FontDefMem | |
|
Instances
Generic FontDef Source # | |
Show FontDef Source # | |
Eq FontDef Source # | |
HasFontBytes FontDef ByteString Source # | |
Defined in Monomer.Graphics.Lens | |
HasFontName FontDef Text Source # | |
HasFontPath FontDef Text Source # | |
Defined in Monomer.Graphics.Lens | |
HasFonts (AppConfig e) [FontDef] Source # | |
type Rep FontDef Source # | |
Defined in Monomer.Graphics.Types type Rep FontDef = D1 ('MetaData "FontDef" "Monomer.Graphics.Types" "monomer-1.5.0.0-Qyhewrg5o52dfUHeNdP9B" 'False) (C1 ('MetaCons "FontDefFile" 'PrefixI 'True) (S1 ('MetaSel ('Just "_fntFontName") 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict) (Rec0 Text) :*: S1 ('MetaSel ('Just "_fntFontPath") 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict) (Rec0 Text)) :+: C1 ('MetaCons "FontDefMem" 'PrefixI 'True) (S1 ('MetaSel ('Just "_fntFontName") 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict) (Rec0 Text) :*: S1 ('MetaSel ('Just "_fntFontBytes") 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict) (Rec0 ByteString))) |
The name of a loaded font.
Instances
IsString Font Source # | |
Defined in Monomer.Graphics.Types fromString :: String -> Font # | |
Generic Font Source # | |
Show Font Source # | |
Default Font Source # | |
Defined in Monomer.Graphics.Types | |
Eq Font Source # | |
HasFont TextLine Font Source # | |
HasFont TextStyle (Maybe Font) Source # | |
type Rep Font Source # | |
Defined in Monomer.Graphics.Types |
The size of a font.
The spacing of a font. Zero represents the default spacing of the font.
Instances
Generic FontSpace Source # | |
Show FontSpace Source # | |
Default FontSpace Source # | |
Defined in Monomer.Graphics.Types | |
Eq FontSpace Source # | |
HasFontSpaceH TextLine FontSpace Source # | |
Defined in Monomer.Graphics.Lens | |
HasFontSpaceV TextLine FontSpace Source # | |
Defined in Monomer.Graphics.Lens | |
HasFontSpaceH TextStyle (Maybe FontSpace) Source # | |
Defined in Monomer.Core.Lens | |
HasFontSpaceV TextStyle (Maybe FontSpace) Source # | |
Defined in Monomer.Core.Lens | |
type Rep FontSpace Source # | |
Defined in Monomer.Graphics.Types |
Represents the sides of a rectangle.
data RectCorner Source #
Represents the corners of a rectangle.
Instances
Show RectCorner Source # | |
Defined in Monomer.Graphics.Types showsPrec :: Int -> RectCorner -> ShowS # show :: RectCorner -> String # showList :: [RectCorner] -> ShowS # | |
Eq RectCorner Source # | |
Defined in Monomer.Graphics.Types (==) :: RectCorner -> RectCorner -> Bool # (/=) :: RectCorner -> RectCorner -> Bool # |
Horizontal alignment flags.
Instances
Generic AlignH Source # | |
Show AlignH Source # | |
Default AlignH Source # | |
Defined in Monomer.Graphics.Types | |
Eq AlignH Source # | |
HasShadowAlignH ThemeState AlignH Source # | |
Defined in Monomer.Core.Lens | |
type Rep AlignH Source # | |
Defined in Monomer.Graphics.Types type Rep AlignH = D1 ('MetaData "AlignH" "Monomer.Graphics.Types" "monomer-1.5.0.0-Qyhewrg5o52dfUHeNdP9B" 'False) (C1 ('MetaCons "ALeft" 'PrefixI 'False) (U1 :: Type -> Type) :+: (C1 ('MetaCons "ACenter" 'PrefixI 'False) (U1 :: Type -> Type) :+: C1 ('MetaCons "ARight" 'PrefixI 'False) (U1 :: Type -> Type))) |
Vertical alignment flags.
Instances
Generic AlignV Source # | |
Show AlignV Source # | |
Default AlignV Source # | |
Defined in Monomer.Graphics.Types | |
Eq AlignV Source # | |
HasShadowAlignV ThemeState AlignV Source # | |
Defined in Monomer.Core.Lens | |
type Rep AlignV Source # | |
Defined in Monomer.Graphics.Types type Rep AlignV = D1 ('MetaData "AlignV" "Monomer.Graphics.Types" "monomer-1.5.0.0-Qyhewrg5o52dfUHeNdP9B" 'False) (C1 ('MetaCons "ATop" 'PrefixI 'False) (U1 :: Type -> Type) :+: (C1 ('MetaCons "AMiddle" 'PrefixI 'False) (U1 :: Type -> Type) :+: C1 ('MetaCons "ABottom" 'PrefixI 'False) (U1 :: Type -> Type))) |
Text horizontal alignment flags.
Instances
Generic AlignTH Source # | |
Show AlignTH Source # | |
Default AlignTH Source # | |
Defined in Monomer.Graphics.Types | |
Eq AlignTH Source # | |
HasAlignH TextStyle (Maybe AlignTH) Source # | |
type Rep AlignTH Source # | |
Defined in Monomer.Graphics.Types type Rep AlignTH = D1 ('MetaData "AlignTH" "Monomer.Graphics.Types" "monomer-1.5.0.0-Qyhewrg5o52dfUHeNdP9B" 'False) (C1 ('MetaCons "ATLeft" 'PrefixI 'False) (U1 :: Type -> Type) :+: (C1 ('MetaCons "ATCenter" 'PrefixI 'False) (U1 :: Type -> Type) :+: C1 ('MetaCons "ATRight" 'PrefixI 'False) (U1 :: Type -> Type))) |
Text vertical alignment flags.
Instances
Generic AlignTV Source # | |
Show AlignTV Source # | |
Default AlignTV Source # | |
Defined in Monomer.Graphics.Types | |
Eq AlignTV Source # | |
HasAlignV TextStyle (Maybe AlignTV) Source # | |
type Rep AlignTV Source # | |
Defined in Monomer.Graphics.Types type Rep AlignTV = D1 ('MetaData "AlignTV" "Monomer.Graphics.Types" "monomer-1.5.0.0-Qyhewrg5o52dfUHeNdP9B" 'False) ((C1 ('MetaCons "ATTop" 'PrefixI 'False) (U1 :: Type -> Type) :+: (C1 ('MetaCons "ATMiddle" 'PrefixI 'False) (U1 :: Type -> Type) :+: C1 ('MetaCons "ATAscender" 'PrefixI 'False) (U1 :: Type -> Type))) :+: (C1 ('MetaCons "ATLowerX" 'PrefixI 'False) (U1 :: Type -> Type) :+: (C1 ('MetaCons "ATBottom" 'PrefixI 'False) (U1 :: Type -> Type) :+: C1 ('MetaCons "ATBaseline" 'PrefixI 'False) (U1 :: Type -> Type)))) |
Information of a text glyph instance.
GlyphPos | |
|
Instances
Text flags for single or multiline.
Text flags for trimming or keeping sapces.
data TextOverflow Source #
Text flags for clipping or using ellipsis.
Instances
Show TextOverflow Source # | |
Defined in Monomer.Graphics.Types showsPrec :: Int -> TextOverflow -> ShowS # show :: TextOverflow -> String # showList :: [TextOverflow] -> ShowS # | |
Eq TextOverflow Source # | |
Defined in Monomer.Graphics.Types (==) :: TextOverflow -> TextOverflow -> Bool # (/=) :: TextOverflow -> TextOverflow -> Bool # |
data TextMetrics Source #
Text metrics.
Instances
A text line with associated rendering information.
TextLine | |
|
Instances
Flags for a newly created image.
Instances
Generic ImageFlag Source # | |
Show ImageFlag Source # | |
Eq ImageFlag Source # | |
HasFlags ImageDef [ImageFlag] Source # | |
type Rep ImageFlag Source # | |
Defined in Monomer.Graphics.Types type Rep ImageFlag = D1 ('MetaData "ImageFlag" "Monomer.Graphics.Types" "monomer-1.5.0.0-Qyhewrg5o52dfUHeNdP9B" 'False) (C1 ('MetaCons "ImageNearest" 'PrefixI 'False) (U1 :: Type -> Type) :+: (C1 ('MetaCons "ImageRepeatX" 'PrefixI 'False) (U1 :: Type -> Type) :+: C1 ('MetaCons "ImageRepeatY" 'PrefixI 'False) (U1 :: Type -> Type))) |
The definition of a loaded image.
ImageDef | |
|
Instances
Generic ImageDef Source # | |
Show ImageDef Source # | |
Eq ImageDef Source # | |
HasImgData ImageDef ByteString Source # | |
Defined in Monomer.Graphics.Lens | |
HasName ImageDef Text Source # | |
HasSize ImageDef Size Source # | |
HasFlags ImageDef [ImageFlag] Source # | |
type Rep ImageDef Source # | |
Defined in Monomer.Graphics.Types type Rep ImageDef = D1 ('MetaData "ImageDef" "Monomer.Graphics.Types" "monomer-1.5.0.0-Qyhewrg5o52dfUHeNdP9B" 'False) (C1 ('MetaCons "ImageDef" 'PrefixI 'True) ((S1 ('MetaSel ('Just "_idfName") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedStrict) (Rec0 Text) :*: S1 ('MetaSel ('Just "_idfSize") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedStrict) (Rec0 Size)) :*: (S1 ('MetaSel ('Just "_idfImgData") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedStrict) (Rec0 ByteString) :*: S1 ('MetaSel ('Just "_idfFlags") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedStrict) (Rec0 [ImageFlag])))) |
data FontManager Source #
Text metrics related functions.
Two different versions of each function exist:
- Default one, without underscore, does not apply scaling.
- Version with a trailing underscore, that receives an extra scale argument.
In case the text is going to be rendered with a scale factor applied on
Renderer
(by calling setScale
), it is recommended to apply the scale here
too (otherwise there will be differences in size and positioning). In most use
cases these functions will never be called, preferring the non underscore
versions.
FontManager | |
|
Instances
HasFontManager (WidgetEnv s e) FontManager Source # | |
Defined in Monomer.Core.Lens fontManager :: Lens' (WidgetEnv s e) FontManager Source # |
Low level rendering definitions.
Renderer | |
|
Instances
HasRenderMethod (MonomerCtx s e) (Either Renderer (TChan (RenderMsg s e))) Source # | |
Defined in Monomer.Main.Lens renderMethod :: Lens' (MonomerCtx s e) (Either Renderer (TChan (RenderMsg s e))) Source # |