OmaPhoto 1.0.0: the Linux port of Compositor
Release / deb (push) Canceled after 0s
Release / rpm (push) Canceled after 0s
Release / arch (push) Canceled after 0s
Release / publish (push) Canceled after 0s

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:
雷电芽衣andClaude committed 2026-09-26 00:44:52 -04:00
commit c864304695
564 files changed
+100804

No files matched your search

+49
View File
@@ -0,0 +1,49 @@
#pragma once
#include "Document/LayerAdjustment.h"
#include "Document/LayerAppearance.h"
#include <QHash>
#include <QImage>
#include <QPainter>
#include <QSet>
#include <QUuid>
#include <functional>
#include <optional>
#include <vector>
// Per-render dependency cache: a layer shows through its source's alpha.
class LiveMaskRenderer {
public:
static constexpr qint64 pixelBudget = 100'000'000;
using Source = std::function<std::optional<QUuid>(QUuid)>;
// Draws a layer through `clip`: device-sized coverage, null for none.
using DrawOwn = std::function<void(QUuid, QPainter &, const QImage &clip)>;
LiveMaskRenderer(Source source, DrawOwn drawOwn, qint64 pixelBudget = LiveMaskRenderer::pixelBudget);
// Clipping stacks share the base's alpha instead of repainting it.
void prepareStacks(const std::vector<QUuid> &ids, const std::function<std::optional<QUuid>(QUuid)> &parent,
const std::function<LayerBlendMode(QUuid)> &blend);
void drawComposite(QUuid id, QPainter &context, const QImage &clip = QImage());
void draw(QUuid id, QPainter &context, const QImage &clip = QImage());
// An adjustment layer's settings, opacity and own mask as coverage.
std::function<std::optional<LayerAdjustment>(QUuid)> adjustment = [](QUuid) { return std::optional<LayerAdjustment>(); };
std::function<double(QUuid)> adjustmentOpacity = [](QUuid) { return 1.0; };
std::function<void(QUuid, const QPainter &, QImage &coverage)> adjustmentClip = [](QUuid, const QPainter &, QImage &) {};
private:
// The pixels beneath, adjusted and mixed back through coverage.
void adjust(QUuid id, QPainter &context, const QImage &clip);
// A layer's alpha through its own source; nil on failure.
std::optional<QImage> coverage(QUuid id, const QPainter &context);
bool fits(const QPainter &context) const;
const Source m_source;
const DrawOwn m_drawOwn;
const qint64 m_pixelBudget;
QHash<QUuid, QImage> m_cache;
QSet<QUuid> m_visiting;
QHash<QUuid, std::vector<QUuid>> m_stacks;
QSet<QUuid> m_stacked;
QHash<QUuid, LayerBlendMode> m_stackModes;
// Every prepared layer's mode, as Swift's `blendMode`.
QHash<QUuid, LayerBlendMode> m_modes;
};