add undo action for bucket fill

This commit is contained in:
2019-06-23 14:58:26 +02:00
parent 24a459dfc1
commit 2782d864ed
6 changed files with 112 additions and 25 deletions

View File

@@ -66,6 +66,16 @@ class Canvas
};
public:
struct FloodData
{
std::shared_ptr<Layer> layer;
std::unique_ptr<bool[]> mask[6];
std::unique_ptr<glm::u8vec4[]> rgb[6] = SIXPLETTE(0);
bool dirty[6] = SIXPLETTE(false);
glm::vec4 bb[6];
void apply();
};
Plane m_plane;
Plane m_plane_brush;
DynamicShape m_brush_shape;
@@ -166,7 +176,7 @@ public:
void layer_add(std::string name, std::shared_ptr<Layer> layer = nullptr, int index = 0);
void layer_order(int idx, int pos);
void layer_merge(int source_idx, int dest_idx);
void flood_fill(int layer, int plane, std::vector<glm::ivec2> pos, std::map<int, std::unique_ptr<bool[]>>& plane_mask,
void flood_fill(int layer, int plane, std::vector<glm::ivec2> pos, FloodData& plane_data,
float threshold, glm::vec4 dest_color, std::unique_ptr<glm::vec4>& source_color);
void stroke_start(glm::vec3 point, float pressure);
void stroke_update(glm::vec3 point, float pressure);