This file is indexed.

/usr/include/qimageblitz/qimageblitz.h is in libqimageblitz-dev 1:0.0.6-4build1.

This file is owned by root:root, with mode 0o644.

The actual contents of the file can be viewed below.

  1
  2
  3
  4
  5
  6
  7
  8
  9
 10
 11
 12
 13
 14
 15
 16
 17
 18
 19
 20
 21
 22
 23
 24
 25
 26
 27
 28
 29
 30
 31
 32
 33
 34
 35
 36
 37
 38
 39
 40
 41
 42
 43
 44
 45
 46
 47
 48
 49
 50
 51
 52
 53
 54
 55
 56
 57
 58
 59
 60
 61
 62
 63
 64
 65
 66
 67
 68
 69
 70
 71
 72
 73
 74
 75
 76
 77
 78
 79
 80
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
#ifndef __BLITZ_H
#define __BLITZ_H

/* 
 Copyright (C) 1998, 1999, 2001, 2002, 2004, 2005, 2007
      Daniel M. Duley <daniel.duley@verizon.net>
 (C) 2004 Zack Rusin <zack@kde.org>
 (C) 2000 Josef Weidendorfer <weidendo@in.tum.de>
 (C) 1999 Geert Jansen <g.t.jansen@stud.tue.nl>
 (C) 1998, 1999 Christian Tibirna <ctibirna@total.net>
 (C) 1998, 1999 Dirk Mueller <mueller@kde.org>

Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions
are met:

1. Redistributions of source code must retain the above copyright
   notice, this list of conditions and the following disclaimer.
2. Redistributions in binary form must reproduce the above copyright
   notice, this list of conditions and the following disclaimer in the
   documentation and/or other materials provided with the distribution.

THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.

*/

#include <QtGui/QImage>
#include "qimageblitz_export.h"

class QIMAGEBLITZ_EXPORT Blitz
{
public:
    enum GradientType {VerticalGradient=0, HorizontalGradient, DiagonalGradient,
        CrossDiagonalGradient, PyramidGradient, RectangleGradient,
        PipeCrossGradient, EllipticGradient};

    enum RGBChannel{Grayscale=0, Brightness, Red, Green, Blue, Alpha, All};
    enum EffectQuality{Low=0, High};

    enum ScaleFilterType{UndefinedFilter=0, PointFilter, BoxFilter,
        TriangleFilter, HermiteFilter, HanningFilter, HammingFilter,
        BlackmanFilter, GaussianFilter, QuadraticFilter, CubicFilter,
        CatromFilter, MitchellFilter, LanczosFilter, BesselFilter,
        SincFilter};

    enum ModulationType{Intensity=0, Saturation, HueShift, Contrast};

    /**
     * Inverts an image. If the machine supports MMX this can do two pixels
     * at a time, otherwise it's the same as QImage::invertPixels().
     *
     * @param img The image to invert.
     * @param mode If to invert the alpha channel or not.
     * @author Daniel M. Duley (mosfet)
     */
    static bool invert(QImage &img, QImage::InvertMode mode =
                       QImage::InvertRgb);
    /**
     * Grayscales an image.
     *
     * @param img The image to grayscale.
     * @param reduceDepth If true the result will be an 8bit palette image.
     * @author Daniel M. Duley (mosfet)
     */
    static bool grayscale(QImage &img, bool reduceDepth=false);
    /**
     * A fast smoothscale method with MMX support.
     *
     * @param img The image to smoothscale.
     * @param sz The size to scale to.
     * @param aspectRatio What aspect ratio to use, if any.
     * @return The processed image. The original is not changed.
     * @author Daniel M. Duley (mosfet)
     */
    static QImage smoothScale(QImage &img, const QSize &sz,
                              Qt::AspectRatioMode aspectRatio =
                              Qt::IgnoreAspectRatio);
    static QImage smoothScale(QImage &img, int dw, int dh,
                              Qt::AspectRatioMode aspectRatio =
                              Qt::IgnoreAspectRatio);
    /**
     * Smoothscales an image using a high-quality filter.
     *
     * @param img The image to smoothscale.
     * @param sz The size to scale to.
     * @param blur A blur factor. Values greater than 1.0 blur while values
     * less than 1.0 sharpen.
     * @param filter The filter type.
     * @param aspectRatio What aspect ratio to use, if any.
     * @return The processed image. The original is not changed.
     * @author Daniel M. Duley (mosfet)
     */
    static QImage smoothScaleFilter(QImage &img, const QSize &sz,
                                    float blur=1.0,
                                    ScaleFilterType filter=BlackmanFilter,
                                    Qt::AspectRatioMode aspectRatio =
                                    Qt::IgnoreAspectRatio);
    static QImage smoothScaleFilter(QImage &img, int dwX, int dwY,
                                    float blur=1.0,
                                    ScaleFilterType filter=BlackmanFilter,
                                    Qt::AspectRatioMode aspectRatio =
                                    Qt::IgnoreAspectRatio);

