author | clem <clem> | 2004-10-07 19:36:30 (UTC) |
---|---|---|
committer | clem <clem> | 2004-10-07 19:36:30 (UTC) |
commit | b2e0fd018e1122f65dbbf8ab564e992988f35385 (patch) (unidiff) | |
tree | d47db77ff4ba1e9d397bc682f5d65b05b049dd02 /libopie2/opieui | |
parent | 33c90b7be9d675e8e5b39cfd569997bfcbb5decf (diff) | |
download | opie-b2e0fd018e1122f65dbbf8ab564e992988f35385.zip opie-b2e0fd018e1122f65dbbf8ab564e992988f35385.tar.gz opie-b2e0fd018e1122f65dbbf8ab564e992988f35385.tar.bz2 |
small documentation format fixes
-rw-r--r-- | libopie2/opieui/oimageeffect.h | 6 | ||||
-rw-r--r-- | libopie2/opieui/opixmapeffect.h | 11 |
2 files changed, 6 insertions, 11 deletions
diff --git a/libopie2/opieui/oimageeffect.h b/libopie2/opieui/oimageeffect.h index 4f86d5b..4422741 100644 --- a/libopie2/opieui/oimageeffect.h +++ b/libopie2/opieui/oimageeffect.h | |||
@@ -126,282 +126,282 @@ public: | |||
126 | * @param opacity opacity (in percent) which determines how much the source | 126 | * @param opacity opacity (in percent) which determines how much the source |
127 | * image will be blended into the destination image. | 127 | * image will be blended into the destination image. |
128 | * @return The destination image (dst) containing the result. | 128 | * @return The destination image (dst) containing the result. |
129 | */ | 129 | */ |
130 | static QImage& blend(QImage& src, QImage& dst, float opacity); | 130 | static QImage& blend(QImage& src, QImage& dst, float opacity); |
131 | 131 | ||
132 | /** | 132 | /** |
133 | * Blend the provided image into a background of the indicated color. | 133 | * Blend the provided image into a background of the indicated color. |
134 | * | 134 | * |
135 | * @param initial_intensity this parameter takes values from -1 to 1: | 135 | * @param initial_intensity this parameter takes values from -1 to 1: |
136 | * a) if positive: how much to fade the image in its | 136 | * a) if positive: how much to fade the image in its |
137 | * less affected spot | 137 | * less affected spot |
138 | * b) if negative: roughly indicates how much of the image | 138 | * b) if negative: roughly indicates how much of the image |
139 | * remains unaffected | 139 | * remains unaffected |
140 | * @param bgnd indicates the color of the background to blend in | 140 | * @param bgnd indicates the color of the background to blend in |
141 | * @param eff lets you choose what kind of blending you like | 141 | * @param eff lets you choose what kind of blending you like |
142 | * @param anti_dir blend in the opposite direction (makes no much sense | 142 | * @param anti_dir blend in the opposite direction (makes no much sense |
143 | * with concentric blending effects) | 143 | * with concentric blending effects) |
144 | * @param image must be 32bpp | 144 | * @param image must be 32bpp |
145 | */ | 145 | */ |
146 | static QImage& blend(QImage &image, float initial_intensity, | 146 | static QImage& blend(QImage &image, float initial_intensity, |
147 | const QColor &bgnd, GradientType eff, | 147 | const QColor &bgnd, GradientType eff, |
148 | bool anti_dir=false); | 148 | bool anti_dir=false); |
149 | 149 | ||
150 | /** | 150 | /** |
151 | * Blend an image into another one, using a gradient type | 151 | * Blend an image into another one, using a gradient type |
152 | * for blending from one to another. | 152 | * for blending from one to another. |
153 | * | 153 | * |
154 | * @param image1 source1 and result of blending | 154 | * @param image1 source1 and result of blending |
155 | * @param image2 source2 of blending | 155 | * @param image2 source2 of blending |
156 | * @param gt gradient type for blending between source1 and source2 | 156 | * @param gt gradient type for blending between source1 and source2 |
157 | * @param xf x decay length for unbalanced gradient tpye | 157 | * @param xf x decay length for unbalanced gradient tpye |
158 | * @param yf y decay length for unbalanced gradient tpye | 158 | * @param yf y decay length for unbalanced gradient tpye |
159 | */ | 159 | */ |
160 | static QImage& blend(QImage &image1,QImage &image2, | 160 | static QImage& blend(QImage &image1,QImage &image2, |
161 | GradientType gt, int xf=100, int yf=100); | 161 | GradientType gt, int xf=100, int yf=100); |
162 | 162 | ||
163 | /** | 163 | /** |
164 | * Blend an image into another one, using a color channel of a | 164 | * Blend an image into another one, using a color channel of a |
165 | * third image for the decision of blending from one to another. | 165 | * third image for the decision of blending from one to another. |
166 | * | 166 | * |
167 | * @param image1 Source 1 and result of blending | 167 | * @param image1 Source 1 and result of blending |
168 | * @param image2 Source 2 of blending | 168 | * @param image2 Source 2 of blending |
169 | * @param blendImage If the gray value of of pixel is 0, the result | 169 | * @param blendImage If the gray value of of pixel is 0, the result |
170 | * for this pixel is that of image1; for a gray value | 170 | * for this pixel is that of image1; for a gray value |
171 | * of 1, the pixel of image2 is used; for a value | 171 | * of 1, the pixel of image2 is used; for a value |
172 | * inbetween, a corresponding blending is used. | 172 | * inbetween, a corresponding blending is used. |
173 | * @param channel The RBG channel to use for the blending decision. | 173 | * @param channel The RBG channel to use for the blending decision. |
174 | */ | 174 | */ |
175 | static QImage& blend(QImage &image1, QImage &image2, | 175 | static QImage& blend(QImage &image1, QImage &image2, |
176 | QImage &blendImage, RGBComponent channel); | 176 | QImage &blendImage, RGBComponent channel); |
177 | 177 | ||
178 | /** | 178 | /** |
179 | * Blend an image into another one, using alpha in the expected way. | 179 | * Blend an image into another one, using alpha in the expected way. |
180 | * @author Rik Hemsley (rikkus) <rik@kde.org> | 180 | * @author Rik Hemsley (rikkus) <rik@kde.org> |
181 | */ | 181 | */ |
182 | static bool blend(const QImage & upper, const QImage & lower, QImage & output); | 182 | static bool blend(const QImage & upper, const QImage & lower, QImage & output); |
183 | // Not yet... static bool blend(const QImage & image1, const QImage & image2, QImage & output, const QRect & destRect); | 183 | // Not yet... static bool blend(const QImage & image1, const QImage & image2, QImage & output, const QRect & destRect); |
184 | 184 | ||
185 | /** | 185 | /** |
186 | * Blend an image into another one, using alpha in the expected way and | 186 | * Blend an image into another one, using alpha in the expected way and |
187 | * over coordinates @p x and @p y with respect to the lower image. | 187 | * over coordinates @p x and @p y with respect to the lower image. |
188 | * The output is a QImage which is the @p upper image already blended | 188 | * The output is a QImage which is the @p upper image already blended |
189 | * with the @p lower one, so its size will be (in general) the same than | 189 | * with the @p lower one, so its size will be (in general) the same than |
190 | * @p upper instead of the same size than @p lower like the method above. | 190 | * @p upper instead of the same size than @p lower like the method above. |
191 | * In fact, the size of @p output is like upper's one only when it can be | 191 | * In fact, the size of @p output is like upper's one only when it can be |
192 | * painted on lower, if there has to be some clipping, output's size will | 192 | * painted on lower, if there has to be some clipping, output's size will |
193 | * be the clipped area and x and y will be set to the correct up-left corner | 193 | * be the clipped area and x and y will be set to the correct up-left corner |
194 | * where the clipped rectangle begins. | 194 | * where the clipped rectangle begins. |
195 | */ | 195 | */ |
196 | static bool blend(int &x, int &y, const QImage & upper, const QImage & lower, QImage & output); | 196 | static bool blend(int &x, int &y, const QImage & upper, const QImage & lower, QImage & output); |
197 | /** | 197 | /** |
198 | * Blend an image into another one, using alpha in the expected way and | 198 | * Blend an image into another one, using alpha in the expected way and |
199 | * over coordinates @p x and @p y with respect to the lower image. | 199 | * over coordinates @p x and @p y with respect to the lower image. |
200 | * The output is painted in the own @p lower image. This is an optimization | 200 | * The output is painted in the own @p lower image. This is an optimization |
201 | * of the blend method above provided by convenience. | 201 | * of the blend method above provided by convenience. |
202 | */ | 202 | */ |
203 | static bool blendOnLower(int x, int y, const QImage & upper, const QImage & lower); | 203 | static bool blendOnLower(int x, int y, const QImage & upper, const QImage & lower); |
204 | 204 | ||
205 | /** | 205 | /** |
206 | * Modifies the intensity of a pixmap's RGB channel component. | 206 | * Modifies the intensity of a pixmap's RGB channel component. |
207 | * | 207 | * |
208 | * @author Daniel M. Duley (mosfet) | 208 | * @author Daniel M. Duley (mosfet) |
209 | * @param image The QImage to process. | 209 | * @param image The QImage to process. |
210 | * @param percent Percent value. Use a negative value to dim. | 210 | * @param percent Percent value. Use a negative value to dim. |
211 | * @param channel Which channel(s) should be modified | 211 | * @param channel Which channel(s) should be modified |
212 | * @return The @p image, provided for convenience. | 212 | * @return The @p image, provided for convenience. |
213 | */ | 213 | */ |
214 | static QImage& channelIntensity(QImage &image, float percent, | 214 | static QImage& channelIntensity(QImage &image, float percent, |
215 | RGBComponent channel); | 215 | RGBComponent channel); |
216 | 216 | ||
217 | /** | 217 | /** |
218 | * Fade an image to a certain background color. | 218 | * Fade an image to a certain background color. |
219 | * | 219 | * |
220 | * The number of colors will not be changed. | 220 | * The number of colors will not be changed. |
221 | * | 221 | * |
222 | * @param image The QImage to process. | 222 | * @param img The QImage to process. |
223 | * @param val The strength of the effect. 0 <= val <= 1. | 223 | * @param val The strength of the effect. 0 <= val <= 1. |
224 | * @param color The background color. | 224 | * @param color The background color. |
225 | * @return Returns the @ref image(), provided for convenience. | 225 | * @return Returns the @ref image(), provided for convenience. |
226 | */ | 226 | */ |
227 | static QImage& fade(QImage &img, float val, const QColor &color); | 227 | static QImage& fade(QImage &img, float val, const QColor &color); |
228 | 228 | ||
229 | 229 | ||
230 | /** | 230 | /** |
231 | * This recolors a pixmap. The most dark color will become color a, | 231 | * This recolors a pixmap. The most dark color will become color a, |
232 | * the most bright one color b, and in between. | 232 | * the most bright one color b, and in between. |
233 | * | 233 | * |
234 | * @param image A QImage to process. | 234 | * @param image A QImage to process. |
235 | * @param ca Color a | 235 | * @param ca Color a |
236 | * @param cb Color b | 236 | * @param cb Color b |
237 | */ | 237 | */ |
238 | static QImage& flatten(QImage &image, const QColor &ca, | 238 | static QImage& flatten(QImage &image, const QColor &ca, |
239 | const QColor &cb, int ncols=0); | 239 | const QColor &cb, int ncols=0); |
240 | 240 | ||
241 | /** | 241 | /** |
242 | * Build a hash on any given @ref QImage | 242 | * Build a hash on any given @ref QImage |
243 | * | 243 | * |
244 | * @param image The QImage to process | 244 | * @param image The QImage to process |
245 | * @param lite The hash faces the indicated lighting (cardinal poles). | 245 | * @param lite The hash faces the indicated lighting (cardinal poles). |
246 | * @param spacing How many unmodified pixels inbetween hashes. | 246 | * @param spacing How many unmodified pixels inbetween hashes. |
247 | * @return Returns the @ref image(), provided for convenience. | 247 | * @return Returns the @ref image(), provided for convenience. |
248 | */ | 248 | */ |
249 | static QImage& hash(QImage &image, Lighting lite=NorthLite, | 249 | static QImage& hash(QImage &image, Lighting lite=NorthLite, |
250 | unsigned int spacing=0); | 250 | unsigned int spacing=0); |
251 | 251 | ||
252 | /** | 252 | /** |
253 | * Either brighten or dim the image by a specified percent. | 253 | * Either brighten or dim the image by a specified percent. |
254 | * For example, .50 will modify the colors by 50%. | 254 | * For example, .50 will modify the colors by 50%. |
255 | * | 255 | * |
256 | * @author Daniel M. Duley (mosfet) | 256 | * @author Daniel M. Duley (mosfet) |
257 | * @param image The QImage to process. | 257 | * @param image The QImage to process. |
258 | * @param percent The percent value. Use a negative value to dim. | 258 | * @param percent The percent value. Use a negative value to dim. |
259 | * @return Returns The @ref image(), provided for convenience. | 259 | * @return Returns The @ref image(), provided for convenience. |
260 | */ | 260 | */ |
261 | static QImage& intensity(QImage &image, float percent); | 261 | static QImage& intensity(QImage &image, float percent); |
262 | 262 | ||
263 | /** | 263 | /** |
264 | * Modulate the image with a color channel of another image. | 264 | * Modulate the image with a color channel of another image. |
265 | * | 265 | * |
266 | * @param image The QImage to modulate and result. | 266 | * @param image The QImage to modulate and result. |
267 | * @param modImage The QImage to use for modulation. | 267 | * @param modImage The QImage to use for modulation. |
268 | * @param reverse Invert the meaning of image/modImage; result is image! | 268 | * @param reverse Invert the meaning of image/modImage; result is image! |
269 | * @param type The modulation Type to use. | 269 | * @param type The modulation Type to use. |
270 | * @param factor The modulation amplitude; with 0 no effect [-200;200]. | 270 | * @param factor The modulation amplitude; with 0 no effect [-200;200]. |
271 | * @param channel The RBG channel of image2 to use for modulation. | 271 | * @param channel The RBG channel of image2 to use for modulation. |
272 | * @return Returns the @ref image(), provided for convenience. | 272 | * @return Returns the @ref image(), provided for convenience. |
273 | */ | 273 | */ |
274 | static QImage& modulate(QImage &image, QImage &modImage, bool reverse, | 274 | static QImage& modulate(QImage &image, QImage &modImage, bool reverse, |
275 | ModulationType type, int factor, RGBComponent channel); | 275 | ModulationType type, int factor, RGBComponent channel); |
276 | 276 | ||
277 | /** | 277 | /** |
278 | * Convert an image to grayscale. | 278 | * Convert an image to grayscale. |
279 | * | 279 | * |
280 | * @author Daniel M. Duley (mosfet) | 280 | * @author Daniel M. Duley (mosfet) |
281 | * @param image The @ref QImage to process. | 281 | * @param image The @ref QImage to process. |
282 | * @param fast Set to @p true in order to use a faster but non-photographic | 282 | * @param fast Set to @p true in order to use a faster but non-photographic |
283 | * quality algorithm. Appropriate for things such as toolbar icons. | 283 | * quality algorithm. Appropriate for things such as toolbar icons. |
284 | * @return Returns the @ref image(), provided for convenience. | 284 | * @return Returns the @ref image(), provided for convenience. |
285 | */ | 285 | */ |
286 | static QImage& toGray(QImage &image, bool fast = false); | 286 | static QImage& toGray(QImage &image, bool fast = false); |
287 | 287 | ||
288 | /** | 288 | /** |
289 | * Desaturate an image evenly. | 289 | * Desaturate an image evenly. |
290 | * | 290 | * |
291 | * @param image The QImage to process. | 291 | * @param image The QImage to process. |
292 | * @param desat A value between 0 and 1 setting the degree of desaturation | 292 | * @param desat A value between 0 and 1 setting the degree of desaturation |
293 | * @return Returns the @ref image(), provided for convenience. | 293 | * @return Returns the @ref image(), provided for convenience. |
294 | */ | 294 | */ |
295 | static QImage& desaturate(QImage &image, float desat = 0.3); | 295 | static QImage& desaturate(QImage &image, float desat = 0.3); |
296 | 296 | ||
297 | /** | 297 | /** |
298 | * Fast, but low quality contrast of an image. Also see contrastHSV. | 298 | * Fast, but low quality contrast of an image. Also see contrastHSV. |
299 | * | 299 | * |
300 | * @author Daniel M. Duley (mosfet) | 300 | * @author Daniel M. Duley (mosfet) |
301 | * @param image The QImage to process. | 301 | * @param image The QImage to process. |
302 | * @param c A contrast value between -255 to 255. | 302 | * @param c A contrast value between -255 to 255. |
303 | * @return The @ref image(), provided for convenience. | 303 | * @return The @ref image(), provided for convenience. |
304 | */ | 304 | */ |
305 | static QImage& contrast(QImage &image, int c); | 305 | static QImage& contrast(QImage &image, int c); |
306 | 306 | ||
307 | /** | 307 | /** |
308 | * Dither an image using Floyd-Steinberg dithering for low-color | 308 | * Dither an image using Floyd-Steinberg dithering for low-color |
309 | * situations. | 309 | * situations. |
310 | * | 310 | * |
311 | * @param image The QImage to process. | 311 | * @param img The QImage to process. |
312 | * @param palette The color palette to use | 312 | * @param palette The color palette to use |
313 | * @param size The size of the palette | 313 | * @param size The size of the palette |
314 | * @return Returns the @ref image(), provided for convenience. | 314 | * @return Returns the @ref image(), provided for convenience. |
315 | */ | 315 | */ |
316 | static QImage& dither(QImage &img, const QColor *palette, int size); | 316 | static QImage& dither(QImage &img, const QColor *palette, int size); |
317 | 317 | ||
318 | /** | 318 | /** |
319 | * Calculate the image for a selected image, for instance a selected icon | 319 | * Calculate the image for a selected image, for instance a selected icon |
320 | * on the desktop. | 320 | * on the desktop. |
321 | * @param img the QImage to select | 321 | * @param img the QImage to select |
322 | * @param col the selected color, usually from QColorGroup::highlight(). | 322 | * @param col the selected color, usually from QColorGroup::highlight(). |
323 | */ | 323 | */ |
324 | static QImage& selectedImage( QImage &img, const QColor &col ); | 324 | static QImage& selectedImage( QImage &img, const QColor &col ); |
325 | 325 | ||
326 | /** | 326 | /** |
327 | * High quality, expensive HSV contrast. You can do a faster one by just | 327 | * High quality, expensive HSV contrast. You can do a faster one by just |
328 | * taking a intensity threshold (ie: 128) and incrementing RGB color | 328 | * taking a intensity threshold (ie: 128) and incrementing RGB color |
329 | * channels above it and decrementing those below it, but this gives much | 329 | * channels above it and decrementing those below it, but this gives much |
330 | * better results. | 330 | * better results. |
331 | * | 331 | * |
332 | * @author Daniel M. Duley (mosfet) | 332 | * @author Daniel M. Duley (mosfet) |
333 | * @param img The QImage to process. | 333 | * @param img The QImage to process. |
334 | * @param sharpen If true sharpness is increase, (spiffed). Otherwise | 334 | * @param sharpen If true sharpness is increase, (spiffed). Otherwise |
335 | * it is decreased, (dulled). | 335 | * it is decreased, (dulled). |
336 | */ | 336 | */ |
337 | static void contrastHSV(QImage &img, bool sharpen=true); | 337 | static void contrastHSV(QImage &img, bool sharpen=true); |
338 | 338 | ||
339 | /** | 339 | /** |
340 | * Normalizes the pixel values to span the full range of color values. | 340 | * Normalizes the pixel values to span the full range of color values. |
341 | * This is a contrast enhancement technique. | 341 | * This is a contrast enhancement technique. |
342 | * @author Daniel M. Duley (mosfet) | 342 | * @author Daniel M. Duley (mosfet) |
343 | */ | 343 | */ |
344 | static void normalize(QImage &img); | 344 | static void normalize(QImage &img); |
345 | 345 | ||
346 | /** | 346 | /** |
347 | * Performs histogram equalization on the reference | 347 | * Performs histogram equalization on the reference |
348 | * image. | 348 | * image. |
349 | * @author Daniel M. Duley (mosfet) | 349 | * @author Daniel M. Duley (mosfet) |
350 | */ | 350 | */ |
351 | static void equalize(QImage &img); | 351 | static void equalize(QImage &img); |
352 | 352 | ||
353 | /** | 353 | /** |
354 | * Thresholds the reference image. You can also threshold images by using | 354 | * Thresholds the reference image. You can also threshold images by using |
355 | * ThresholdDither in the various QPixmap/QImage convert methods, but this | 355 | * ThresholdDither in the various QPixmap/QImage convert methods, but this |
356 | * lets you specify a threshold value. | 356 | * lets you specify a threshold value. |
357 | * | 357 | * |
358 | * @author Daniel M. Duley (mosfet) | 358 | * @author Daniel M. Duley (mosfet) |
359 | * @param img The QImage to process. | 359 | * @param img The QImage to process. |
360 | * @param value The threshold value. | 360 | * @param value The threshold value. |
361 | */ | 361 | */ |
362 | static void threshold(QImage &img, unsigned int value=128); | 362 | static void threshold(QImage &img, unsigned int value=128); |
363 | 363 | ||
364 | /** | 364 | /** |
365 | * Produces a 'solarization' effect seen when exposing a photographic | 365 | * Produces a 'solarization' effect seen when exposing a photographic |
366 | * film to light during the development process. | 366 | * film to light during the development process. |
367 | * | 367 | * |
368 | * @author Daniel M. Duley (mosfet) | 368 | * @author Daniel M. Duley (mosfet) |
369 | * @param img The QImage to process. | 369 | * @param img The QImage to process. |
370 | * @param factor The extent of the solarization (0-99.9) | 370 | * @param factor The extent of the solarization (0-99.9) |
371 | */ | 371 | */ |
372 | static void solarize(QImage &img, double factor=50.0); | 372 | static void solarize(QImage &img, double factor=50.0); |
373 | 373 | ||
374 | /** | 374 | /** |
375 | * Embosses the source image. This involves highlighting the edges | 375 | * Embosses the source image. This involves highlighting the edges |
376 | * and applying various other enhancements in order to get a metal | 376 | * and applying various other enhancements in order to get a metal |
377 | * effect. | 377 | * effect. |
378 | * | 378 | * |
379 | * @author Daniel M. Duley (mosfet) | 379 | * @author Daniel M. Duley (mosfet) |
380 | * @param src The QImage to process. | 380 | * @param src The QImage to process. |
381 | * @return The embossed image. The original is not changed. | 381 | * @return The embossed image. The original is not changed. |
382 | */ | 382 | */ |
383 | static QImage emboss(QImage &src); | 383 | static QImage emboss(QImage &src); |
384 | 384 | ||
385 | /** | 385 | /** |
386 | * Minimizes speckle noise in the source image using the 8 hull | 386 | * Minimizes speckle noise in the source image using the 8 hull |
387 | * algorithm. | 387 | * algorithm. |
388 | * | 388 | * |
389 | * @author Daniel M. Duley (mosfet) | 389 | * @author Daniel M. Duley (mosfet) |
390 | * @param src The QImage to process. | 390 | * @param src The QImage to process. |
391 | * @return The despeckled image. The original is not changed. | 391 | * @return The despeckled image. The original is not changed. |
392 | */ | 392 | */ |
393 | static QImage despeckle(QImage &src); | 393 | static QImage despeckle(QImage &src); |
394 | 394 | ||
395 | /** | 395 | /** |
396 | * Produces a neat little "charcoal" effect. | 396 | * Produces a neat little "charcoal" effect. |
397 | * | 397 | * |
398 | * @author Daniel M. Duley (mosfet) | 398 | * @author Daniel M. Duley (mosfet) |
399 | * @param src The QImage to process. | 399 | * @param src The QImage to process. |
400 | * @param factor The factor for detecting lines (0-99.0). | 400 | * @param factor The factor for detecting lines (0-99.0). |
401 | * @return The charcoal image. The original is not changed. | 401 | * @return The charcoal image. The original is not changed. |
402 | */ | 402 | */ |
403 | static QImage charcoal(QImage &src, double factor=50.0); | 403 | static QImage charcoal(QImage &src, double factor=50.0); |
404 | 404 | ||
405 | /** | 405 | /** |
406 | * Rotates the image by the specified amount | 406 | * Rotates the image by the specified amount |
407 | * | 407 | * |
@@ -437,128 +437,128 @@ public: | |||
437 | 437 | ||
438 | /** | 438 | /** |
439 | * Blurs an image by convolving pixel neighborhoods. | 439 | * Blurs an image by convolving pixel neighborhoods. |
440 | * | 440 | * |
441 | * @author Daniel M. Duley (mosfet) | 441 | * @author Daniel M. Duley (mosfet) |
442 | * @param src The QImage to process. | 442 | * @param src The QImage to process. |
443 | * @param factor The percent weight to give to the center pixel. | 443 | * @param factor The percent weight to give to the center pixel. |
444 | * @return The blurred image. The original is not changed. | 444 | * @return The blurred image. The original is not changed. |
445 | */ | 445 | */ |
446 | static QImage blur(QImage &src, double factor=50.0); | 446 | static QImage blur(QImage &src, double factor=50.0); |
447 | 447 | ||
448 | /** | 448 | /** |
449 | * Detects edges in an image using pixel neighborhoods and an edge | 449 | * Detects edges in an image using pixel neighborhoods and an edge |
450 | * detection mask. | 450 | * detection mask. |
451 | * | 451 | * |
452 | * @author Daniel M. Duley (mosfet) | 452 | * @author Daniel M. Duley (mosfet) |
453 | * @param src The QImage to process. | 453 | * @param src The QImage to process. |
454 | * @param factor The percent weight to give to the center pixel. | 454 | * @param factor The percent weight to give to the center pixel. |
455 | * @return The image with edges detected. The original is not changed. | 455 | * @return The image with edges detected. The original is not changed. |
456 | */ | 456 | */ |
457 | static QImage edge(QImage &src, double factor=50.0); | 457 | static QImage edge(QImage &src, double factor=50.0); |
458 | 458 | ||
459 | /** | 459 | /** |
460 | * Implodes an image by a specified percent. | 460 | * Implodes an image by a specified percent. |
461 | * | 461 | * |
462 | * @author Daniel M. Duley (mosfet) | 462 | * @author Daniel M. Duley (mosfet) |
463 | * @param src The QImage to process. | 463 | * @param src The QImage to process. |
464 | * @param factor The extent of the implosion. | 464 | * @param factor The extent of the implosion. |
465 | * @param background An RGBA value to use for the background. After the | 465 | * @param background An RGBA value to use for the background. After the |
466 | * effect some pixels may be "empty". This value is used for those pixels. | 466 | * effect some pixels may be "empty". This value is used for those pixels. |
467 | * @return The imploded image. The original is not changed. | 467 | * @return The imploded image. The original is not changed. |
468 | */ | 468 | */ |
469 | static QImage implode(QImage &src, double factor=30.0, | 469 | static QImage implode(QImage &src, double factor=30.0, |
470 | unsigned int background = 0xFFFFFFFF); | 470 | unsigned int background = 0xFFFFFFFF); |
471 | /** | 471 | /** |
472 | * Produces an oil painting effect. | 472 | * Produces an oil painting effect. |
473 | * | 473 | * |
474 | * @author Daniel M. Duley (mosfet) | 474 | * @author Daniel M. Duley (mosfet) |
475 | * @param src The QImage to process. | 475 | * @param src The QImage to process. |
476 | * @param radius The radius of the pixel neighborhood used in applying the | 476 | * @param radius The radius of the pixel neighborhood used in applying the |
477 | * effect. | 477 | * effect. |
478 | * @return The new image. The original is not changed. | 478 | * @return The new image. The original is not changed. |
479 | */ | 479 | */ |
480 | static QImage oilPaint(QImage &src, int radius=3); | 480 | static QImage oilPaint(QImage &src, int radius=3); |
481 | 481 | ||
482 | /** | 482 | /** |
483 | * Sharpens the pixels in the image using pixel neighborhoods. | 483 | * Sharpens the pixels in the image using pixel neighborhoods. |
484 | * | 484 | * |
485 | * @author Daniel M. Duley (mosfet) | 485 | * @author Daniel M. Duley (mosfet) |
486 | * @param src The QImage to process. | 486 | * @param src The QImage to process. |
487 | * @param factor The percent weight to give to the center pixel. | 487 | * @param factor The percent weight to give to the center pixel. |
488 | * @return The sharpened image. The original is not changed. | 488 | * @return The sharpened image. The original is not changed. |
489 | */ | 489 | */ |
490 | static QImage sharpen(QImage &src, double factor=30.0); | 490 | static QImage sharpen(QImage &src, double factor=30.0); |
491 | 491 | ||
492 | /** | 492 | /** |
493 | * Randomly displaces pixels. | 493 | * Randomly displaces pixels. |
494 | * | 494 | * |
495 | * @author Daniel M. Duley (mosfet) | 495 | * @author Daniel M. Duley (mosfet) |
496 | * @param src The QImage to process. | 496 | * @param src The QImage to process. |
497 | * @param amount The vicinity for choosing a random pixel to swap. | 497 | * @param amount The vicinity for choosing a random pixel to swap. |
498 | * @return The image with pixels displaced. The original is not changed. | 498 | * @return The image with pixels displaced. The original is not changed. |
499 | */ | 499 | */ |
500 | static QImage spread(QImage &src, unsigned int amount=3); | 500 | static QImage spread(QImage &src, unsigned int amount=3); |
501 | 501 | ||
502 | /** | 502 | /** |
503 | * Shades the image using a distance light source. | 503 | * Shades the image using a distance light source. |
504 | * | 504 | * |
505 | * @author Daniel M. Duley (mosfet) | 505 | * @author Daniel M. Duley (mosfet) |
506 | * @param src The QImage to process. | 506 | * @param src The QImage to process. |
507 | * @param color_shading If true do color shading, otherwise do grayscale. | 507 | * @param color_shading If true do color shading, otherwise do grayscale. |
508 | * @param azimuth Determines the light source and direction. | 508 | * @param azimuth Determines the light source and direction. |
509 | * @param elevation Determines the light source and direction. | 509 | * @param elevation Determines the light source and direction. |
510 | * @return The shaded image. The original is not changed. | 510 | * @return The shaded image. The original is not changed. |
511 | */ | 511 | */ |
512 | static QImage shade(QImage &src, bool color_shading=true, double azimuth=30.0, | 512 | static QImage shade(QImage &src, bool color_shading=true, double azimuth=30.0, |
513 | double elevation=30.0); | 513 | double elevation=30.0); |
514 | /** | 514 | /** |
515 | * Swirls the image by a specified amount | 515 | * Swirls the image by a specified amount |
516 | * | 516 | * |
517 | * @author Daniel M. Duley (mosfet) | 517 | * @author Daniel M. Duley (mosfet) |
518 | * @param src The QImage to process. | 518 | * @param src The QImage to process. |
519 | * @param degrees The tightness of the swirl. | 519 | * @param degrees The tightness of the swirl. |
520 | * @param background An RGBA value to use for the background. After the | 520 | * @param background An RGBA value to use for the background. After the |
521 | * effect some pixels may be "empty". This value is used for those pixels. | 521 | * effect some pixels may be "empty". This value is used for those pixels. |
522 | * @return The swirled image. The original is not changed. | 522 | * @return The swirled image. The original is not changed. |
523 | */ | 523 | */ |
524 | static QImage swirl(QImage &src, double degrees=50.0, unsigned int background = | 524 | static QImage swirl(QImage &src, double degrees=50.0, unsigned int background = |
525 | 0xFFFFFFFF); | 525 | 0xFFFFFFFF); |
526 | 526 | ||
527 | /** | 527 | /** |
528 | * Modifies the pixels along a sine wave. | 528 | * Modifies the pixels along a sine wave. |
529 | * | 529 | * |
530 | * @author Daniel M. Duley (mosfet) | 530 | * @author Daniel M. Duley (mosfet) |
531 | * @param src The QImage to process. | 531 | * @param src The QImage to process. |
532 | * @param amplitude The amplitude of the sine wave. | 532 | * @param amplitude The amplitude of the sine wave. |
533 | * @param wavelength The frequency of the sine wave. | 533 | * @param frequency The frequency of the sine wave. |
534 | * @return The new image. The original is not changed. | 534 | * @return The new image. The original is not changed. |
535 | */ | 535 | */ |
536 | static QImage wave(QImage &src, double amplitude=25.0, double frequency=150.0, | 536 | static QImage wave(QImage &src, double amplitude=25.0, double frequency=150.0, |
537 | unsigned int background = 0xFFFFFFFF); | 537 | unsigned int background = 0xFFFFFFFF); |
538 | 538 | ||
539 | private: | 539 | private: |
540 | 540 | ||
541 | /** | 541 | /** |
542 | * Helper function to fast calc some altered (lighten, shaded) colors | 542 | * Helper function to fast calc some altered (lighten, shaded) colors |
543 | * | 543 | * |
544 | */ | 544 | */ |
545 | static unsigned int lHash(unsigned int c); | 545 | static unsigned int lHash(unsigned int c); |
546 | static unsigned int uHash(unsigned int c); | 546 | static unsigned int uHash(unsigned int c); |
547 | 547 | ||
548 | /** | 548 | /** |
549 | * Helper function to find the nearest color to the RBG triplet | 549 | * Helper function to find the nearest color to the RBG triplet |
550 | */ | 550 | */ |
551 | static int nearestColor( int r, int g, int b, const QColor *pal, int size ); | 551 | static int nearestColor( int r, int g, int b, const QColor *pal, int size ); |
552 | 552 | ||
553 | static void hull(const int x_offset, const int y_offset, const int polarity, | 553 | static void hull(const int x_offset, const int y_offset, const int polarity, |
554 | const int width, const int height, | 554 | const int width, const int height, |
555 | unsigned int *f, unsigned int *g); | 555 | unsigned int *f, unsigned int *g); |
556 | static unsigned int generateNoise(unsigned int pixel, NoiseType type); | 556 | static unsigned int generateNoise(unsigned int pixel, NoiseType type); |
557 | static unsigned int interpolateColor(QImage *image, double x, double y, | 557 | static unsigned int interpolateColor(QImage *image, double x, double y, |
558 | unsigned int background); | 558 | unsigned int background); |
559 | }; | 559 | }; |
560 | 560 | ||
561 | } | 561 | } |
562 | } | 562 | } |
563 | 563 | ||
564 | #endif | 564 | #endif |
diff --git a/libopie2/opieui/opixmapeffect.h b/libopie2/opieui/opixmapeffect.h index b780f9f..85a1e25 100644 --- a/libopie2/opieui/opixmapeffect.h +++ b/libopie2/opieui/opixmapeffect.h | |||
@@ -59,161 +59,156 @@ public: | |||
59 | * An unbalanced gradient is a gradient where the transition from | 59 | * An unbalanced gradient is a gradient where the transition from |
60 | * color a to color b is not linear, but in this case, exponential. | 60 | * color a to color b is not linear, but in this case, exponential. |
61 | * | 61 | * |
62 | * @param pixmap The pixmap that should be written. | 62 | * @param pixmap The pixmap that should be written. |
63 | * @param ca Color a. | 63 | * @param ca Color a. |
64 | * @param cb Color b. | 64 | * @param cb Color b. |
65 | * @param type The type of gradient. | 65 | * @param type The type of gradient. |
66 | * @param xfactor The x decay length. Use a value between -200 and 200. | 66 | * @param xfactor The x decay length. Use a value between -200 and 200. |
67 | * @param yfactor The y decay length. | 67 | * @param yfactor The y decay length. |
68 | * @param ncols The number of colors. See #gradient. | 68 | * @param ncols The number of colors. See #gradient. |
69 | * @return The generated pixmap, for convencience. | 69 | * @return The generated pixmap, for convencience. |
70 | */ | 70 | */ |
71 | static OPixmap& unbalancedGradient(OPixmap& pixmap, const QColor &ca, | 71 | static OPixmap& unbalancedGradient(OPixmap& pixmap, const QColor &ca, |
72 | const QColor &cb, GradientType type, int xfactor = 100, | 72 | const QColor &cb, GradientType type, int xfactor = 100, |
73 | int yfactor = 100, int ncols=3); | 73 | int yfactor = 100, int ncols=3); |
74 | 74 | ||
75 | /** | 75 | /** |
76 | * Creates a pixmap of a given size with the given pixmap. | 76 | * Creates a pixmap of a given size with the given pixmap. |
77 | * | 77 | * |
78 | * if the | 78 | * if the |
79 | * given size is bigger than the size of the pixmap, the pixmap is | 79 | * given size is bigger than the size of the pixmap, the pixmap is |
80 | * tiled. | 80 | * tiled. |
81 | * | 81 | * |
82 | * @param pixmap This is the source pixmap | 82 | * @param pixmap This is the source pixmap |
83 | * @param size The size the new pixmap should have. | 83 | * @param size The size the new pixmap should have. |
84 | * @return The generated, tiled pixmap. | 84 | * @return The generated, tiled pixmap. |
85 | */ | 85 | */ |
86 | static OPixmap createTiled(const OPixmap& pixmap, QSize size); | 86 | static OPixmap createTiled(const OPixmap& pixmap, QSize size); |
87 | 87 | ||
88 | /** | 88 | /** |
89 | * Either brightens or dims a pixmap by a specified ratio. | 89 | * Either brightens or dims a pixmap by a specified ratio. |
90 | * | 90 | * |
91 | * @param pixmap The pixmap to process. | 91 | * @param pixmap The pixmap to process. |
92 | * @param ratio The ratio to use. Use negative value to dim. | 92 | * @param ratio The ratio to use. Use negative value to dim. |
93 | * @return Returns The @ref pixmap(), provided for convenience. | 93 | * @return Returns The @ref pixmap(), provided for convenience. |
94 | */ | 94 | */ |
95 | static OPixmap& intensity(OPixmap& pixmap, float ratio); | 95 | static OPixmap& intensity(OPixmap& pixmap, float ratio); |
96 | 96 | ||
97 | /** | 97 | /** |
98 | * Modifies the intensity of a pixmap's RGB channel component. | 98 | * Modifies the intensity of a pixmap's RGB channel component. |
99 | * | 99 | * |
100 | * @param pixmap The pixmap to process. | 100 | * @param pixmap The pixmap to process. |
101 | * @param ratio value. Use negative value to dim. | 101 | * @param ratio value. Use negative value to dim. |
102 | * @param channel Which channel(s) should be modified | 102 | * @param channel Which channel(s) should be modified |
103 | * @return Returns the @ref pixmap(), provided for convenience. | 103 | * @return Returns the @ref pixmap(), provided for convenience. |
104 | */ | 104 | */ |
105 | static OPixmap& channelIntensity(OPixmap& pixmap, float ratio, | 105 | static OPixmap& channelIntensity(OPixmap& pixmap, float ratio, |
106 | RGBComponent channel); | 106 | RGBComponent channel); |
107 | 107 | ||
108 | /** | 108 | /** |
109 | * Blends the provided pixmap into a background of the indicated color. | 109 | * Blends the provided pixmap into a background of the indicated color. |
110 | * | 110 | * |
111 | * @param pixmap The pixmap to process. | 111 | * @param pixmap The pixmap to process. |
112 | * @param initial_intensity this parameter takes values from -1 to 1: | 112 | * @param initial_intensity this parameter takes values from -1 to 1: |
113 | * @li If positive, it tells how much to fade the image in its | 113 | * @li If positive, it tells how much to fade the image in its |
114 | * less affected spot. | 114 | * less affected spot. |
115 | * @li If negative, it tells roughly indicates how much of the image | 115 | * @li If negative, it tells roughly indicates how much of the image |
116 | * remains unaffected | 116 | * remains unaffected |
117 | * @param bgnd Indicates the color of the background to blend in. | 117 | * @param bgnd Indicates the color of the background to blend in. |
118 | * @param eff Lets you choose what kind of blending you like. | 118 | * @param eff Lets you choose what kind of blending you like. |
119 | * @param anti_dir Blend in the opposite direction (makes no much sense | 119 | * @param anti_dir Blend in the opposite direction (makes no much sense |
120 | * with concentric blending effects). | 120 | * with concentric blending effects). |
121 | * @return Returns the @ref pixmap(), provided for convenience. | 121 | * @return Returns the @ref pixmap(), provided for convenience. |
122 | */ | 122 | */ |
123 | static OPixmap& blend(OPixmap& pixmap, float initial_intensity, | 123 | static OPixmap& blend(OPixmap& pixmap, float initial_intensity, |
124 | const QColor &bgnd, GradientType eff, | 124 | const QColor &bgnd, GradientType eff, |
125 | bool anti_dir=false, int ncols=3); | 125 | bool anti_dir=false, int ncols=3); |
126 | 126 | ||
127 | /** | 127 | /** |
128 | * Builds a hash on any given pixmap. | 128 | * Builds a hash on any given pixmap. |
129 | * | 129 | * |
130 | * @param pixmap The pixmap to process. | 130 | * @param pixmap The pixmap to process. |
131 | * @param lite The hash faces the indicated lighting (cardinal poles) | 131 | * @param lite The hash faces the indicated lighting (cardinal poles) |
132 | * @param spacing How many unmodified pixels inbetween hashes. | 132 | * @param spacing How many unmodified pixels inbetween hashes. |
133 | * @return Returns The @ref pixmap(), provided for convenience. | 133 | * @return Returns The @ref pixmap(), provided for convenience. |
134 | */ | 134 | */ |
135 | static OPixmap& hash(OPixmap& pixmap, Lighting lite=NorthLite, | 135 | static OPixmap& hash(OPixmap& pixmap, Lighting lite=NorthLite, |
136 | unsigned int spacing=0, int ncols=3); | 136 | unsigned int spacing=0, int ncols=3); |
137 | 137 | ||
138 | /** | 138 | /** |
139 | * Creates a pattern from a pixmap. | 139 | * Creates a pattern from a pixmap. |
140 | * | 140 | * |
141 | * The given pixmap is "flattened" | 141 | * The given pixmap is "flattened" |
142 | * between color a to color b. | 142 | * between color a to color b. |
143 | * | 143 | * |
144 | * @param pixmap The pixmap to process. | 144 | * @param pixmap The pixmap to process. |
145 | * @param ca Color a. | 145 | * @param ca Color a. |
146 | * @param cb Color b. | 146 | * @param cb Color b. |
147 | * @param ncols The number of colors to use. The image will be | 147 | * @param ncols The number of colors to use. The image will be |
148 | * dithered to this depth. Pass zero to prevent dithering. | 148 | * dithered to this depth. Pass zero to prevent dithering. |
149 | * @return The @ref pixmap(), provided for convenience. | 149 | * @return The @ref pixmap(), provided for convenience. |
150 | */ | 150 | */ |
151 | static OPixmap pattern(const OPixmap& pixmap, QSize size, | 151 | static OPixmap pattern(const OPixmap& pixmap, QSize size, |
152 | const QColor &ca, const QColor &cb, int ncols=8); | 152 | const QColor &ca, const QColor &cb, int ncols=8); |
153 | 153 | ||
154 | /** | 154 | /** |
155 | * Recolors a pixmap. | 155 | * Fades a pixmap to a certain color. |
156 | * | ||
157 | * The most dark color will become color a, | ||
158 | * the most bright one color b, and in between. | ||
159 | * | 156 | * |
160 | * @param pixmap The pixmap to process. | 157 | * @param pixmap The pixmap to process. |
161 | * @param ca Color a. | 158 | * @param val The strength of the effect. 0 <= val <= 1. |
162 | * @param cb Color b. | 159 | * @param color The color to blend to. |
163 | * @param ncols The number of colors to use. Pass zero to prevent | ||
164 | * dithering. | ||
165 | * @return Returns the @ref pixmap(), provided for convenience. | 160 | * @return Returns the @ref pixmap(), provided for convenience. |
166 | */ | 161 | */ |
167 | static OPixmap& fade(OPixmap& pixmap, double val, const QColor &color); | 162 | static OPixmap& fade(OPixmap& pixmap, double val, const QColor &color); |
168 | 163 | ||
169 | /** | 164 | /** |
170 | * Converts a pixmap to grayscale. | 165 | * Converts a pixmap to grayscale. |
171 | * | 166 | * |
172 | * @param pixmap The pixmap to process. | 167 | * @param pixmap The pixmap to process. |
173 | * @param fast Set to @p true in order to use a faster but non-photographic | 168 | * @param fast Set to @p true in order to use a faster but non-photographic |
174 | * quality algorithm. Appropriate for things such as toolbar icons. | 169 | * quality algorithm. Appropriate for things such as toolbar icons. |
175 | * @return Returns the @ref pixmap(), provided for convenience. | 170 | * @return Returns the @ref pixmap(), provided for convenience. |
176 | */ | 171 | */ |
177 | static OPixmap& toGray(OPixmap& pixmap, bool fast=false); | 172 | static OPixmap& toGray(OPixmap& pixmap, bool fast=false); |
178 | 173 | ||
179 | /** | 174 | /** |
180 | * Desaturates a pixmap. | 175 | * Desaturates a pixmap. |
181 | * | 176 | * |
182 | * @param pixmap The pixmap to process. | 177 | * @param pixmap The pixmap to process. |
183 | * @param desat A value between 0 and 1 setting the degree of desaturation | 178 | * @param desat A value between 0 and 1 setting the degree of desaturation |
184 | * @return Returns The @ref pixmap(), provided for convenience. | 179 | * @return Returns The @ref pixmap(), provided for convenience. |
185 | */ | 180 | */ |
186 | static OPixmap& desaturate(OPixmap& pixmap, float desat = 0.3); | 181 | static OPixmap& desaturate(OPixmap& pixmap, float desat = 0.3); |
187 | 182 | ||
188 | /** | 183 | /** |
189 | * Modifies the contrast of a pixmap. | 184 | * Modifies the contrast of a pixmap. |
190 | * | 185 | * |
191 | * @param pixmap The pixmap to process. | 186 | * @param pixmap The pixmap to process. |
192 | * @param c A contrast value between -255 and 255. | 187 | * @param c A contrast value between -255 and 255. |
193 | * @return Returns the @ref pixmap(), provided for convenience. | 188 | * @return Returns the @ref pixmap(), provided for convenience. |
194 | */ | 189 | */ |
195 | static OPixmap& contrast(OPixmap& pixmap, int c); | 190 | static OPixmap& contrast(OPixmap& pixmap, int c); |
196 | 191 | ||
197 | /** | 192 | /** |
198 | * Dithers a pixmap using Floyd-Steinberg dithering for low-color | 193 | * Dithers a pixmap using Floyd-Steinberg dithering for low-color |
199 | * situations. | 194 | * situations. |
200 | * | 195 | * |
201 | * @param pixmap The pixmap to process. | 196 | * @param pixmap The pixmap to process. |
202 | * @param palette The color palette to use. | 197 | * @param palette The color palette to use. |
203 | * @param size The size of the palette. | 198 | * @param size The size of the palette. |
204 | * @return Returns the @ref pixmap(), provided for convenience. | 199 | * @return Returns the @ref pixmap(), provided for convenience. |
205 | */ | 200 | */ |
206 | static OPixmap& dither(OPixmap &pixmap, const QColor *palette, int size); | 201 | static OPixmap& dither(OPixmap &pixmap, const QColor *palette, int size); |
207 | 202 | ||
208 | /** | 203 | /** |
209 | * Calculate a 'selected' pixmap, for instance a selected icon | 204 | * Calculate a 'selected' pixmap, for instance a selected icon |
210 | * on the desktop. | 205 | * on the desktop. |
211 | * @param pixmap the pixmap to select | 206 | * @param pixmap the pixmap to select |
212 | * @param col the selected color, usually from QColorGroup::highlight(). | 207 | * @param col the selected color, usually from QColorGroup::highlight(). |
213 | */ | 208 | */ |
214 | static OPixmap selectedPixmap( const OPixmap &pixmap, const QColor &col ); | 209 | static OPixmap selectedPixmap( const OPixmap &pixmap, const QColor &col ); |
215 | }; | 210 | }; |
216 | } | 211 | } |
217 | } | 212 | } |
218 | 213 | ||
219 | #endif | 214 | #endif |