diff --git a/src/app/core/platform/clipboard.cc b/src/app/core/platform/clipboard.cc index 99264cb8..b22d7b08 100644 --- a/src/app/core/platform/clipboard.cc +++ b/src/app/core/platform/clipboard.cc @@ -6,9 +6,11 @@ namespace yaze { namespace core { +#if YAZE_LIB_PNG == 1 void CopyImageToClipboard(const std::vector& data) {} void GetImageFromClipboard(std::vector& data, int& width, int& height) {} +#endif } // namespace core } // namespace yaze \ No newline at end of file diff --git a/src/app/core/platform/clipboard.h b/src/app/core/platform/clipboard.h index ab693926..a77c5e90 100644 --- a/src/app/core/platform/clipboard.h +++ b/src/app/core/platform/clipboard.h @@ -7,8 +7,10 @@ namespace yaze { namespace core { +#if YAZE_LIB_PNG == 1 void CopyImageToClipboard(const std::vector &data); void GetImageFromClipboard(std::vector &data, int &width, int &height); +#endif } // namespace core } // namespace yaze diff --git a/src/app/core/platform/clipboard.mm b/src/app/core/platform/clipboard.mm index cb0967d8..a5ca55d3 100644 --- a/src/app/core/platform/clipboard.mm +++ b/src/app/core/platform/clipboard.mm @@ -6,6 +6,7 @@ #ifdef TARGET_OS_MAC #import +#if YAZE_LIB_PNG == 1 void yaze::core::CopyImageToClipboard(const std::vector& pngData) { NSData* data = [NSData dataWithBytes:pngData.data() length:pngData.size()]; NSImage* image = [[NSImage alloc] initWithData:data]; @@ -41,5 +42,6 @@ void yaze::core::GetImageFromClipboard(std::vector& pixel_data, int& wi CGContextDrawImage(context, CGRectMake(0, 0, width, height), cgImage); CGContextRelease(context); } +#endif // YAZE_LIB_PNG -#endif +#endif // TARGET_OS_MAC diff --git a/src/app/editor/graphics/graphics_editor.cc b/src/app/editor/graphics/graphics_editor.cc index f12cc359..d14c6c1a 100644 --- a/src/app/editor/graphics/graphics_editor.cc +++ b/src/app/editor/graphics/graphics_editor.cc @@ -121,9 +121,14 @@ void GraphicsEditor::DrawGfxEditToolset() { TableNextColumn(); if (Button(ICON_MD_CONTENT_COPY)) { +#if YAZE_LIB_PNG == 1 std::vector png_data = gfx::Arena::Get().gfx_sheets().at(current_sheet_).GetPngData(); core::CopyImageToClipboard(png_data); +#else + // PNG support disabled - show message or alternative action + status_ = absl::UnimplementedError("PNG export not available in this build"); +#endif } HOVER_HINT("Copy to Clipboard"); diff --git a/src/app/editor/overworld/overworld_editor.cc b/src/app/editor/overworld/overworld_editor.cc index 6cd0a52d..a12e2ae4 100644 --- a/src/app/editor/overworld/overworld_editor.cc +++ b/src/app/editor/overworld/overworld_editor.cc @@ -142,14 +142,17 @@ void OverworldEditor::Initialize() { }); gui::AddTableColumn(toolset_table_, "##CopyMap", [&]() { if (Button(ICON_MD_CONTENT_COPY)) { - std::vector png_data; - png_data = maps_bmp_[current_map_].GetPngData(); +#if YAZE_LIB_PNG == 1 + std::vector png_data = maps_bmp_[current_map_].GetPngData(); if (png_data.size() > 0) { core::CopyImageToClipboard(png_data); } else { status_ = absl::InternalError( "Failed to convert overworld map surface to PNG"); } +#else + status_ = absl::UnimplementedError("PNG export not available in this build"); +#endif } HOVER_HINT("Copy Map to Clipboard"); });