Copyright | (c) Daniel Winograd-Cort 2015 |
---|---|
License | see the LICENSE file in the distribution |
Maintainer | dwc@cs.yale.edu |
Stability | experimental |
Safe Haskell | None |
Language | Haskell98 |
- data Graphic
- nullGraphic :: Graphic
- overGraphic :: Graphic -> Graphic -> Graphic
- withColor :: Color -> Graphic -> Graphic
- withColor' :: RGB -> Graphic -> Graphic
- text :: UITexty s => Point -> s -> Graphic
- textLines :: UITexty s => [(Point, s)] -> Graphic
- ellipse :: Rect -> Graphic
- shearEllipse :: Point -> Rect -> Graphic
- line :: Point -> Point -> Graphic
- polygon :: [Point] -> Graphic
- polyline :: [Point] -> Graphic
- polybezier :: [Point] -> Graphic
- arc :: Rect -> Angle -> Angle -> Graphic
- circleFilled :: Point -> Int -> Graphic
- circleOutline :: Point -> Int -> Graphic
- rectangleFilled :: Rect -> Graphic
- rectangleOutline :: Rect -> Graphic
- translateGraphic :: Point -> Graphic -> Graphic
- rotateGraphic :: Point -> Angle -> Graphic -> Graphic
- scaleGraphic :: Double -> Double -> Graphic -> Graphic
- boundGraphic :: Rect -> Graphic -> Graphic
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.
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.
The absence of a graphic.
overGraphic :: Graphic -> Graphic -> Graphic Source
The overlay of two graphics, the first over the second.
withColor' :: RGB -> Graphic -> Graphic Source
Use the given RGB color to paint the given graphic.
textLines :: UITexty s => [(Point, s)] -> Graphic Source
A convenience function for painting a set of (Point,String) pairs.
shearEllipse :: Point -> Rect -> Graphic Source
Draw a shear ellipse bounded by the given rectangle. This code was written originally by Paul Liu.
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.