ksharindam / photoquick

Light-weight image viewer with crop,resize,collage, photogrid and filters
GNU General Public License v3.0
17 stars 2 forks source link

qimageblitz #11

Open zvezdochiot opened 2 years ago

zvezdochiot commented 2 years ago

Hi @ksharindam .

See https://sourceforge.net/projects/qimageblitz/

cat qimageblitz.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};
    static bool invert(QImage &img, QImage::InvertMode mode =
                       QImage::InvertRgb);
    static bool grayscale(QImage &img, bool reduceDepth=false);
     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);
    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);

    static QImage convolve(QImage &img, int matrix_size, float *matrix);
    static QImage convolveInteger(QImage &img, int matrix_size, int *matrix,
                                  int divisor=0);
    static QImage blur(QImage &img, int radius=3);
    static QImage gaussianBlur(QImage &img, float radius=0.0, float sigma=1.0);
    static QImage edge(QImage &img);
    static QImage convolveEdge(QImage &img, float radius=0.0,
                               EffectQuality quality=High);
    static QImage gaussianSharpen(QImage &img, float radius=0.0, float sigma=1.0,
                                  EffectQuality quality=High);
    static QImage sharpen(QImage &img, int radius=3);
    static QImage emboss(QImage &img, float radius=0.0, float sigma=1.0,
                         EffectQuality quality=High);
    static QImage antialias(QImage &img);
    static QImage& despeckle(QImage &img);
    static QImage& contrast(QImage &img, bool sharpen, int weight=3);
    static bool equalize(QImage &img);
    static bool normalize(QImage &img);
    static QImage& intensity(QImage &img, float percent);
    static QImage& channelIntensity(QImage &img, float percent,
                                    RGBChannel channel);
    static QImage& desaturate(QImage &img, float desat = 0.5);
    static QImage& fade(QImage &img, float val, const QColor &color);
    static QImage& flatten(QImage &img, const QColor &ca, const QColor &cb);
    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));
    static QImage swirl(QImage &img, float degrees=60.0);
    static QImage implode(QImage &img, float amount=0.3);
    static QImage wave(QImage &img, float amplitude=25.0, float frequency=150.0,
                       unsigned int background=0);
    static QImage oilPaint(QImage &img, float radius=0.0,
                           EffectQuality quality=High);
    static QImage charcoal(QImage &img);
    static QImage gradient(const QSize &size, const QColor &ca,
                           const QColor &cb, GradientType type);
    static QImage grayGradient(const QSize &size, unsigned char ca,
                               unsigned char cb, GradientType type);
    static QImage unbalancedGradient(const QSize &size, const QColor &ca,
                                     const QColor &cb, GradientType type,
                                     int xfactor=100, int yfactor=100);
    static QImage grayUnbalancedGradient(const QSize &size, unsigned char ca,
                                         unsigned char cb, GradientType type,
                                         int xfactor=100, int yfactor=100);
    static QImage& modulate(QImage &img, QImage &modImg, bool reverse,
                            ModulationType type, int factor,
                            RGBChannel channel);
};
ksharindam commented 2 years ago

What are you suggesting?

zvezdochiot commented 2 years ago

Hi @ksharindam.

I would like a separate library with the QImageFilter class (then filters can be used in plugins), but you can simply add to the collection of filters from other products that use QImage.

ksharindam commented 2 years ago

Please be little elaborative when you next time post a issue or question. The title must be one line description instead of a single word. So that, people understands what the issue is about.