mirror of
https://github.com/Relintai/pandemonium_engine.git
synced 2025-02-11 10:30:06 +01:00
Ported RainbowAction.
This commit is contained in:
parent
cfee15aa52
commit
f462e22536
@ -31,46 +31,50 @@ SOFTWARE.
|
|||||||
void RainbowAction::do_action(PaintCanvas *canvas, const Array &data) {
|
void RainbowAction::do_action(PaintCanvas *canvas, const Array &data) {
|
||||||
PaintAction::do_action(canvas, data);
|
PaintAction::do_action(canvas, data);
|
||||||
|
|
||||||
/*
|
PoolVector2iArray pixels = PaintUtilities::get_pixels_in_line(data[0], data[1]);
|
||||||
.do_action(canvas, data)
|
|
||||||
|
for (int i = 0; i < pixels.size(); ++i) {
|
||||||
var pixels = GEUtils.get_pixels_in_line(data[0], data[1])
|
Vector2i pixel = pixels[i];
|
||||||
for pixel in pixels:
|
|
||||||
if canvas.get_pixel_v(pixel) == null:
|
if (!canvas->validate_pixel_v(pixel)) {
|
||||||
continue
|
continue;
|
||||||
|
}
|
||||||
if canvas.is_alpha_locked() and canvas.get_pixel_v(pixel) == Color.transparent:
|
|
||||||
continue
|
Color col = canvas->get_pixel_v(pixel);
|
||||||
|
|
||||||
if pixel in action_data.undo.cells:
|
if (canvas->is_alpha_locked() && col.a < 0.0001) {
|
||||||
var color = GEUtils.random_color()
|
continue;
|
||||||
canvas.set_pixel_v(pixel, color)
|
}
|
||||||
|
|
||||||
var idx = action_data.redo.cells.find(pixel)
|
if (undo_cells.contains(pixel)) {
|
||||||
action_data.redo.cells.remove(idx)
|
Color color = PaintUtilities::random_color();
|
||||||
action_data.redo.colors.remove(idx)
|
canvas->set_pixel_v(pixel, color);
|
||||||
|
|
||||||
action_data.redo.cells.append(pixel)
|
int idx = redo_cells.find(pixel);
|
||||||
action_data.redo.colors.append(color)
|
redo_cells.remove(idx);
|
||||||
continue
|
redo_colors.remove(idx);
|
||||||
|
|
||||||
action_data.undo.colors.append(canvas.get_pixel_v(pixel))
|
redo_cells.append(pixel);
|
||||||
action_data.undo.cells.append(pixel)
|
redo_colors.append(color);
|
||||||
|
|
||||||
var color = GEUtils.random_color()
|
continue;
|
||||||
canvas.set_pixel_v(pixel, color)
|
}
|
||||||
|
|
||||||
action_data.redo.cells.append(pixel)
|
undo_colors.append(col);
|
||||||
action_data.redo.colors.append(color)
|
undo_cells.append(pixel);
|
||||||
*/
|
|
||||||
|
Color color = PaintUtilities::random_color();
|
||||||
|
canvas->set_pixel_v(pixel, color);
|
||||||
|
|
||||||
|
redo_cells.append(pixel);
|
||||||
|
redo_colors.append(color);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void RainbowAction::commit_action(PaintCanvas *canvas) {
|
void RainbowAction::commit_action(PaintCanvas *canvas) {
|
||||||
/*
|
for (int idx = 0; idx < undo_cells.size(); ++idx) {
|
||||||
var cells = action_data.undo.cells
|
canvas->_set_pixel_v(layer, undo_cells[idx], undo_colors[idx]);
|
||||||
var colors = action_data.undo.colors
|
}
|
||||||
for idx in range(cells.size()):
|
|
||||||
canvas._set_pixel_v(action_data.layer, cells[idx], colors[idx])
|
|
||||||
*/
|
|
||||||
}
|
}
|
||||||
|
|
||||||
RainbowAction::RainbowAction() {
|
RainbowAction::RainbowAction() {
|
||||||
|
Loading…
Reference in New Issue
Block a user