¤ ColorGen, ColorSpec, et al

Drawing attributes

Types

class ColorGen a where
   tryConvColorK :: (FudgetIO d) => a -> Cont (d b c) (Maybe Pixel)
   convColorListK :: (FudgetIO g) => [a] -> Cont (g e f) (Maybe Pixel)
  instance ColorGen Pixel
  instance ColorGen RGB
  instance ColorGen ColorSpec
  instance ColorGen Char
data ColorSpec = (Show ?a, ColorGen ?a) => ColorSpec ?a
  instance ColorGen ColorSpec
  instance Show ColorSpec
colorSpec :: (Show a, ColorGen a) => a -> ColorSpec
class FontGen a where
   tryConvFontK :: (FudgetIO d) => a -> Cont (d b c) (Maybe FontStruct)
   convFontListK :: (FudgetIO g) => [a] -> Cont (g e f) (Maybe FontStruct)
  instance FontGen FontStruct
  instance FontGen FontSpec
  instance FontGen Char
data FontSpec = (Show ?a, FontGen ?a) => FontSpec ?a
  instance FontGen FontSpec
  instance Show 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. 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.