OmaPhoto 1.0.0: the Linux port of Compositor
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>
This commit is contained in:
commit
c864304695
564 files changed
+100804
No files matched your search
@@ -0,0 +1,47 @@
|
||||
#pragma once
|
||||
#include "IO/ProjectStore.h"
|
||||
#include <QByteArray>
|
||||
#include <QImage>
|
||||
#include <functional>
|
||||
#include <stdexcept>
|
||||
|
||||
class ExportError : public std::runtime_error {
|
||||
public:
|
||||
enum class Kind { tooLarge, render, encode };
|
||||
explicit ExportError(Kind kind);
|
||||
const Kind kind;
|
||||
};
|
||||
|
||||
// Swift's CancellationError: a newer request superseded this one.
|
||||
class CancellationError : public std::exception {};
|
||||
|
||||
struct ExportRaster {
|
||||
QImage image;
|
||||
// Pixels per inch.
|
||||
double resolution = 72;
|
||||
};
|
||||
|
||||
struct JPEGOptions {
|
||||
double quality = 0.85;
|
||||
// The matte behind transparent pixels.
|
||||
double red = 1;
|
||||
double green = 1;
|
||||
double blue = 1;
|
||||
bool operator==(const JPEGOptions &) const = default;
|
||||
};
|
||||
|
||||
struct JPEGResult {
|
||||
QByteArray data;
|
||||
// Decoded from `data`, at most 1000 pixels a side.
|
||||
QImage preview;
|
||||
};
|
||||
|
||||
namespace ImageExporter {
|
||||
ExportRaster render(const ProjectSnapshot &snapshot);
|
||||
QByteArray pngData(const ProjectSnapshot &snapshot);
|
||||
// Stops at Swift's three points once `cancelled` says so.
|
||||
JPEGResult jpeg(const ExportRaster &raster, const JPEGOptions &options, const std::function<bool()> &cancelled = {});
|
||||
void exportPNG(const ProjectSnapshot &snapshot, const QString &path);
|
||||
// Replaces the file in one step, or not at all.
|
||||
void write(const QByteArray &data, const QString &path);
|
||||
}
|
||||
Reference in new issue
Block a user