A layered image editor for Linux and Omarchy, ported from Compositor (github.com/robbietilton/Compositor), whose Swift source is its specification. It reads and writes Compositor's .comp projects. Packages for Ubuntu, Fedora and Arch come from the release workflow; scripts/install/ holds one install script per distribution family, and flake.nix serves NixOS. Co-Authored-By: Claude <noreply@anthropic.com>
46 lines
1.1 KiB
C++
46 lines
1.1 KiB
C++
#pragma once
|
|
#include <QPointF>
|
|
#include <QString>
|
|
#include <QtGlobal>
|
|
#include <optional>
|
|
|
|
enum class CanvasUnit { pixels, percent, inches, centimeters };
|
|
// The name users see.
|
|
QString rawValue(CanvasUnit unit);
|
|
|
|
// What the canvas size sheet edits, in final pixels.
|
|
struct CanvasSizeDraft {
|
|
CanvasSizeDraft(qint64 width, qint64 height, double resolution);
|
|
|
|
qint64 originalWidth;
|
|
qint64 originalHeight;
|
|
double resolution;
|
|
double width;
|
|
double height;
|
|
bool relative = false;
|
|
bool locked = false;
|
|
CanvasUnit unit = CanvasUnit::pixels;
|
|
|
|
bool valid() const;
|
|
double displayed(bool widthAxis) const;
|
|
void set(double value, bool widthAxis);
|
|
};
|
|
|
|
struct CanvasExtensionColor {
|
|
double red;
|
|
double green;
|
|
double blue;
|
|
};
|
|
|
|
struct CanvasSizeOptions {
|
|
qint64 width;
|
|
qint64 height;
|
|
// Row-major, top-left through bottom-right.
|
|
qint64 anchor = 4;
|
|
std::optional<CanvasExtensionColor> fill = std::nullopt;
|
|
// Crop supplies its own translation of the content.
|
|
std::optional<QPointF> contentOffset = std::nullopt;
|
|
|
|
QPointF offset(qint64 fromWidth, qint64 oldHeight) const;
|
|
};
|