| Safe Haskell | None |
|---|---|
| Language | GHC2021 |
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
- data Frame
- type Dimension = (Float, Float)
- renderStaticFrame :: Frame -> Dimension -> Picture
- grid :: Int -> Int -> (Int -> Int -> Frame) -> Frame
- fit :: Maybe Dimension -> Alignment -> Picture -> Frame
- wire :: Color -> Frame
- solid :: Color -> Frame
- banner :: String -> Color -> Frame
- shape :: [Point] -> Color -> Frame
- stroke :: [Point] -> Color -> Frame
- bordered :: Float -> Color -> Frame -> Frame
- data Alignment = Alignment {}
- data HorizontalAlignment
- data VerticalAlignment
- alignTopLeft :: Alignment
- alignTop :: Alignment
- alignTopRight :: Alignment
- alignLeft :: Alignment
- alignCenter :: Alignment
- alignRight :: Alignment
- alignBottomLeft :: Alignment
- alignBottom :: Alignment
- alignBottomRight :: Alignment
Documentation
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. |
| 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 |
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.
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.
Arguments
| :: Maybe Dimension | The explicit dimension of the picture, or inferred if |
| -> 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.
banner :: String -> Color -> Frame Source #
Draws a banner, that is, a piece of text fitted inside the frame, with a color.
Arguments
| :: [Point] | A sequence of points that form the polygon. Differently from Gloss |
| -> Color | The fill color. |
| -> Frame | The resulting frame |
A convex polygon filled with a solid color.
Arguments
| :: [Point] | A sequence of points that form the polygon. Differently from Gloss |
| -> Color | The fill color. |
| -> Frame | The resulting frame |
A line connecting a sequence of points, drawn with a color.
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.
Alignment options for a picture or frame inside a larger frame.
Constructors
| Alignment | |
Fields
| |
Instances
| Show Alignment Source # | |
| Eq Alignment Source # | |
| Ord Alignment Source # | |
Defined in Graphics.Gloss.Relative.Internal.Window | |
data HorizontalAlignment Source #
Horizontal alignment options for a picture or frame inside a larger frame.
Constructors
| AlignLeft | |
| AlignCenter | |
| AlignRight |
Instances
data VerticalAlignment Source #
Vertical alignment options for a picture or frame inside a larger frame.
Constructors
| AlignTop | |
| AlignMiddle | |
| AlignBottom |
Instances
alignTopLeft :: Alignment Source #
Alignment to the top-left of the frame.
alignTopRight :: Alignment Source #
Alignment to the top-right of 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.