Skip to content

armgit / krita

Public Imported from GitHub
0

Krita is a free and open source cross-platform application that offers an end-to-end solution for creating digital art files from scratch built on the KDE and Qt frameworks.

C++
1.6 KB
Raw Blame
/*
 * SPDX-FileCopyrightText: 2017 Boudewijn Rempt <[email protected]>
 * SPDX-FileCopyrightText: 2020-2021 L. E. Segovia <[email protected]>
 *
 * SPDX-License-Identifier: LGPL-2.0-or-later
 */

#ifndef GMIC_H
#define GMIC_H

#include <QString>

/**
 * A sham header to make it easier to handle gmic types without
 * needing gmic itself.
 */

enum class OutputMode { InPlace, NewLayers, NewActiveLayers, NewImage, Unspecified = 100 };

// this enum is also index in LAYER_MODE_STRINGS list
enum class InputLayerMode {
    NoInput,
    Active,
    All,
    ActiveAndBelow,
    ActiveAndAbove,
    AllVisible,
    AllInvisible,
    AllVisiblesDesc_DEPRECATED, /* Removed since 2.8.2 */
    AllInvisiblesDesc_DEPRECATED, /* Removed since 2.8.2 */
    AllDesc_DEPRECATED, /* Removed since 2.8.2 */
    Unspecified = 100
};

template<typename T>
struct gmic_image {
    unsigned int _width{0}; // Number of image columns (dimension along the X-axis).
    unsigned int _height{0}; // Number of image lines (dimension along the Y-axis)
    unsigned int _depth{1}; // Number of image slices (dimension along the Z-axis).
    unsigned int _spectrum{3}; // Number of image channels (dimension along the C-axis).
    bool _is_shared{false}; // Tells if the data buffer is shared by another structure.
    T *_data{nullptr}; // Pointer to the first pixel value.
    QString name{}; // Layer name

    // Destructor.
    ~gmic_image()
    {
        if (!_is_shared)
            delete[] _data;
    }

    void assign(unsigned int w, unsigned int h, unsigned int d, unsigned int s)
    {
        _width = w;
        _height = h;
        _depth = d;
        _spectrum = s;
    }
};

#endif // GMIC_H