UISF-0.4.0.0: Library for Arrowized Graphical User Interfaces.

Copyright(c) Daniel Winograd-Cort 2015
Licensesee the LICENSE file in the distribution
Maintainerdwc@cs.yale.edu
Stabilityexperimental
Safe HaskellNone
LanguageHaskell98

FRP.UISF.Graphics.Graphic

Description

 

Synopsis

Documentation

This module provides an abstract representation for graphics in the GUI along with a rendering function specific to OpenGL.

The Graphic data type encodes an abstract graphic, which can be created and combined with smart constructors. This means that Graphics are inherently restricted to what is possible in this abstract form. For example, OpenGL may support 3D rotations, but because the abstract Graphic does not, they cannot be performed in UISF.

For now, we have a lean set of graphics that should satisfy most GUI needs. Additionally, this layer of abstraction should make it easier to add more graphical back ends (perhaps a web back end in the future?). If UISF grows to include more graphical representations (e.g. more ways to render text), we can add them as necessary.

data Graphic Source

The main Graphic data type stores graphic information. Constructors are not directly exposed to encourage the use of the smart constructors.

If you would like to add custom rendering functions for Graphic, you will clearly need access to the constructors to destruct the graphics. Please request this, and I can either export them or we can discuss adding more rendering functions to this library.

nullGraphic :: Graphic Source

The absence of a graphic.

overGraphic :: Graphic -> Graphic -> Graphic Source

The overlay of two graphics, the first over the second.

withColor :: Color -> Graphic -> Graphic Source

Use the given color to paint the given graphic.

withColor' :: RGB -> Graphic -> Graphic Source

Use the given RGB color to paint the given graphic.

text :: UITexty s => Point -> s -> Graphic Source

Paint the given text at the given point.

textLines :: UITexty s => [(Point, s)] -> Graphic Source

A convenience function for painting a set of (Point,String) pairs.

ellipse :: Rect -> Graphic Source

Draw an ellipse bounded by the given rectangle.

shearEllipse :: Point -> Rect -> Graphic Source

Draw a shear ellipse bounded by the given rectangle. This code was written originally by Paul Liu.

line :: Point -> Point -> Graphic Source

Draw a line segment connecting the given two points.

polygon :: [Point] -> Graphic Source

Draw a filled polygon with corners defined by the given points.

polyline :: [Point] -> Graphic Source

Draw a sequence of line segments defined by the given points.

polybezier :: [Point] -> Graphic Source

Draw a Bezier curve defined by the given points.

arc :: Rect -> Angle -> Angle -> Graphic Source

Draw an arc of the ellipse bounded by the given rectangle that starts at the first angle measure and ends at the second.

circleFilled :: Point -> Int -> Graphic Source

Draw a filled circle with given center and radius.

circleOutline :: Point -> Int -> Graphic Source

Draw the outline of a circle with given center and radius.

rectangleFilled :: Rect -> Graphic Source

Draw a filled rectangle.

rectangleOutline :: Rect -> Graphic Source

Draw the outline of a rectangle.

translateGraphic :: Point -> Graphic -> Graphic Source

Translate the given graphic so that its origin is at the given point.

rotateGraphic :: Point -> Angle -> Graphic -> Graphic Source

Rotate the given graphic around the given point by the given number of degrees.

scaleGraphic :: Double -> Double -> Graphic -> Graphic Source

Scale the given graphic in the X and Y dimension respectively.

boundGraphic :: Rect -> Graphic -> Graphic Source

Cut the given graphic so that nothing outside of the given rectangle is visible.