2026-05-11 23:06:39 +03:00
|
|
|
/*
|
|
|
|
|
* InfiniPaint
|
|
|
|
|
* Copyright (C) 2025-2026 Yousef Khadadeh
|
|
|
|
|
*
|
|
|
|
|
* This program is free software: you can redistribute it and/or modify
|
|
|
|
|
* it under the terms of the GNU General Public License as published by
|
|
|
|
|
* the Free Software Foundation, either version 3 of the License, or
|
|
|
|
|
* (at your option) any later version.
|
|
|
|
|
*
|
|
|
|
|
* This program is distributed in the hope that it will be useful,
|
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
|
* GNU General Public License for more details.
|
|
|
|
|
*
|
|
|
|
|
* You should have received a copy of the GNU General Public License
|
|
|
|
|
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
|
|
|
|
*/
|
|
|
|
|
|
2025-12-13 13:03:27 +03:00
|
|
|
#include "CanvasComponent.hpp"
|
|
|
|
|
#include "ImageCanvasComponent.hpp"
|
|
|
|
|
#include "EllipseCanvasComponent.hpp"
|
2026-05-23 18:27:45 +03:00
|
|
|
#include "MeshCanvasComponent.hpp"
|
2025-12-13 13:03:27 +03:00
|
|
|
#include "RectangleCanvasComponent.hpp"
|
|
|
|
|
#include "TextBoxCanvasComponent.hpp"
|
|
|
|
|
|
|
|
|
|
void CanvasComponent::update(DrawingProgram& drawP) {
|
|
|
|
|
}
|
|
|
|
|
|
2025-12-29 19:57:36 +03:00
|
|
|
void CanvasComponent::remap_resource_ids(const std::unordered_map<NetworkingObjects::NetObjID, NetworkingObjects::NetObjID>& resourceOldToNewMap) {
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void CanvasComponent::get_used_resources(std::unordered_set<NetworkingObjects::NetObjID>& resourceSet) const {
|
|
|
|
|
}
|
|
|
|
|
|
2025-12-15 15:36:42 +03:00
|
|
|
CanvasComponent* CanvasComponent::allocate_comp(CanvasComponentType type) {
|
2025-12-13 13:03:27 +03:00
|
|
|
switch(type) {
|
2026-05-23 18:27:45 +03:00
|
|
|
case CanvasComponentType::MESH:
|
|
|
|
|
return new MeshCanvasComponent;
|
2025-12-15 15:36:42 +03:00
|
|
|
case CanvasComponentType::RECTANGLE:
|
2025-12-13 13:03:27 +03:00
|
|
|
return new RectangleCanvasComponent;
|
2025-12-15 15:36:42 +03:00
|
|
|
case CanvasComponentType::ELLIPSE:
|
2025-12-13 13:03:27 +03:00
|
|
|
return new EllipseCanvasComponent;
|
2025-12-15 15:36:42 +03:00
|
|
|
case CanvasComponentType::TEXTBOX:
|
2025-12-13 13:03:27 +03:00
|
|
|
return new TextBoxCanvasComponent;
|
2025-12-15 15:36:42 +03:00
|
|
|
case CanvasComponentType::IMAGE:
|
2025-12-13 13:03:27 +03:00
|
|
|
return new ImageCanvasComponent;
|
|
|
|
|
}
|
|
|
|
|
return nullptr;
|
|
|
|
|
}
|
|
|
|
|
|
2026-01-27 16:55:09 +03:00
|
|
|
void CanvasComponent::change_stroke_color(const Vector4f& newStrokeColor) {
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
std::optional<Vector4f> CanvasComponent::get_stroke_color() const {
|
|
|
|
|
return std::nullopt;
|
|
|
|
|
}
|
|
|
|
|
|
2026-02-07 18:49:56 +03:00
|
|
|
bool CanvasComponent::accurate_draw(SkCanvas* canvas, const DrawData& drawData, const CoordSpaceHelper& coords, const std::shared_ptr<void>& predrawData) const {
|
2026-02-07 16:03:02 +03:00
|
|
|
return false;
|
|
|
|
|
}
|
|
|
|
|
|
2026-02-07 18:49:56 +03:00
|
|
|
std::shared_ptr<void> CanvasComponent::get_predraw_data(const DrawData& drawData) const {
|
|
|
|
|
return nullptr;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
std::shared_ptr<void> CanvasComponent::get_predraw_data_accurate(const DrawData& drawData, const CoordSpaceHelper& coords) const {
|
|
|
|
|
return nullptr;
|
|
|
|
|
}
|
|
|
|
|
|
2026-02-08 13:27:18 +03:00
|
|
|
bool CanvasComponent::should_draw_extra(const DrawData& drawData, const CoordSpaceHelper& coords) const {
|
|
|
|
|
return true;
|
|
|
|
|
}
|
|
|
|
|
|
2026-05-24 20:32:21 +03:00
|
|
|
bool CanvasComponent::can_erase_detail() const {
|
|
|
|
|
return false;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
CanvasComponentEraseDetailResult CanvasComponent::erase_detail(const SkPath& eraseAgainst) {
|
|
|
|
|
return CanvasComponentEraseDetailResult::NO_CHANGE;
|
|
|
|
|
}
|
|
|
|
|
|
2025-12-13 13:03:27 +03:00
|
|
|
CanvasComponent::~CanvasComponent() {}
|