gloss-relative-0.1.0.0: Painless relative-sized pictures in Gloss.
Safe HaskellNone
LanguageGHC2021

Graphics.Gloss.Relative.Frame

Description

The core functionality of the gloss-relative package is exported in this module. This includes the Frame abstraction and helper functions.

Synopsis

Documentation

data Frame Source #

A picture frame. Much like the original Picture data type, but the purpose is to place and adjust pictures inside a frame with general dimensions.

Constructors

Aspect

Create the largest possible frame with a desired aspect ratio within the current frame.

Fields

Zoom

Zoom the current frame by given factors, producing a smaller frame.

Fields

Grid [[Frame]]

Split the current frame into a grid with the given numbers of rows and columns. Receives a matrix of frames, represented as a list of rows.

Label

Labels a frame region, to use in mouse events.

Fields

Frames [Frame]

Overlay a sequence of frames.

Stretch

Stretch picture to fill the frame, not preserving the picture's aspect ratio. If you want to preserve the aspect ratio, consider using fit instead.

Fields

Sized (Dimension -> Frame)

Advanced contructor. In case you need to know the exact screen size for a frame.

type Dimension = (Float, Float) Source #

A dimension is pair (width,height). When used as a screen size, the position (0,0) is considered to be at the center.

renderStaticFrame Source #

Arguments

:: Frame

The frame to render. Note: This function ignores frame labels.

-> Dimension

The dimension of the screen in which to render the frame.

-> Picture

The resulting picture.

Renders a frame into a picture.

grid :: Int -> Int -> (Int -> Int -> Frame) -> Frame Source #

Creates each cell in a grid depending on the row and column indexes.

fit Source #

Arguments

:: Maybe Dimension

The explicit dimension of the picture, or inferred if Nothing.

-> Alignment

The alignment of the fitted picture to the current frame.

-> Picture

The picture to stretch to the frame's dimension.

-> Frame

The resulting frame.

Fit picture to the frame, preserving the picture's aspect ratio. Receives a picture alignment inside the frame.

wire :: Color -> Frame Source #

Paints the borders of the frame with a color.

solid :: Color -> Frame Source #

Paints the frame with a solid color.

banner :: String -> Color -> Frame Source #

Draws a banner, that is, a piece of text fitted inside the frame, with a color.

shape Source #

Arguments

:: [Point]

A sequence of points that form the polygon. Differently from Gloss polygon, each coordinate of a point (relx,rely) is defined as relative screen width / height percentages between -0.5 and 0.5.

-> Color

The fill color.

-> Frame

The resulting frame

A convex polygon filled with a solid color.

stroke Source #

Arguments

:: [Point]

A sequence of points that form the polygon. Differently from Gloss polygon, each coordinate of a point (relx,rely) is defined as relative screen width / height percentages between -0.5 and 0.5.

-> Color

The fill color.

-> Frame

The resulting frame

A line connecting a sequence of points, drawn with a color.

bordered Source #

Arguments

:: Float

A fixed thickness in pixels.

-> Color

The color for the border.

-> Frame 
-> Frame

The resulting frame.

Draws a border around a smaller frame.

data Alignment Source #

Alignment options for a picture or frame inside a larger frame.

Constructors

Alignment 

Fields

data HorizontalAlignment Source #

Horizontal alignment options for a picture or frame inside a larger frame.

Instances

Instances details
Bounded HorizontalAlignment Source # 
Instance details

Defined in Graphics.Gloss.Relative.Internal.Window

Enum HorizontalAlignment Source # 
Instance details

Defined in Graphics.Gloss.Relative.Internal.Window

Show HorizontalAlignment Source # 
Instance details

Defined in Graphics.Gloss.Relative.Internal.Window

Eq HorizontalAlignment Source # 
Instance details

Defined in Graphics.Gloss.Relative.Internal.Window

Ord HorizontalAlignment Source # 
Instance details

Defined in Graphics.Gloss.Relative.Internal.Window

data VerticalAlignment Source #

Vertical alignment options for a picture or frame inside a larger frame.

Instances

Instances details
Bounded VerticalAlignment Source # 
Instance details

Defined in Graphics.Gloss.Relative.Internal.Window

Enum VerticalAlignment Source # 
Instance details

Defined in Graphics.Gloss.Relative.Internal.Window

Show VerticalAlignment Source # 
Instance details

Defined in Graphics.Gloss.Relative.Internal.Window

Eq VerticalAlignment Source # 
Instance details

Defined in Graphics.Gloss.Relative.Internal.Window

Ord VerticalAlignment Source # 
Instance details

Defined in Graphics.Gloss.Relative.Internal.Window

alignTopLeft :: Alignment Source #

Alignment to the top-left of the frame.

alignTop :: Alignment Source #

Alignment to the top (and center) of the frame.

alignTopRight :: Alignment Source #

Alignment to the top-right of the frame.

alignLeft :: Alignment Source #

Alignment to the left (and middle) the frame.

alignCenter :: Alignment Source #

Alignment to the center (and middle) the frame.

alignRight :: Alignment Source #

Alignment to the right (and middle) the frame.

alignBottomLeft :: Alignment Source #

Alignment to the bottom-left the frame.

alignBottom :: Alignment Source #

Alignment to the bottom (and middle) the frame.

alignBottomRight :: Alignment Source #

Alignment to the bottom-right the frame.