    /**
     * Convolves an image using a convolution matrix, (kernel), and provides
     * the basis for many different image filters and effects.
     *
     * @param img The image to process.
     * @param matrix_size The size of one side of the convolution matrix, ie:
     * a 3x3 matrix would be 3, not 9.
     * @param matrix The convolution matrix.
     * @return The processed image. The original is not changed.
     * @author Daniel M. Duley (mosfet)
     */
    static QImage convolve(QImage &img, int matrix_size, float *matrix);
    /**
     * Same as above but with a faster integer matrix.
     */
    static QImage convolveInteger(QImage &img, int matrix_size, int *matrix,
                                  int divisor=0);
    /**
     * A fast blur algorithm.
     *
     * @param img The image to process.
     * @param radius The radius of the blur. Larger values blur more.
     * @return The processed image. The original is not changed.
     * @author Daniel M. Duley (mosfet)
     */
    static QImage blur(QImage &img, int radius=3);
    /**
     * A high quality gaussian/convolve-based blur.
     *
     * @param img The image to process.
     * @param radius The radius of the gaussian, not counting the center
     * pixel. Use 0, (recommended), and an appropriate one will be used.
     * @param sigma The standard deviation of the gaussian in pixels. Use
     * 1.0, (recommended), for the default value.
     * @return The processed image. The original is not changed.
     * @author Daniel M. Duley (mosfet)
     */
    static QImage gaussianBlur(QImage &img, float radius=0.0, float sigma=1.0);
    /**
     * Detects edges in an image using the Sobel algorithm.
     *
     * @param img The image to process.
     * @return The processed image. The original is not changed.
     * @author Daniel M. Duley (mosfet)
     */
    static QImage edge(QImage &img);
    /**
     * Detects edges in an image using a convolution matrix.
     *
     * @param img The image to process.
     * @param radius The radius of the gaussian, not counting the center
     * pixel. Use 0, (recommended), and an appropriate one will be used.
     * @param quality Determines if to use a small or large convolution matrix.
     * @return The processed image. The original is not changed.
     * @author Daniel M. Duley (mosfet)
     */
    static QImage convolveEdge(QImage &img, float radius=0.0,
                               EffectQuality quality=High);
    /**
     * Sharpens an image.
     *
     * @param img The image to process.
     * @param radius The radius of the gaussian, not counting the center
     * pixel. Use 0, (recommended), and an appropriate one will be used.
     * @param sigma The standard deviation of the gaussian in pixels. Use
     * 1.0, (recommended), for the default value.
     * @param quality Determines if to use a small or large convolution matrix.
     * @return The processed image. The original is not changed.
     * @author Daniel M. Duley (mosfet)
     */
    static QImage gaussianSharpen(QImage &img, float radius=0.0, float sigma=1.0,
                                  EffectQuality quality=High);
    /**
     * A cheap, fast sharpen.
     *
     * @param radius The radius. Larger values sharpen more.
     * @return The processed image. The original is not changed.
     * @author Daniel M. Duley (mosfet)
     */
    static QImage sharpen(QImage &img, int radius=3);
    /**
     * Embosses an image.
     *
     * @param img The image to process.
     * @param radius The radius of the gaussian, not counting the center
     * pixel. Use 0, (recommended), and an appropriate one will be used.
     * @param sigma The standard deviation of the gaussian in pixels. Use
     * 1.0, (recommended), for the default value.
     * @param quality Determines if to use a small or large convolution matrix.
     * @return The processed image. The original is not changed.
     * @author Daniel M. Duley (mosfet)
     */
    static QImage emboss(QImage &img, float radius=0.0, float sigma=1.0,
                         EffectQuality quality=High);
    /**
     * Antialiases an image.
     *
     * @param img The image to process.
     * @return The processed image. The original is not changed.
     * @author Daniel M. Duley (mosfet)
     */
    static QImage antialias(QImage &img);
    /**
     * Minimizes speckle noise in the source image using the 8 hull
     * algorithm.
     *
     * @param img The image to process.
     * @return A reference to the image for convenience.
     * @author Daniel M. Duley (mosfet)
     */
    static QImage& despeckle(QImage &img);
    /**
     * High quality, fast HSV contrast.
     *
     * @param img The image to process.
     * @param sharpen If true sharpness is increase, (spiffed). Otherwise
     * it is decreased, (dulled).
     * @param weight How much to spiff or dull.
     * @return A reference to the image for convenience.
     * @author Daniel M. Duley (mosfet)
     */
    static QImage& contrast(QImage &img, bool sharpen, int weight=3);
    /**
     * Performs histogram equalization.
     *
     * @param img The image to equalize.
     * @author Daniel M. Duley (mosfet)
     */
    static bool equalize(QImage &img);
    /**
     * Normalizes the pixel values to span the full range of color values.
     * This is a contrast enhancement technique.
     *
     * @param img The image to normalize
     * @author Daniel M. Duley (mosfet)
     */
    static bool normalize(QImage &img);
    /**
     * Either brighten or dim the image by a specified percent. For example,
     * 0.50 will modify the colors by 50%.
     *
     * @param img The image to process.
     * @param percent The percent value. Use a negative value to dim.
     * @return A reference to the image for convenience.
     * @author Daniel M. Duley (mosfet)
     * @author Benjamin Roe (ben@benroe.com)
     */
    static QImage& intensity(QImage &img, float percent);
    /**
     * Modifies the intensity of an image's RGB channel.
     *
     * @param img The image to process.
     * @param percent Percent value. Use a negative value to dim.
     * @param channel Which channel(s) should be modified. Only Red, Green,
     * and Blue are valid.
     * @return A reference to the image for convenience.
     * @author Daniel M. Duley (mosfet)
     */
    static QImage& channelIntensity(QImage &img, float percent,
                                    RGBChannel channel);
    /**
     * Desaturate an image evenly.
     *
     * @param img The image to process.
     * @param desat A value between 0 and 1 setting the degree of desaturation
     * @return A reference to the image for convenience.
     * @author Daniel M. Duley (mosfet)
     */
    static QImage& desaturate(QImage &img, float desat = 0.5);
    /**
     * Fade an image to a certain background color. The number of colors will
     * not be changed.
     *
     * @param img   The image to process.
     * @param val   The strength of the effect. 0 <= val <= 1.
     * @param color The background color.
     * @return      A reference to the image for convenience.
     */
    static QImage& fade(QImage &img, float val, const QColor &color);

