monomer-1.4.0.0: A GUI library for writing native Haskell applications.
Copyright(c) 2018 Francisco Vallarino
LicenseBSD-3-Clause (see the LICENSE file)
Maintainerfjvallarino@gmail.com
Stabilityexperimental
Portabilitynon-portable
Safe HaskellNone
LanguageHaskell2010

Monomer.Widgets.Singles.Image

Description

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, adding imageRepeatX and imageRepeatY won't have any kind of effect.
Synopsis

Configuration

data ImageCfg e Source #

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 streching 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.
  • alignLeft: aligns left if extra space is available.
  • alignRight: aligns right if extra space is available.
  • alignCenter: aligns center if extra space is available.
  • alignTop: aligns top if extra space is available.
  • alignMiddle: aligns middle if extra space is available.
  • alignBottom: aligns bottom if extra space is available.

Instances

Instances details
Semigroup (ImageCfg e) Source # 
Instance details

Defined in Monomer.Widgets.Singles.Image

Methods

(<>) :: ImageCfg e -> ImageCfg e -> ImageCfg e #

sconcat :: NonEmpty (ImageCfg e) -> ImageCfg e #

stimes :: Integral b => b -> ImageCfg e -> ImageCfg e #

Monoid (ImageCfg e) Source # 
Instance details

Defined in Monomer.Widgets.Singles.Image

Methods

mempty :: ImageCfg e #

mappend :: ImageCfg e -> ImageCfg e -> ImageCfg e #

mconcat :: [ImageCfg e] -> ImageCfg e #

Default (ImageCfg e) Source # 
Instance details

Defined in Monomer.Widgets.Singles.Image

Methods

def :: ImageCfg e #

CmbAlignBottom (ImageCfg e) Source # 
Instance details

Defined in Monomer.Widgets.Singles.Image

CmbAlignMiddle (ImageCfg e) Source # 
Instance details

Defined in Monomer.Widgets.Singles.Image

CmbAlignTop (ImageCfg e) Source # 
Instance details

Defined in Monomer.Widgets.Singles.Image

CmbAlignRight (ImageCfg e) Source # 
Instance details

Defined in Monomer.Widgets.Singles.Image

CmbAlignCenter (ImageCfg e) Source # 
Instance details

Defined in Monomer.Widgets.Singles.Image

CmbAlignLeft (ImageCfg e) Source # 
Instance details

Defined in Monomer.Widgets.Singles.Image

CmbTransparency (ImageCfg e) Source # 
Instance details

Defined in Monomer.Widgets.Singles.Image

CmbResizeFactorDim (ImageCfg e) Source # 
Instance details

Defined in Monomer.Widgets.Singles.Image

CmbResizeFactor (ImageCfg e) Source # 
Instance details

Defined in Monomer.Widgets.Singles.Image

CmbImageRepeatY (ImageCfg e) Source # 
Instance details

Defined in Monomer.Widgets.Singles.Image

CmbImageRepeatX (ImageCfg e) Source # 
Instance details

Defined in Monomer.Widgets.Singles.Image

CmbImageNearest (ImageCfg e) Source # 
Instance details

Defined in Monomer.Widgets.Singles.Image

CmbFitEither (ImageCfg e) Source # 
Instance details

Defined in Monomer.Widgets.Singles.Image

CmbFitHeight (ImageCfg e) Source # 
Instance details

Defined in Monomer.Widgets.Singles.Image

CmbFitWidth (ImageCfg e) Source # 
Instance details

Defined in Monomer.Widgets.Singles.Image

CmbFitFill (ImageCfg e) Source # 
Instance details

Defined in Monomer.Widgets.Singles.Image

Methods

fitFill :: ImageCfg e Source #

CmbFitNone (ImageCfg e) Source # 
Instance details

Defined in Monomer.Widgets.Singles.Image

Methods

fitNone :: ImageCfg e Source #

CmbOnLoadError (ImageCfg e) e ImageLoadError Source # 
Instance details

Defined in Monomer.Widgets.Singles.Image

data ImageLoadError Source #

Posible errors when loading an image.

Constructors

image :: WidgetEvent e => Text -> WidgetNode s e Source #

Creates an image with the given local path or url.

image_ :: WidgetEvent e => Text -> [ImageCfg e] -> WidgetNode s e Source #

Creates an image with the given local path or url. Accepts config.

imageMem Source #

Arguments

:: 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.

imageMem_ Source #

Arguments

:: 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.