gloss-rendering-1.13.2.1: Gloss picture data types and rendering functions.

Safe Haskell | None
Language | Haskell2010

Graphics.Gloss.Rendering

Contents

- Picture data type
- Colors
- Bitmaps
- Rendering

Synopsis

- data Picture
  - = Blank
  - | Polygon Path
  - | Line Path
  - | Circle Float
  - | ThickCircle Float Float
  - | Arc Float Float Float
  - | ThickArc Float Float Float Float
  - | Text String
  - | Bitmap BitmapData
  - | BitmapSection Rectangle BitmapData
  - | Color Color Picture
  - | Translate Float Float Picture
  - | Rotate Float Picture
  - | Scale Float Float Picture
  - | Pictures [Picture]
- type Point = (Float, Float)
- type Vector = Point
- type Path = [Point]
- data Color
- makeColor :: Float -> Float -> Float -> Float -> Color
- makeColorI :: Int -> Int -> Int -> Int -> Color
- makeRawColor :: Float -> Float -> Float -> Float -> Color
- makeRawColorI :: Int -> Int -> Int -> Int -> Color
- rgbaOfColor :: Color -> (Float, Float, Float, Float)
- clampColor :: Color -> Color
- data Rectangle = Rectangle {
  - rectPos :: (Int, Int)
  - rectSize :: (Int, Int)
  }
- data BitmapData
- bitmapSize :: BitmapData -> (Int, Int)
- data BitmapFormat = BitmapFormat {
  - rowOrder :: RowOrder
  - pixelFormat :: PixelFormat
  }
- data PixelFormat
  - = PxRGBA
  - | PxABGR
- data RowOrder
  - = TopToBottom
  - | BottomToTop
- bitmapOfForeignPtr :: Int -> Int -> BitmapFormat -> ForeignPtr Word8 -> Bool -> Picture
- bitmapDataOfForeignPtr :: Int -> Int -> BitmapFormat -> ForeignPtr Word8 -> Bool -> BitmapData
- bitmapOfByteString :: Int -> Int -> BitmapFormat -> ByteString -> Bool -> Picture
- bitmapDataOfByteString :: Int -> Int -> BitmapFormat -> ByteString -> Bool -> BitmapData
- bitmapOfBMP :: BMP -> Picture
- bitmapDataOfBMP :: BMP -> BitmapData
- loadBMP :: FilePath -> IO Picture
- displayPicture :: (Int, Int) -> Color -> State -> Float -> Picture -> IO ()
- renderPicture :: State -> Float -> Picture -> IO ()
- withModelview :: (Int, Int) -> IO () -> IO ()
- withClearBuffer :: Color -> IO () -> IO ()
- initState :: IO State
- data State

# Picture data type

data Picture Source #

A 2D picture

Constructors

Blank | A blank picture, with nothing in it.
Polygon Path | A 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 radius and thickness. If the thickness is 0 then this is equivalent to `Circle`.
Arc Float Float Float | A circular arc drawn counter-clockwise between two angles (in degrees) at the given radius.
ThickArc Float Float Float Float | A circular arc drawn counter-clockwise between two angles (in degrees), with the given radius and thickness. If the thickness is 0 then this is equivalent to `Arc`.
Text String | Some text to draw with a vector font.
Bitmap BitmapData | A bitmap image.
BitmapSection Rectangle BitmapData | A subsection of a bitmap image where the first argument selects a sub section in the bitmap, and second argument determines the bitmap data.
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 clockwise 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.

#### Instances

Instances details

Monoid Picture Source # |
Instance details Defined in Graphics.Gloss.Internals.Data.Picture Methods mempty :: Picture Source # mappend :: Picture -> Picture -> Picture Source # mconcat :: [Picture] -> Picture Source #
Semigroup Picture Source # |
Instance details Defined in Graphics.Gloss.Internals.Data.Picture Methods (<>) :: Picture -> Picture -> Picture Source # sconcat :: NonEmpty Picture -> Picture Source # stimes :: Integral b => b -> Picture -> Picture Source #
Data Picture Source # |