    /**
     * This recolors a pixmap. The most dark color will become color a,
     * the most bright one color b, and in between.
     *
     * @param img The image to process.
     * @param ca Color a
     * @param cb Color b
     */
    static QImage& flatten(QImage &img, const QColor &ca, const QColor &cb);
    /**
     * Thresholds an image based on a given channel and threshold value.
     *
     * @param img The image to process.
     * @param thresholdValue The value that separates "on" colors from "off"
     * ones.
     * @param channel The channel to use when thresholding.
     * @param aboveColor The color to use for values at or above the threshold.
     * @param belowColor The color to use for values below the threshold.
     * @return The processed image. The original is not changed.
     * @author Daniel M. Duley (mosfet)
     */
    static QImage threshold(QImage &img, unsigned char thresholdValue=127,
                            RGBChannel channel=Grayscale,
                            unsigned int aboveColor=qRgb(255, 255, 255),
                            unsigned int belowColor=qRgb(0, 0, 0));
    /**
     * Swirls the image by a specified amount
     *
     * @param img The image to process.
     * @param degrees The tightness of the swirl.
     * @return The processed image. The original is not changed.
     * @author Daniel M. Duley (mosfet)
     */
    static QImage swirl(QImage &img, float degrees=60.0);
    /**
     * Implodes an image by a specified percent.
     *
     * @param img The QImage to process.
     * @param amount The extent of the implosion.
     * @return The processed image. The original is not changed.
     * @author Daniel M. Duley (mosfet)
     */
    static QImage implode(QImage &img, float amount=0.3);
    /**
     * Modifies the pixels along a sine wave.
     *
     * @param img        The image to process.
     * @param amplitude  The amplitude of the sine wave.
     * @param frequency  The frequency of the sine wave.
     * @param background An RGBA value to use for the background. After the
     * effect some pixels may be "empty". This value is used for those pixels.
     * @return The processed image. The original is not changed.
     * @author Daniel M. Duley (mosfet)
     */
    static QImage wave(QImage &img, float amplitude=25.0, float frequency=150.0,
                       unsigned int background=0);
    /**
     * Produces an oil painting effect.
     *
     * @param img The image to process.
     * @param radius The radius of the gaussian, not counting the center
     * pixel. Use 0, (recommended), and an appropriate one will be used.
     * @param quality Determines if to use a small or large convolution matrix.
     * @return The processed image. The original is not changed.
     * @author Daniel M. Duley (mosfet)
     */
    static QImage oilPaint(QImage &img, float radius=0.0,
                           EffectQuality quality=High);
    /**
     * Produces a "charcoal" image effect.
     *
     * @param img The image to process.
     * @return The processed image. The original is not changed.
     * @author Daniel M. Duley (mosfet)
     */
    static QImage charcoal(QImage &img);
    /**
     * Create a gradient from color a to color b of the specified type.
     *
     * @param size The desired size of the gradient.
     * @param ca Color a
     * @param cb Color b
     * @param type The type of gradient.
     * @return The gradient.
     */
    static QImage gradient(const QSize &size, const QColor &ca,
                           const QColor &cb, GradientType type);
    /**
     * Creates an 8bit grayscale gradient suitable for use as an alpha channel
     * using QImage::setAlphaChannel().
     *
     * @param size The desired size of the gradient.
     * @param ca The grayscale start value.
     * @param cb The grayscale end value.
     * @param type The type of gradient.
     * @return The gradient.
     */
    static QImage grayGradient(const QSize &size, unsigned char ca,
                               unsigned char cb, GradientType type);
    /**
     * Create an unbalanced gradient. An unbalanced gradient is a gradient
     * where the transition from color a to color b is not linear, but in this
     * case exponential.
     *
     * @param size The desired size of the gradient.
     * @param ca Color a
     * @param cb Color b
     * @param type The type of gradient.
     * @param xfactor The x decay length. Use a value between -200 and 200.
     * @param yfactor The y decay length.
     * @return The gradient.
     */
    static QImage unbalancedGradient(const QSize &size, const QColor &ca,
                                     const QColor &cb, GradientType type,
                                     int xfactor=100, int yfactor=100);
    /**
     * Creates an 8bit grayscale gradient suitable for use as an alpha channel
     * using QImage::setAlphaChannel().
     *
     * @param size The desired size of the gradient.
     * @param type The type of gradient.
     * @param ca The grayscale start value.
     * @param cb The grayscale end value.
     * @param xfactor The x decay length. Use a value between -200 and 200.
     * @param yfactor The y decay length.
     * @return The gradient.
     */
    static QImage grayUnbalancedGradient(const QSize &size, unsigned char ca,
                                         unsigned char cb, GradientType type,
                                         int xfactor=100, int yfactor=100);
    /**
     * Modulate the image with a color channel of another image.
     *
     * @param img The QImage to modulate and result.
     * @param modImg The QImage to use for modulation.
     * @param reverse Invert the meaning of image/modImage; result is image!
     * @param type The modulation Type to use.
     * @param factor The modulation amplitude; with 0 no effect [-200;200].
     * @param channel The RBG channel of image2 to use for modulation.
     * @return Returns the image(), provided for convenience.
     */
    static QImage& modulate(QImage &img, QImage &modImg, bool reverse,
                            ModulationType type, int factor,
                            RGBChannel channel);
};

#endif