bx-lib : the Basic X11 Library tuned for C beginners  1.0
Typedefs | Enumerations
Symbolic constants for pen attributes
Pen (what you use to draw on a canvas)

Typedefs

typedef enum bx_effect bx_effect
typedef enum bx_line_style bx_line_style
typedef enum bx_fill_style bx_fill_style
typedef enum bx_fill_rule bx_fill_rule
typedef enum bx_fill bx_fill
typedef enum bx_closure bx_closure

Enumerations

enum  bx_effect {
  BX_ZERO = GXclear,
  BX_A_AND_B = GXand,
  BX_A_AND_NOT_B = GXandReverse,
  BX_A = GXcopy,
  BX_NOT_A_AND_B = GXandInverted,
  BX_B = GXnoop,
  BX_A_XOR_B = GXxor,
  BX_A_OR_B = GXor,
  BX_A_NOR_B = GXnor,
  BX_A_EQV_B = GXequiv,
  BX_NOT_B = GXinvert,
  BX_A_OR_NOT_B = GXorReverse,
  BX_NOT_A = GXcopyInverted,
  BX_NOT_A_OR_B = GXorInverted,
  BX_A_NAND_B = GXnand,
  BX_ONE = GXset
}
enum  bx_line_style {
  BX_SOLID_LINE = LineSolid,
  BX_DASH2_LINE = LineDoubleDash,
  BX_DASH_LINE = LineOnOffDash
}
enum  bx_fill_style {
  BX_SOLID_FILL = FillSolid,
  BX_TILED_FILL = FillTiled
}
enum  bx_fill_rule {
  BX_WINDING_RULE = WindingRule,
  BX_EVEN_ODD_RULE = EvenOddRule
}
enum  bx_fill {
  BX_NOT_FILLED = 0,
  BX_FILLED = 1
}
enum  bx_closure {
  BX_NOT_CLOSED = 0,
  BX_CLOSED = 1
}

Detailed Description

Typedef Documentation

typedef enum bx_effect bx_effect

Symbolic constants for the special effect fx in function bx_draw_image_fx() and all drawing functions via bx_set_fx(). Each bit of an opaque pixel of the source (noted A) is combined with the corresponding bit of the underlying pixel of the canvas (noted B) via a boolean function F(A,B).

The 4 entries of the truth table (F(0,0),F(0,1),F(1,0),F(1,1)) of this function F correspond to the binary representation (fx3,fx2,fx1,fx0) of the integer fx.

For example, if fx=7, then fx is written (0,1,1,1) in binary, which means F(0,0)=0 and F(A,B)=1 in any other case, that is, F(A,B)= A AND B. This produces a "burn" effect: the bits of the image and the canvas combine into a bitwise AND to produce darker pixels.

Similarily, if fx=1, then fx is written (0,0,0,1) in binary, which means F(1,1)=0 and F(A,B)=0 in any other case, that is, F(A,B)= A OR B. This produces a "glow" effect: the bits of the image and the canvas combine into a bitwise OR to produce lighter pixels.

Remarks
  • This naturally holds in TrueColor mode where the bit-pattern of a pixel value directly encodes the (R,G,B) triplet of its color (8+8+8=24 bits and 5+6+5=16 bits are the most common pixel depths).
  • This also holds in PseudoColor where pixel values are 8-bits indexes in a 256 colors palette because bx-lib stores a 8*8*4 "poor-man" RGB cube in this palette, in such a way that the bit pattern of an index value can be interpreted as a degenerated direct TrueColor encoding on 3+3+2 bits.

The type passed to bx_set_set_line_style() to specify whether contour lines should be drawn plain solid or dashed. Dashed line patterns either alternate between the principal and secondary color (set with bx_set_color() and bx_set_color2()) or alternate between the principal color and no color.

The type passed to bx_set_fill_style() to specify how interiors of shapes are painted when those are filled. Two styles are supported: plain solid fill with the principal color (set with bx_set_color()) or "bathroom tile" style with a repeating pattern described by an image (set with bx_set_tile_image()).

typedef enum bx_fill_rule bx_fill_rule

The type passed to bx_set_fill_rule() and some interior test functions such as bx_in_polygon(), specifying which rule is used to determine if a point belongs to the interior of self intersecting curve or polygon.

The two available methods both cast an horizontal ray rightwards from the point to be tested.

  • With the even-odd method, the point belongs to the interior of the shape if the ray intersects its contour an odd number of times.
  • With the winding number method, the point belongs to the interior of the shape if the ray intersects upwards and downwards portions of the contour a different number of times.
typedef enum bx_fill bx_fill

The type passed to some drawing functions such as bx_draw_box() to specify whether the interior of the shape should be painted or the contour should drawn.

typedef enum bx_closure bx_closure