Instance details

Defined in Graphics.Gloss.Internals.Data.Picture

Methods

gfoldl :: (forall d b. Data d => c (d -> b) -> d -> c b) -> (forall g. g -> c g) -> Picture -> c Picture Source #

gunfold :: (forall b r. Data b => c (b -> r) -> c r) -> (forall r. r -> c r) -> Constr -> c Picture Source #

toConstr :: Picture -> Constr Source #

dataTypeOf :: Picture -> DataType Source #

dataCast1 :: Typeable t => (forall d. Data d => c (t d)) -> Maybe (c Picture) Source #

dataCast2 :: Typeable t => (forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c Picture) Source #

gmapT :: (forall b. Data b => b -> b) -> Picture -> Picture Source #

gmapQl :: (r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> Picture -> r Source #

gmapQr :: forall r r'. (r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> Picture -> r Source #

gmapQ :: (forall d. Data d => d -> u) -> Picture -> [u] Source #

gmapQi :: Int -> (forall d. Data d => d -> u) -> Picture -> u Source #

gmapM :: Monad m => (forall d. Data d => d -> m d) -> Picture -> m Picture Source #

gmapMp :: MonadPlus m => (forall d. Data d => d -> m d) -> Picture -> m Picture Source #

gmapMo :: MonadPlus m => (forall d. Data d => d -> m d) -> Picture -> m Picture Source #

Show Picture Source # |
Instance details Defined in Graphics.Gloss.Internals.Data.Picture Methods showsPrec :: Int -> Picture -> ShowS Source # show :: Picture -> String Source # showList :: [Picture] -> ShowS Source #
Eq Picture Source # |
Instance details Defined in Graphics.Gloss.Internals.Data.Picture Methods (==) :: Picture -> Picture -> Bool Source # (/=) :: Picture -> Picture -> Bool Source #

type Point = (Float, Float) Source #

A point on the x-y plane.

type Vector = Point Source #

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

type Path = [Point] Source #

A path through the x-y plane.

# Colors

data Color Source #

An abstract color value. We keep the type abstract so we can be sure that the components are in the required range. To make a custom color use `makeColor`.

#### Instances

Instances details

Data Color Source # |

Instance details

Defined in Graphics.Gloss.Internals.Data.Color

Methods

gfoldl :: (forall d b. Data d => c (d -> b) -> d -> c b) -> (forall g. g -> c g) -> Color -> c Color Source #

gunfold :: (forall b r. Data b => c (b -> r) -> c r) -> (forall r. r -> c r) -> Constr -> c Color Source #

toConstr :: Color -> Constr Source #

dataTypeOf :: Color -> DataType Source #

dataCast1 :: Typeable t => (forall d. Data d => c (t d)) -> Maybe (c Color) Source #

dataCast2 :: Typeable t => (forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c Color) Source #

gmapT :: (forall b. Data b => b -> b) -> Color -> Color Source #

gmapQl :: (r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> Color -> r Source #

gmapQr :: forall r r'. (r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> Color -> r Source #

gmapQ :: (forall d. Data d => d -> u) -> Color -> [u] Source #

gmapQi :: Int -> (forall d. Data d => d -> u) -> Color -> u Source #

gmapM :: Monad m => (forall d. Data d => d -> m d) -> Color -> m Color Source #

gmapMp :: MonadPlus m => (forall d. Data d => d -> m d) -> Color -> m Color Source #

gmapMo :: MonadPlus m => (forall d. Data d => d -> m d) -> Color -> m Color Source #

Num Color Source # |
Instance details Defined in Graphics.Gloss.Internals.Data.Color Methods (+) :: Color -> Color -> Color Source # (-) :: Color -> Color -> Color Source # (*) :: Color -> Color -> Color Source # negate :: Color -> Color Source # abs :: Color -> Color Source # signum :: Color -> Color Source # fromInteger :: Integer -> Color Source #
Show Color Source # |
Instance details Defined in Graphics.Gloss.Internals.Data.Color Methods showsPrec :: Int -> Color -> ShowS Source # show :: Color -> String Source # showList :: [Color] -> ShowS Source #
Eq Color Source # |
Instance details Defined in Graphics.Gloss.Internals.Data.Color Methods (==) :: Color -> Color -> Bool Source # (/=) :: Color -> Color -> Bool Source #

makeColor Source #

Arguments

:: Float | Red component.
-> Float | Green component.
-> Float | Blue component.
-> Float | Alpha component.
-> Color |

Make a custom color. All components are clamped to the range [0..1].

makeColorI :: Int -> Int -> Int -> Int -> Color Source #

Make a custom color. All components are clamped to the range [0..255].

makeRawColor :: Float -> Float -> Float -> Float -> Color Source #

Make a custom color.

Using this function over `makeColor` avoids clamping the components, which saves time. However, if the components are out of range then this will result in integer overflow at rendering time, and the actual picture you get will be implementation dependent.

You'll only need to use this function when using the `gloss-raster` package that builds a new color for every pixel. If you're just working with the Picture data type then it there is no need for raw colors.

makeRawColorI :: Int -> Int -> Int -> Int -> Color Source #

Make a custom color, taking pre-clamped components.

rgbaOfColor :: Color -> (Float, Float, Float, Float) Source #

Take the RGBA components of a color.

clampColor :: Color -> Color Source #

Clamp components of a raw color into the required range.

# Bitmaps

data Rectangle Source #

Represents a rectangular section in a bitmap

Constructors

Rectangle |

Fields

- rectPos :: (Int, Int)

  x- and y-pos in the bitmap in pixels

- rectSize :: (Int, Int)

  width/height of the area in pixelsi

#### Instances

Instances details

Data Rectangle Source # |

Instance details

Defined in Graphics.Gloss.Internals.Rendering.Bitmap

Methods

gfoldl :: (forall d b. Data d => c (d -> b) -> d -> c b) -> (forall g. g -> c g) -> Rectangle -> c Rectangle Source #

gunfold :: (forall b r. Data b => c (b -> r) -> c r) -> (forall r. r -> c r) -> Constr -> c Rectangle Source #

toConstr :: Rectangle -> Constr Source #

dataTypeOf :: Rectangle -> DataType Source #

dataCast1 :: Typeable t => (forall d. Data d => c (t d)) -> Maybe (c Rectangle) Source #

dataCast2 :: Typeable t => (forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c Rectangle) Source #

gmapT :: (forall b. Data b => b -> b) -> Rectangle -> Rectangle Source #

gmapQl :: (r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> Rectangle -> r Source #

gmapQr :: forall r r'. (r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> Rectangle -> r Source #

gmapQ :: (forall d. Data d => d -> u) -> Rectangle -> [u] Source #

gmapQi :: Int -> (forall d. Data d => d -> u) -> Rectangle -> u Source #

gmapM :: Monad m => (forall d. Data d => d -> m d) -> Rectangle -> m Rectangle Source #

gmapMp :: MonadPlus m => (forall d. Data d => d -> m d) -> Rectangle -> m Rectangle Source #

gmapMo :: MonadPlus m => (forall d. Data d => d -> m d) -> Rectangle -> m Rectangle Source #

Read Rectangle Source # |
Instance details Defined in Graphics.Gloss.Internals.Rendering.Bitmap Methods readsPrec :: Int -> ReadS Rectangle Source # readList :: ReadS [Rectangle] Source # readPrec :: ReadPrec Rectangle Source # readListPrec :: ReadPrec [Rectangle] Source #
Show Rectangle Source # |
Instance details Defined in Graphics.Gloss.Internals.Rendering.Bitmap Methods showsPrec :: Int -> Rectangle -> ShowS Source # show :: Rectangle -> String Source # showList :: [Rectangle] -> ShowS Source #
Eq Rectangle Source # |
Instance details Defined in Graphics.Gloss.Internals.Rendering.Bitmap Methods (==) :: Rectangle -> Rectangle -> Bool Source # (/=) :: Rectangle -> Rectangle -> Bool Source #
Ord Rectangle Source # |

Instance details

Defined in Graphics.Gloss.Internals.Rendering.Bitmap

Methods

compare :: Rectangle -> Rectangle -> Ordering Source #

(<) :: Rectangle -> Rectangle -> Bool Source #

(<=) :: Rectangle -> Rectangle -> Bool Source #

(>) :: Rectangle -> Rectangle -> Bool Source #

(>=) :: Rectangle -> Rectangle -> Bool Source #

max :: Rectangle -> Rectangle -> Rectangle Source #

min :: Rectangle -> Rectangle -> Rectangle Source #

data BitmapData Source #

Abstract 32-bit RGBA bitmap data.

#### Instances

Instances details

Data BitmapData Source # |

Instance details

Defined in Graphics.Gloss.Internals.Rendering.Bitmap

Methods

gfoldl :: (forall d b. Data d => c (d -> b) -> d -> c b) -> (forall g. g -> c g) -> BitmapData -> c BitmapData Source #

gunfold :: (forall b r. Data b => c (b -> r) -> c r) -> (forall r. r -> c r) -> Constr -> c BitmapData Source #

toConstr :: BitmapData -> Constr Source #

dataTypeOf :: BitmapData -> DataType Source #

dataCast1 :: Typeable t => (forall d. Data d => c (t d)) -> Maybe (c BitmapData) Source #

dataCast2 :: Typeable t => (forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c BitmapData) Source #

gmapT :: (forall b. Data b => b -> b) -> BitmapData -> BitmapData Source #

gmapQl :: (r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> BitmapData -> r Source #

gmapQr :: forall r r'. (r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> BitmapData -> r Source #

gmapQ :: (forall d. Data d => d -> u) -> BitmapData -> [u] Source #

gmapQi :: Int -> (forall d. Data d => d -> u) -> BitmapData -> u Source #

gmapM :: Monad m => (forall d. Data d => d -> m d) -> BitmapData -> m BitmapData Source #

gmapMp :: MonadPlus m => (forall d. Data d => d -> m d) -> BitmapData -> m BitmapData Source #

gmapMo :: MonadPlus m => (forall d. Data d => d -> m d) -> BitmapData -> m BitmapData Source #

Show BitmapData Source # |
Instance details Defined in Graphics.Gloss.Internals.Rendering.Bitmap Methods showsPrec :: Int -> BitmapData -> ShowS Source # show :: BitmapData -> String Source # showList :: [BitmapData] -> ShowS Source #
Eq BitmapData Source # |
Instance details Defined in Graphics.Gloss.Internals.Rendering.Bitmap Methods (==) :: BitmapData -> BitmapData -> Bool Source # (/=) :: BitmapData -> BitmapData -> Bool Source #

bitmapSize :: BitmapData -> (Int, Int) Source #

width, height in pixels

data BitmapFormat Source #

Description of how the bitmap is layed out in memory.

- Prior version of Gloss assumed `BitmapFormat BottomToTop PxABGR`

Constructors

BitmapFormat |

Fields

- rowOrder :: RowOrder
- pixelFormat :: PixelFormat

#### Instances

Instances details

Data BitmapFormat Source # |

Instance details

Defined in Graphics.Gloss.Internals.Rendering.Bitmap

Methods

gfoldl :: (forall d b. Data d => c (d -> b) -> d -> c b) -> (forall g. g -> c g) -> BitmapFormat -> c BitmapFormat Source #

gunfold :: (forall b r. Data b => c (b -> r) -> c r) -> (forall r. r -> c r) -> Constr -> c BitmapFormat Source #

toConstr :: BitmapFormat -> Constr Source #

dataTypeOf :: BitmapFormat -> DataType Source #

dataCast1 :: Typeable t => (forall d. Data d => c (t d)) -> Maybe (c BitmapFormat) Source #

dataCast2 :: Typeable t => (forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c BitmapFormat) Source #

gmapT :: (forall b. Data b => b -> b) -> BitmapFormat -> BitmapFormat Source #

gmapQl :: (r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> BitmapFormat -> r Source #

gmapQr :: forall r r'. (r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> BitmapFormat -> r Source #

gmapQ :: (forall d. Data d => d -> u) -> BitmapFormat -> [u] Source #

gmapQi :: Int -> (forall d. Data d => d -> u) -> BitmapFormat -> u Source #

gmapM :: Monad m => (forall d. Data d => d -> m d) -> BitmapFormat -> m BitmapFormat Source #

gmapMp :: MonadPlus m => (forall d. Data d => d -> m d) -> BitmapFormat -> m BitmapFormat Source #

gmapMo :: MonadPlus m => (forall d. Data d => d -> m d) -> BitmapFormat -> m BitmapFormat Source #

Show BitmapFormat Source # |
Instance details Defined in Graphics.Gloss.Internals.Rendering.Bitmap Methods showsPrec :: Int -> BitmapFormat -> ShowS Source # show :: BitmapFormat -> String Source # showList :: [BitmapFormat] -> ShowS Source #
Eq BitmapFormat Source # |
Instance details Defined in Graphics.Gloss.Internals.Rendering.Bitmap Methods (==) :: BitmapFormat -> BitmapFormat -> Bool Source # (/=) :: BitmapFormat -> BitmapFormat -> Bool Source #
Ord BitmapFormat Source # |

Instance details

Defined in Graphics.Gloss.Internals.Rendering.Bitmap

Methods

compare :: BitmapFormat -> BitmapFormat -> Ordering Source #

(<) :: BitmapFormat -> BitmapFormat -> Bool Source #

(<=) :: BitmapFormat -> BitmapFormat -> Bool Source #

(>) :: BitmapFormat -> BitmapFormat -> Bool Source #

(>=) :: BitmapFormat -> BitmapFormat -> Bool Source #

max :: BitmapFormat -> BitmapFormat -> BitmapFormat Source #

min :: BitmapFormat -> BitmapFormat -> BitmapFormat Source #

data PixelFormat Source #

Pixel formats describe the order of the color channels in memory.

Constructors

PxRGBA |
PxABGR |

#### Instances

Instances details

Data PixelFormat Source # |

Instance details

Defined in Graphics.Gloss.Internals.Rendering.Bitmap

Methods

gfoldl :: (forall d b. Data d => c (d -> b) -> d -> c b) -> (forall g. g -> c g) -> PixelFormat -> c PixelFormat Source #

gunfold :: (forall b r. Data b => c (b -> r) -> c r) -> (forall r. r -> c r) -> Constr -> c PixelFormat Source #

toConstr :: PixelFormat -> Constr Source #

dataTypeOf :: PixelFormat -> DataType Source #

dataCast1 :: Typeable t => (forall d. Data d => c (t d)) -> Maybe (c PixelFormat) Source #

dataCast2 :: Typeable t => (forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c PixelFormat) Source #

gmapT :: (forall b. Data b => b -> b) -> PixelFormat -> PixelFormat Source #

gmapQl :: (r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> PixelFormat -> r Source #

gmapQr :: forall r r'. (r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> PixelFormat -> r Source #

gmapQ :: (forall d. Data d => d -> u) -> PixelFormat -> [u] Source #

gmapQi :: Int -> (forall d. Data d => d -> u) -> PixelFormat -> u Source #

gmapM :: Monad m => (forall d. Data d => d -> m d) -> PixelFormat -> m PixelFormat Source #

gmapMp :: MonadPlus m => (forall d. Data d => d -> m d) -> PixelFormat -> m PixelFormat Source #

gmapMo :: MonadPlus m => (forall d. Data d => d -> m d) -> PixelFormat -> m PixelFormat Source #

Bounded PixelFormat Source # |
Instance details Defined in Graphics.Gloss.Internals.Rendering.Bitmap Methods minBound :: PixelFormat Source # maxBound :: PixelFormat Source #
Enum PixelFormat Source # |

Instance details

Defined in Graphics.Gloss.Internals.Rendering.Bitmap

Methods

succ :: PixelFormat -> PixelFormat Source #

pred :: PixelFormat -> PixelFormat Source #

toEnum :: Int -> PixelFormat Source #

fromEnum :: PixelFormat -> Int Source #

enumFrom :: PixelFormat -> [PixelFormat] Source #

enumFromThen :: PixelFormat -> PixelFormat -> [PixelFormat] Source #

enumFromTo :: PixelFormat -> PixelFormat -> [PixelFormat] Source #

enumFromThenTo :: PixelFormat -> PixelFormat -> PixelFormat -> [PixelFormat] Source #

Show PixelFormat Source # |
Instance details Defined in Graphics.Gloss.Internals.Rendering.Bitmap Methods showsPrec :: Int -> PixelFormat -> ShowS Source # show :: PixelFormat -> String Source # showList :: [PixelFormat] -> ShowS Source #
Eq PixelFormat Source # |
Instance details Defined in Graphics.Gloss.Internals.Rendering.Bitmap Methods (==) :: PixelFormat -> PixelFormat -> Bool Source # (/=) :: PixelFormat -> PixelFormat -> Bool Source #
Ord PixelFormat Source # |

Instance details

Defined in Graphics.Gloss.Internals.Rendering.Bitmap

Methods

compare :: PixelFormat -> PixelFormat -> Ordering Source #

(<) :: PixelFormat -> PixelFormat -> Bool Source #

(<=) :: PixelFormat -> PixelFormat -> Bool Source #

(>) :: PixelFormat -> PixelFormat -> Bool Source #

(>=) :: PixelFormat -> PixelFormat -> Bool Source #

max :: PixelFormat -> PixelFormat -> PixelFormat Source #

min :: PixelFormat -> PixelFormat -> PixelFormat Source #

data RowOrder Source #

Order of rows in an image are either:

- `TopToBottom` - the top row, followed by the next-lower row and so on.
- `BottomToTop` - the bottom row followed by the next-higher row and so on.

Constructors

TopToBottom |
BottomToTop |

#### Instances

Instances details

Data RowOrder Source # |

Instance details

Defined in Graphics.Gloss.Internals.Rendering.Bitmap

Methods

gfoldl :: (forall d b. Data d => c (d -> b) -> d -> c b) -> (forall g. g -> c g) -> RowOrder -> c RowOrder Source #

gunfold :: (forall b r. Data b => c (b -> r) -> c r) -> (forall r. r -> c r) -> Constr -> c RowOrder Source #

toConstr :: RowOrder -> Constr Source #

dataTypeOf :: RowOrder -> DataType Source #

dataCast1 :: Typeable t => (forall d. Data d => c (t d)) -> Maybe (c RowOrder) Source #

dataCast2 :: Typeable t => (forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c RowOrder) Source #

gmapT :: (forall b. Data b => b -> b) -> RowOrder -> RowOrder Source #

gmapQl :: (r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> RowOrder -> r Source #

gmapQr :: forall r r'. (r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> RowOrder -> r Source #

gmapQ :: (forall d. Data d => d -> u) -> RowOrder -> [u] Source #

gmapQi :: Int -> (forall d. Data d => d -> u) -> RowOrder -> u Source #

gmapM :: Monad m => (forall d. Data d => d -> m d) -> RowOrder -> m RowOrder Source #

gmapMp :: MonadPlus m => (forall d. Data d => d -> m d) -> RowOrder -> m RowOrder Source #

gmapMo :: MonadPlus m => (forall d. Data d => d -> m d) -> RowOrder -> m RowOrder Source #

Bounded RowOrder Source # |
Instance details Defined in Graphics.Gloss.Internals.Rendering.Bitmap Methods minBound :: RowOrder Source # maxBound :: RowOrder Source #
Enum RowOrder Source # |

Instance details

Defined in Graphics.Gloss.Internals.Rendering.Bitmap

Methods

succ :: RowOrder -> RowOrder Source #

pred :: RowOrder -> RowOrder Source #

toEnum :: Int -> RowOrder Source #

fromEnum :: RowOrder -> Int Source #

enumFrom :: RowOrder -> [RowOrder] Source #

enumFromThen :: RowOrder -> RowOrder -> [RowOrder] Source #

enumFromTo :: RowOrder -> RowOrder -> [RowOrder] Source #

enumFromThenTo :: RowOrder -> RowOrder -> RowOrder -> [RowOrder] Source #

Show RowOrder Source # |
Instance details Defined in Graphics.Gloss.Internals.Rendering.Bitmap Methods showsPrec :: Int -> RowOrder -> ShowS Source # show :: RowOrder -> String Source # showList :: [RowOrder] -> ShowS Source #
Eq RowOrder Source # |
Instance details Defined in Graphics.Gloss.Internals.Rendering.Bitmap Methods (==) :: RowOrder -> RowOrder -> Bool Source # (/=) :: RowOrder -> RowOrder -> Bool Source #
Ord RowOrder Source # |

Instance details

Defined in Graphics.Gloss.Internals.Rendering.Bitmap

Methods

compare :: RowOrder -> RowOrder -> Ordering Source #

(<) :: RowOrder -> RowOrder -> Bool Source #

(<=) :: RowOrder -> RowOrder -> Bool Source #

(>) :: RowOrder -> RowOrder -> Bool Source #

(>=) :: RowOrder -> RowOrder -> Bool Source #

max :: RowOrder -> RowOrder -> RowOrder Source #

min :: RowOrder -> RowOrder -> RowOrder Source #

bitmapOfForeignPtr :: Int -> Int -> BitmapFormat -> ForeignPtr Word8 -> Bool -> Picture Source #

O(1). Use a `ForeignPtr` of RGBA data as a bitmap with the given width and height.

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`.

bitmapDataOfForeignPtr :: Int -> Int -> BitmapFormat -> ForeignPtr Word8 -> Bool -> BitmapData Source #

bitmapOfByteString :: Int -> Int -> BitmapFormat -> ByteString -> Bool -> Picture Source #

O(size). Copy a `ByteString` of RGBA data into a bitmap with the given width and height.

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`.

bitmapDataOfByteString :: Int -> Int -> BitmapFormat -> ByteString -> Bool -> BitmapData Source #

bitmapOfBMP :: BMP -> Picture Source #

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

bitmapDataOfBMP :: BMP -> BitmapData Source #

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

loadBMP :: FilePath -> IO Picture Source #

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

# Rendering

displayPicture Source #

Arguments

:: (Int, Int) | Window width and height.
-> Color | Color to clear the window with.
-> State | Current rendering state.
-> Float | View port scale, which controls the level of detail. Use 1.0 to start with.
-> Picture | Picture to draw.
-> IO () |

Set up the OpenGL context, clear the buffer, and render the given picture into it.

This is the same as `renderPicture` composed with `withModelview` and `withClearBuffer`. If you want to manage your own OpenGL context then you can just call `renderPicture`.

Using this function assumes that you've already opened a window and set that to the active context. If you don't want to do your own window management then use the `gloss` package instead.

renderPicture Source #

Arguments

:: State | Current rendering state.
-> Float | View port scale, which controls the level of detail. Use 1.0 to start with.
-> Picture | Picture to render.
-> IO () |

Render a picture into the current OpenGL context.

Assumes that the OpenGL matrix mode is set to `Modelview`

withModelview Source #

Arguments

:: (Int, Int) | Width and height of window.
-> IO () | Action to perform.
-> IO () |

Set up the OpenGL rendering context for orthographic projection and run an action to draw the model.

withClearBuffer Source #

Arguments

:: Color | Background color
-> IO () | Action to perform
-> IO () |

Clear the OpenGL buffer with the given background color and run an action to draw the model.

initState :: IO State Source #

A mutable render state holds references to the textures currently loaded into the OpenGL context. To ensure that textures are cached in GPU memory, pass the same `State` each time you call `displayPicture` or `renderPicture`.

data State Source #

Abstract Gloss render state which holds references to textures loaded into the GPU context.