paintplus: vendor the app source and rename from EditmaskwithAI
Bring the full EditmaskwithAI application into the repo under paintplus/ (429 files) so the service is self-contained — the installer copies the vendored source to ~/docker/paintplus/src instead of cloning at runtime. Rename to PaintPlus (service + branding; app logic untouched): - services/editmaskwithai.sh -> services/paintplus.sh (register_service paintplus, install_paintplus, ~/docker/paintplus, Caddy paintplus:8000, Authelia option preserved) - container names -> paintplus across docker-compose*.yml; dev network -> paintplus-network - browser <title> -> "PaintPlus - AI Image Editor"; README heading -> PaintPlus with upstream provenance note - README utilities table: editmaskwithai -> paintplus Backend/frontend code (help strings referencing the old container name, the ai_photo_edit.db filename) is intentionally left as-is to avoid touching application logic. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01Nb2vJ8W7bHKx1JXVvpCraH
This commit is contained in:
@@ -0,0 +1,59 @@
|
||||
import app from './../../app.js';
|
||||
import config from './../../config.js';
|
||||
import alertify from './../../../../node_modules/alertifyjs/build/alertify.min.js';
|
||||
import Base_layers_class from './../../core/base-layers.js';
|
||||
|
||||
class Layer_merge_class {
|
||||
|
||||
constructor() {
|
||||
this.Base_layers = new Base_layers_class();
|
||||
}
|
||||
|
||||
merge() {
|
||||
if (this.Base_layers.find_previous(config.layer.id) == null) {
|
||||
alertify.error('There are no layers behind.');
|
||||
return false;
|
||||
}
|
||||
|
||||
//create tmp canvas
|
||||
var canvas = document.createElement('canvas');
|
||||
canvas.width = config.WIDTH;
|
||||
canvas.height = config.HEIGHT;
|
||||
var ctx = canvas.getContext("2d");
|
||||
|
||||
//first layer
|
||||
var previous_layer = this.Base_layers.find_previous(config.layer.id);
|
||||
var previous_id = previous_layer.id;
|
||||
ctx.globalAlpha = previous_layer.opacity / 100;
|
||||
ctx.globalCompositeOperation = previous_layer.composition;
|
||||
this.Base_layers.render_object(ctx, previous_layer);
|
||||
|
||||
//second layer
|
||||
var current_id = config.layer.id;
|
||||
var current_order = config.layer.order;
|
||||
ctx.globalAlpha = config.layer.opacity / 100;
|
||||
ctx.globalCompositeOperation = config.layer.composition;
|
||||
this.Base_layers.render_object(ctx, config.layer);
|
||||
|
||||
//create requested layer
|
||||
var params = [];
|
||||
params.type = 'image';
|
||||
params.name = config.layer.name + ' + merged';
|
||||
params.order = current_order;
|
||||
params.data = canvas.toDataURL("image/png");
|
||||
app.State.do_action(
|
||||
new app.Actions.Bundle_action('merge_layers', 'Merge Layers', [
|
||||
new app.Actions.Insert_layer_action(params),
|
||||
new app.Actions.Delete_layer_action(current_id),
|
||||
new app.Actions.Delete_layer_action(previous_id)
|
||||
])
|
||||
);
|
||||
|
||||
//free canvas data
|
||||
canvas.width = 1;
|
||||
canvas.height = 1;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
export default Layer_merge_class;
|
||||
Reference in New Issue
Block a user