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 |
Displays an image from local storage or a url.
image "https://picsum.photos/id/1059/800/600"
It is also possible to create images from a block of memory using imageMem
.
Notes:
- Depending on the type of image fit chosen and the assigned viewport, some space may remain unused. The alignment options exist to handle this situation.
- If you choose
fitNone
, addingimageRepeatX
andimageRepeatY
won't have any kind of effect.
Synopsis
- data ImageCfg e
- data ImageLoadError
- image :: WidgetEvent e => Text -> WidgetNode s e
- image_ :: WidgetEvent e => Text -> [ImageCfg e] -> WidgetNode s e
- imageMem :: WidgetEvent e => Text -> ByteString -> Size -> WidgetNode s e
- imageMem_ :: WidgetEvent e => Text -> ByteString -> Size -> [ImageCfg e] -> WidgetNode s e
Configuration
Configuration options for image:
transparency
: the alpha to apply when rendering the image.onLoadError
: an event to report a load error.imageNearest
: apply nearest filtering when stretching an image.imageRepeatX
: repeat the image across the x coordinate.imageRepeatY
: repeat the image across the y coordinate.fitNone
: does not perform any stretching if the size does not match viewport.fitFill
: stretches the image to match the viewport.fitWidth
: stretches the image to match the viewport width. Maintains ratio.fitHeight
: stretches the image to match the viewport height. Maintains ratio.fitEither
: stretches the image to match either the viewport width or height such that image does not overflow viewport. Maintains ratio.alignLeft
: aligns to the left if extra space is available.alignRight
: aligns to the right if extra space is available.alignCenter
: aligns to the horizontal center if extra space is available.alignTop
: aligns to the top if extra space is available.alignMiddle
: aligns to the vertical middle if extra space is available.alignBottom
: aligns to the bottom if extra space is available.
Instances
data ImageLoadError Source #
Possible errors when loading an image.
Instances
Show ImageLoadError Source # | |
Defined in Monomer.Widgets.Singles.Image showsPrec :: Int -> ImageLoadError -> ShowS # show :: ImageLoadError -> String # showList :: [ImageLoadError] -> ShowS # | |
Eq ImageLoadError Source # | |
Defined in Monomer.Widgets.Singles.Image (==) :: ImageLoadError -> ImageLoadError -> Bool # (/=) :: ImageLoadError -> ImageLoadError -> Bool # | |
CmbOnLoadError (ImageCfg e) e ImageLoadError Source # | |
Defined in Monomer.Widgets.Singles.Image onLoadError :: (ImageLoadError -> e) -> ImageCfg e Source # |
Constructors
:: WidgetEvent e | |
=> Text | The local path or url. |
-> WidgetNode s e | The created image widget. |
Creates an image with the given local path or url.
:: WidgetEvent e | |
=> Text | The local path or url. |
-> [ImageCfg e] | The configuration of the image. |
-> WidgetNode s e | The created image widget. |
Creates an image with the given local path or url. Accepts config.
:: WidgetEvent e | |
=> Text | The logical name of the image. |
-> ByteString | The image data as 4-byte RGBA blocks. |
-> Size | The size of the image. |
-> WidgetNode s e | The created image widget. |
Creates an image with the given binary data.
:: WidgetEvent e | |
=> Text | The logical name of the image. |
-> ByteString | The image data as 4-byte RGBA blocks. |
-> Size | The size of the image. |
-> [ImageCfg e] | The configuration of the image. |
-> WidgetNode s e | The created image widget. |
Creates an image with the given binary data. Accepts config.