ยค ColorGen, ColorSpec, et al

Drawing attributes

Types

class ColorGen a where
   tryConvColorK :: FudgetIO f => a -> Cont (f i o) (Maybe Pixel)
   convColorListK :: FudgetIO f => [a] -> Cont (f i o) (Maybe Pixel)
instance ColorGen ColorSpec
instance ColorGen Char
instance ColorGen RGB
instance ColorGen Pixel

data ColorSpec = (Show a, ColorGen a) => ColorSpec a
instance Show ColorSpec
instance ColorGen ColorSpec

colorSpec :: (Show a, ColorGen a) => a -> ColorSpec
class FontGen a where
   tryConvFontK :: FudgetIO f => a -> Cont (f i o) (Maybe FontData)
   convFontListK :: FudgetIO f => [a] -> Cont (f i o) (Maybe FontData)
instance FontGen FontSpec
instance FontGen Char
instance FontGen (FontStructF (Array Char CharStruct))

data FontSpec = (Show a, FontGen a) => FontSpeci a
instance Show FontSpec
instance FontGen FontSpec

fontSpec :: (Show a, FontGen a) => a -> FontSpec

Description

Types and classes for specifying colors and fonts in various ways.

Fonts and colors can be specified using strings. Examples of colors are "red", "rgb:ffff/0/0", "#ff0000". Examples of fonts are "fixed", "variable", "-*-times-*-24-*".

You can also use lists of colors or fonts to specify a color or a font. The first available color or font in the list is then taken. For example, ["gold","yellow"] uses gold if it can be allocated and falls back to yellow otherwise.

Color and font names will automatically be converted to the appropriate GCIds, FontIds and Pixels when needed.

For efficiency, fonts, colors and other drawing attributes can also be allocated once and for all in advance using e.g. wCreateGCtx.

See Also

The new way, suitable in combination with Drawings: GCtx.

The old way: loadQueryFontF, allocNamedColorF, wCreateGC.

Description of color and font specifications: the manual page for X, Xlib Programming Manual .

Bugs

Incomplete documentation.

The methods in classes ColorGen and FontGen should not be exported, since they differ depending on whether the Haskell compiler in use supports existentiall types.

This page documents work progress. Information on this page is subject to change without notice and does not represent a commitment on the part of the Fudgets corporation.