1blender(1) AfterStep X11 window manager blender(1)
2
3
4
6 blender - functionality for blending of image data using diofferent
7 algorithms libAfterImage/blender.h
8
11 Defines implemented methods for ASScanline combining, that could
12 be passed to merge_layers() via ASImageLayer structure.
13 Also includes functions for colorspace conversion RGB<->HSV and
14 RGB<->HLS.
15
17 Functions :
18 Colorspace conversion :
19 rgb2value(), rgb2saturation(), rgb2hue(), rgb2luminance(),
20 rgb2hsv(), rgb2hls(), hsv2rgb(), hls2rgb().
21
22 merge_scanline methods :
23 alphablend_scanlines(), allanon_scanlines(),
24 tint_scanlines(), add_scanlines(), sub_scanlines(),
25 diff_scanlines(), darken_scanlines(), lighten_scanlines(),
26 screen_scanlines(), overlay_scanlines(), hue_scanlines(),
27 saturate_scanlines(), value_scanlines(),
28 colorize_scanlines(), dissipate_scanlines().
29
30 usefull merging function name to function translator :
31 blend_scanlines_name2func()
32
33 Other libAfterImage modules :
34 ascmap.h asfont.h asimage.h asvisual.h blender.h export.h
35 import.h transform.h ximage.h
36
38 Sasha Vasko <sasha at aftercode dot net>
39
42 RGB colorspace: each color is represented as a combination of
43 red, green and blue values. Each value can be in 2 formats :
44 8 bit and 24.8 bit. 24.8 bit makes for 32bit value with lower 8 bits
45 used as a fraction for better calculation precision.
46
47 HSV colorspace: each color is represented as a combination of
48 hue, saturation and value. Hue is generally colorizing component where
49 value represents brightness.
50
51 HLS colorspace: each color is represented as a combination of
52 hue, luminance and saturation. It is analogous to HSV with value
53 substituted by luminance, except that luminance could be both
54 negative and positive.
55
56 alpha channel could be added to any of the above colorspaces. alpha
57 channel is generally used to define transparentness of the color.
58 libAfterImage is using ARGB colorspace as a base colorspace, and
59 represents most colors as ARGB32 values or ASScanline scanlines of
60 pixels.
61
63 rgb2saturation()
64
65 rgb2hue()
66
67 rgb2luminance()
68
69
70
72 CARD32 rgb2value( CARD32 red, CARD32 green, CARD32 blue );
73 CARD32 rgb2saturation( CARD32 red, CARD32 green, CARD32 blue );
74 CARD32 rgb2hue( CARD32 red, CARD32 green, CARD32 blue );
75 CARD32 rgb2luminance (CARD32 red, CARD32 green, CARD32 blue );
76
78 red - 32 bit value, 16 lower bits of which represent red channel
79
80 green - 32 bit value, 16 lower bits of which represent green channel
81
82 blue - 32 bit value, 16 lower bits of which represent blue channel
83
84
86 32 bit value, 16 lower bits of which represent value, saturation, hue,
87 or luminance respectively.
88
90 This functions translate RGB color into respective coordinates of
91 HSV and HLS colorspaces.
92 Returned hue values are in 16bit format. To translate it to and from
93 conventional 0-360 degree range, please use :
94 degrees2hue16() - converts conventional hue in 0-360 range into hue16
95 hue162degree() - converts 16bit hue value into conventional degrees.
96
98 rgb2hls()
99
100
101
103 CARD32 rgb2hsv( CARD32 red, CARD32 green, CARD32 blue,
104 CARD32 *saturation, CARD32 *value );
105 CARD32 rgb2hls( CARD32 red, CARD32 green, CARD32 blue,
106 CARD32 *luminance, CARD32 *saturation );
107
109 red - 32 bit value, 16 lower bits of which represent red channel
110
111 green - 32 bit value, 16 lower bits of which represent green channel
112
113 blue - 32 bit value, 16 lower bits of which represent blue channel
114
115
117 32 bit value, 16 lower bits of which represent hue.
118 32bit value pointed to by luminance, value and saturation will be set
119 respectively to color luminance, value and saturation.
120
122 This functions translate RGB color into full set of HSV and HLS
123 coordinates at once. These functions work faster then separate
124 translation into each channel.
125
127 hls2rgb()
128
129
130
132 void hsv2rgb( CARD32 hue, CARD32 saturation, CARD32 value,
133 CARD32 *red, CARD32 *green, CARD32 *blue);
134 void hls2rgb( CARD32 hue, CARD32 luminance, CARD32 saturation,
135 CARD32 *red, CARD32 *green, CARD32 *blue);
136
138 hue - 32 bit value, 16 lower bits of which represent hue.
139
140 saturation
141 - 32 bit value, 16 lower bits of which represent saturation.
142
143 value - 32 bit value, 16 lower bits of which represent value.
144
145 luminance
146 - 32 bit value, 16 lower bits of which represent luminance.
147
148
150 32bit value pointed to by red, green and blue will be set
151 respectively to RGB color channels.
152
154 This functions performs reverse translation from HSV and HSL to
155 RGB color
156
158 - combines top and bottom RGB components based on alpha channel value:
159 bottom = bottom*(255-top_alpha)+top*top_alpha; allanon_scanlines() -
160 averages each pixel between two scanlines. This method has been first
161 implemented by Ethan Fisher aka allanon as mode 130: bottom = (bot‐
162 tom+top)/2; tint_scanlines() - tints bottom scanline with top scanline(
163 with saturation to prevent overflow) : bottom = (bottom*(top/2))/32768;
164 add_scanlines() - adds top scanline to bottom scanline with saturation
165 to prevent overflow: bottom = bottom+top; sub_scanlines() - substrates
166 top scanline from bottom scanline with saturation to prevent overflow:
167 bottom = bottom-top; diff_scanlines() - for each pixel calculates abso‐
168 lute difference between bottom and top color value : bottom = (bot‐
169 tom>top)?bottom-top:top-bottom; darken_scanlines() - substitutes each
170 pixel with minimum color value of top and bottom : bottom = (bot‐
171 tom>top)?top:bottom; lighten_scanlines() - substitutes each pixel with
172 maximum color value of top and bottom : bottom = (bottom>top)?bot‐
173 tom:top; screen_scanlines() - some wierd merging algorithm taken from
174 GIMP; overlay_scanlines() - some wierd merging algorithm taken from
175 GIMP; hue_scanlines() - substitute hue of bottom scanline with hue of
176 top scanline; saturate_scanlines() - substitute saturation of bottom
177 scanline with the saturation of top scanline; value_scanlines() - sub‐
178 stitute value of bottom scanline with the value of top scanline; col‐
179 orize_scanlines() - combine luminance of bottom scanline with hue and
180 saturation of top scanline; dissipate_scanlines()- randomly alpha-blend
181 bottom and top scanlines, using alpha value of top scanline as a
182 threshold for random values.
183
184
186 void alphablend_scanlines( ASScanline *bottom, ASScanline *top, int );
187 void allanon_scanlines ( ASScanline *bottom, ASScanline *top, int );
188 void tint_scanlines ( ASScanline *bottom, ASScanline *top, int );
189 void add_scanlines ( ASScanline *bottom, ASScanline *top, int );
190 void sub_scanlines ( ASScanline *bottom, ASScanline *top, int );
191 void diff_scanlines ( ASScanline *bottom, ASScanline *top, int );
192 void darken_scanlines ( ASScanline *bottom, ASScanline *top, int );
193 void lighten_scanlines ( ASScanline *bottom, ASScanline *top, int );
194 void screen_scanlines ( ASScanline *bottom, ASScanline *top, int );
195 void overlay_scanlines ( ASScanline *bottom, ASScanline *top, int );
196 void hue_scanlines ( ASScanline *bottom, ASScanline *top, int );
197 void saturate_scanlines ( ASScanline *bottom, ASScanline *top, int );
198 void value_scanlines ( ASScanline *bottom, ASScanline *top, int );
199 void colorize_scanlines ( ASScanline *bottom, ASScanline *top, int );
200 void dissipate_scanlines ( ASScanline *bottom, ASScanline *top, int );
201
203 bottom - pointer to the ASScanline that will be overalayed
204
205 top - pointer to ASScanline that will overlay bottom.
206
207
209 This functions accept 2 scanlines as an arguments stored in
210 ASScanline structures with data in 24.8 format. Merging operation is
211 performed on these scanlines and result is stored in bottom
212 ASScanline.
213 The following are merging methods used in each function :
214
216 list_scanline_merging()
217
218
219
221 merge_scanlines_func blend_scanlines_name2func( const char *name );
222 void list_scanline_merging(FILE* stream, const char *format);
223
225 name - string, identifying scanline merging function.
226
227
229 returns pointer to the scanline merging function on succes.
230 NULL on failure.
231
233 blend_scanlines_name2func() will strip leading whitespaces off of
234 the supplied name, and then will attempt to match it against the list
235 of names of merging functions. It will then return pointer to the
236 function with matching name.
237 list_scanline_merging() simply prints out description of implemented
238 blending/merging methods onto the supplied stream, in supplied format.
239 Format must include 2 string specs, like so : "%s - %s" where first
240 one will be substituted to short method name, and second - description
241
242
243
2443rd Berkeley Distribution AfterStep v.2.2.6 blender(1)