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 |
Monomer.Graphics.Types
Description
Basic types for Graphics.
Angles are always expressed in degrees, not radians.
Synopsis
- data Winding
- data Color = Color {}
- data FontDef = FontDef {}
- 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 ()
- 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 ()
- 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
The definition of a font.
Constructors
FontDef | |
Instances
Eq FontDef Source # | |
Show FontDef Source # | |
Generic FontDef Source # | |
HasPath FontDef Text Source # | |
HasName FontDef Text Source # | |
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.4.1.0-8xaraTQnsQf4tidO8qVoVS" 'False) (C1 ('MetaCons "FontDef" 'PrefixI 'True) (S1 ('MetaSel ('Just "_fntName") 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict) (Rec0 Text) :*: S1 ('MetaSel ('Just "_fntPath") 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict) (Rec0 Text))) |
The name of a loaded font.
Instances
Eq Font Source # | |
Show Font Source # | |
IsString Font Source # | |
Defined in Monomer.Graphics.Types Methods fromString :: String -> Font # | |
Generic Font Source # | |
Default Font Source # | |
Defined in Monomer.Graphics.Types | |
HasFont TextLine Font Source # | |
HasFont TextStyle (Maybe Font) Source # | |
type Rep Font Source # | |
Defined in Monomer.Graphics.Types |
The size of a font.
Constructors
FontSize | |
Fields
|
The spacing of a font. Zero represents the default spacing of the font.
Constructors
FontSpace | |
Fields |
Instances
Eq FontSpace Source # | |
Show FontSpace Source # | |
Generic FontSpace Source # | |
Default FontSpace Source # | |
Defined in Monomer.Graphics.Types | |
HasFontSpaceV TextLine FontSpace Source # | |
Defined in Monomer.Graphics.Lens | |
HasFontSpaceH TextLine FontSpace Source # | |
Defined in Monomer.Graphics.Lens | |
HasFontSpaceV TextStyle (Maybe FontSpace) Source # | |
Defined in Monomer.Core.Lens | |
HasFontSpaceH TextStyle (Maybe FontSpace) Source # | |
Defined in Monomer.Core.Lens | |
type Rep FontSpace Source # | |
Defined in Monomer.Graphics.Types |
Represents the sides of a rectangle.
Constructors
SideLeft | |
SideRight | |
SideTop | |
SideBottom |
data RectCorner Source #
Represents the corners of a rectangle.
Instances
Eq RectCorner Source # | |
Defined in Monomer.Graphics.Types | |
Show RectCorner Source # | |
Defined in Monomer.Graphics.Types Methods showsPrec :: Int -> RectCorner -> ShowS # show :: RectCorner -> String # showList :: [RectCorner] -> ShowS # |
Horizontal alignment flags.
Instances
Eq AlignH Source # | |
Show AlignH Source # | |
Generic AlignH Source # | |
Default AlignH Source # | |
Defined in Monomer.Graphics.Types | |
type Rep AlignH Source # | |
Defined in Monomer.Graphics.Types type Rep AlignH = D1 ('MetaData "AlignH" "Monomer.Graphics.Types" "monomer-1.4.1.0-8xaraTQnsQf4tidO8qVoVS" '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
Eq AlignV Source # | |
Show AlignV Source # | |
Generic AlignV Source # | |
Default AlignV Source # | |
Defined in Monomer.Graphics.Types | |
type Rep AlignV Source # | |
Defined in Monomer.Graphics.Types type Rep AlignV = D1 ('MetaData "AlignV" "Monomer.Graphics.Types" "monomer-1.4.1.0-8xaraTQnsQf4tidO8qVoVS" '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
Eq AlignTH Source # | |
Show AlignTH Source # | |
Generic AlignTH Source # | |
Default AlignTH Source # | |
Defined in Monomer.Graphics.Types | |
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.4.1.0-8xaraTQnsQf4tidO8qVoVS" '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.
Constructors
ATTop | |
ATMiddle | |
ATAscender | |
ATLowerX | |
ATBottom | |
ATBaseline |
Instances
Eq AlignTV Source # | |
Show AlignTV Source # | |
Generic AlignTV Source # | |
Default AlignTV Source # | |
Defined in Monomer.Graphics.Types | |
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.4.1.0-8xaraTQnsQf4tidO8qVoVS" '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.
Constructors
GlyphPos | |
Fields
|
Instances
Text flags for single or multiline.
Constructors
SingleLine | |
MultiLine |
Text flags for trimming or keeping sapces.
Constructors
TrimSpaces | |
KeepSpaces |
data TextOverflow Source #
Text flags for clipping or using ellipsis.
Instances
Eq TextOverflow Source # | |
Defined in Monomer.Graphics.Types | |
Show TextOverflow Source # | |
Defined in Monomer.Graphics.Types Methods showsPrec :: Int -> TextOverflow -> ShowS # show :: TextOverflow -> String # showList :: [TextOverflow] -> ShowS # |
data TextMetrics Source #
Text metrics.
Constructors
TextMetrics | |
Instances
A text line with associated rendering information.
Constructors
TextLine | |
Fields
|
Instances
Flags for a newly created image.
Constructors
ImageNearest | |
ImageRepeatX | |
ImageRepeatY |
Instances
Eq ImageFlag Source # | |
Show ImageFlag Source # | |
Generic 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.4.1.0-8xaraTQnsQf4tidO8qVoVS" '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.
Constructors
ImageDef | |
Fields
|
Instances
Eq ImageDef Source # | |
Show ImageDef Source # | |
Generic ImageDef Source # | |
HasName ImageDef Text Source # | |
HasSize ImageDef Size Source # | |
HasImgData ImageDef ByteString Source # | |
Defined in Monomer.Graphics.Lens | |
HasFlags ImageDef [ImageFlag] Source # | |
type Rep ImageDef Source # | |
Defined in Monomer.Graphics.Types type Rep ImageDef = D1 ('MetaData "ImageDef" "Monomer.Graphics.Types" "monomer-1.4.1.0-8xaraTQnsQf4tidO8qVoVS" '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.
Constructors
FontManager | |
Fields
|
Instances
HasFontManager (WidgetEnv s e) FontManager Source # | |
Defined in Monomer.Core.Lens Methods fontManager :: Lens' (WidgetEnv s e) FontManager Source # |
Low level rendering definitions.
Constructors
Renderer | |
Fields
|
Instances
HasRenderMethod (MonomerCtx s e) (Either Renderer (TChan (RenderMsg s e))) Source # | |
Defined in Monomer.Main.Lens Methods renderMethod :: Lens' (MonomerCtx s e) (Either Renderer (TChan (RenderMsg s e))) Source # |