The type passed to some drawing functions such as bx_draw_polygon() to specify whether a polygonal or curved shape is to be drawn closed or open.

Enumeration Type Documentation

enum bx_effect

Symbolic constants for the special effect fx in function bx_draw_image_fx() and all drawing functions via bx_set_fx(). Each bit of an opaque pixel of the source (noted A) is combined with the corresponding bit of the underlying pixel of the canvas (noted B) via a boolean function F(A,B).

The 4 entries of the truth table (F(0,0),F(0,1),F(1,0),F(1,1)) of this function F correspond to the binary representation (fx3,fx2,fx1,fx0) of the integer fx.

For example, if fx=7, then fx is written (0,1,1,1) in binary, which means F(0,0)=0 and F(A,B)=1 in any other case, that is, F(A,B)= A AND B. This produces a "burn" effect: the bits of the image and the canvas combine into a bitwise AND to produce darker pixels.

Similarily, if fx=1, then fx is written (0,0,0,1) in binary, which means F(1,1)=0 and F(A,B)=0 in any other case, that is, F(A,B)= A OR B. This produces a "glow" effect: the bits of the image and the canvas combine into a bitwise OR to produce lighter pixels.

Remarks
  • This naturally holds in TrueColor mode where the bit-pattern of a pixel value directly encodes the (R,G,B) triplet of its color (8+8+8=24 bits and 5+6+5=16 bits are the most common pixel depths).
  • This also holds in PseudoColor where pixel values are 8-bits indexes in a 256 colors palette because bx-lib stores a 8*8*4 "poor-man" RGB cube in this palette, in such a way that the bit pattern of an index value can be interpreted as a degenerated direct TrueColor encoding on 3+3+2 bits.
Enumerator:
BX_ZERO 

(= 0 = 0000) black shadow

BX_A_AND_B 

(= 1 = 0001) the "burn" effect

BX_A_AND_NOT_B 

(= 2 = 0010)

BX_A 

(= 3 = 0011) the default, the source is copied no special effect

BX_NOT_A_AND_B 

(= 4 = 0100)

BX_B 

(= 5 = 0101) nothing happens, the destination is coied over itself

BX_A_XOR_B 

(= 6 = 0110)

BX_A_OR_B 

(= 7 = 0111) the "glow" effect

BX_A_NOR_B 

(= 8 = 1000) the video-inversion of the "glow" effect

BX_A_EQV_B 

(= 9 = 1001)

BX_NOT_B 

(=10 = 1010) video-inversion of the destination

BX_A_OR_NOT_B 

(=11 = 1011)

BX_NOT_A 

(=12 = 1100) video-inversion of the source

BX_NOT_A_OR_B 

(=13 = 1101)

BX_A_NAND_B 

(=14 = 1110) the video-inversion of the "burn" effect

BX_ONE 

(=15 = 1111) white shadow

The type passed to bx_set_set_line_style() to specify whether contour lines should be drawn plain solid or dashed. Dashed line patterns either alternate between the principal and secondary color (set with bx_set_color() and bx_set_color2()) or alternate between the principal color and no color.

Enumerator:
BX_SOLID_LINE 

plain solid line

BX_DASH2_LINE 

dashed line alternating between with principal and secondary color

BX_DASH_LINE 

dashed line alternating between with principal color and no color

The type passed to bx_set_fill_style() to specify how interiors of shapes are painted when those are filled. Two styles are supported: plain solid fill with the principal color (set with bx_set_color()) or "bathroom tile" style with a repeating pattern described by an image (set with bx_set_tile_image()).

Enumerator:
BX_SOLID_FILL 

plain solid fill with principal color

BX_TILED_FILL 

bathroom tiles with an image

The type passed to bx_set_fill_rule() and some interior test functions such as bx_in_polygon(), specifying which rule is used to determine if a point belongs to the interior of self intersecting curve or polygon.

The two available methods both cast an horizontal ray rightwards from the point to be tested.

  • With the even-odd method, the point belongs to the interior of the shape if the ray intersects its contour an odd number of times.
  • With the winding number method, the point belongs to the interior of the shape if the ray intersects upwards and downwards portions of the contour a different number of times.
Enumerator:
BX_WINDING_RULE 

The winding number rule

BX_EVEN_ODD_RULE 

The even-odd rule

enum bx_fill

The type passed to some drawing functions such as bx_draw_box() to specify whether the interior of the shape should be painted or the contour should drawn.

Enumerator:
BX_NOT_FILLED 

draw the contour (= 0)

BX_FILLED 

fill the interior (= 1)

enum bx_closure

The type passed to some drawing functions such as bx_draw_polygon() to specify whether a polygonal or curved shape is to be drawn closed or open.

Enumerator:
BX_NOT_CLOSED 

open shape (= 0)

BX_CLOSED 

closed shape (= 1)