gloss-1.5.0.2: Painless 2D vector graphics, animations and simulations.

Graphics.Gloss.Data.Picture

Contents

Description

Data types for representing pictures.

Synopsis

Documentation

type Point = (Float, Float)Source

A point on the x-y plane. Points can also be treated as Vectors, so Graphics.Gloss.Data.Vector may also be useful.

type Vector = PointSource

A vector can be treated as a point, and vis-versa.

type Path = [Point]Source

A path through the x-y plane.

data Picture Source

A 2D picture

Constructors

Blank

A blank picture, with nothing in it.

Polygon Path

A convex polygon filled with a solid color.

Line Path

A line along an arbitrary path.

Circle Float

A circle with the given radius.

ThickCircle Float Float

A circle with the given thickness and radius. If the thickness is 0 then this is equivalent to Circle.

Text String

Some text to draw with a vector font.

Bitmap Int Int BitmapData Bool

A bitmap image with a width, height and a Vector holding the 32 bit RGBA bitmap data.

The boolean flag controls whether Gloss should cache the data between frames for speed. If you are programatically generating the image for each frame then use False. If you have loaded it from a file then use True.

Color Color Picture

A picture drawn with this color.

Translate Float Float Picture

A picture translated by the given x and y coordinates.

Rotate Float Picture

A picture rotated by the given angle (in degrees).

Scale Float Float Picture

A picture scaled by the given x and y factors.

Pictures [Picture]

A picture consisting of several others.

data BitmapData Source

Abstract bitmap data.

Aliases for Picture constructors

Loading Bitmaps

bitmapOfForeignPtr :: Int -> Int -> ForeignPtr Word8 -> Bool -> PictureSource

O(1). Use a ForeignPtr of RGBA data as a bitmap.

bitmapOfByteString :: Int -> Int -> ByteString -> Bool -> PictureSource

O(size). Copy a ByteString of RGBA data into a bitmap.

bitmapOfBMP :: BMP -> PictureSource

O(size). Copy a BMP file into a bitmap.

loadBMP :: FilePath -> IO PictureSource

Load an uncompressed 24 or 32bit RGBA BMP file as a bitmap.

Miscellaneous

lineLoop :: Path -> PictureSource

A closed loop along this path.

circleSolid :: Float -> PictureSource

A solid circle with the given radius.

Rectangles

rectanglePath :: Float -> Float -> PathSource

A path representing a rectangle centered about the origin, with the given width and height.

rectangleWire :: Float -> Float -> PictureSource

A wireframe rectangle centered about the origin, with the given width and height.

rectangleSolid :: Float -> Float -> PictureSource

A solid rectangle centered about the origin, with the given width and height.

rectangleUpperPath :: Float -> Float -> PathSource

A path representing a rectangle in the y > 0 half of the x-y plane, with the given width and height

rectangleUpperWire :: Float -> Float -> PictureSource

A wireframe rectangle in the y > 0 half of the x-y plane, with the given width and height.

rectangleUpperSolid :: Float -> Float -> PictureSource

A solid rectangle in the y > 0 half of the x-y plane, with the given width and height.