Merge topic 'refactor_vtkm_io'
820b8c8a8 Fix comment and new line. 277a0c7f7 Deprecate EncodePNG and DecodePNG from vtkm::rendering. 51c4e6d4f Merge remote-tracking branch 'upstream/master' into refactor_vtkm_io 54e15e8f1 Export symbol as VTK_IO_EXPORT. 1a16299b8 Fix build error. 981f0ed0d First stab at building a vtkm_io library target. Acked-by: Kitware Robot <kwrobot@kitware.com> Acked-by: Kenneth Moreland <kmorel@sandia.gov> Merge-request: !2063
This commit is contained in:
commit
4b584aec23
@ -10,10 +10,24 @@
|
||||
|
||||
set(headers
|
||||
ErrorIO.h
|
||||
DecodePNG.h
|
||||
EncodePNG.h
|
||||
)
|
||||
|
||||
set(sources
|
||||
DecodePNG.cxx
|
||||
EncodePNG.cxx
|
||||
)
|
||||
|
||||
vtkm_declare_headers(${headers})
|
||||
|
||||
vtkm_library( NAME vtkm_io
|
||||
SOURCES ${sources}
|
||||
HEADERS ${headers}
|
||||
)
|
||||
|
||||
target_link_libraries(vtkm_io PUBLIC vtkm_cont PRIVATE vtkm_lodepng)
|
||||
|
||||
add_subdirectory(internal)
|
||||
add_subdirectory(reader)
|
||||
add_subdirectory(writer)
|
||||
|
@ -8,18 +8,19 @@
|
||||
// PURPOSE. See the above copyright notice for more information.
|
||||
//============================================================================
|
||||
|
||||
#include <vtkm/rendering/DecodePNG.h>
|
||||
#include <vtkm/io/DecodePNG.h>
|
||||
|
||||
#include <vtkm/cont/Logging.h>
|
||||
#include <vtkm/internal/Configure.h>
|
||||
|
||||
|
||||
VTKM_THIRDPARTY_PRE_INCLUDE
|
||||
#include <vtkm/thirdparty/lodepng/vtkmlodepng/lodepng.h>
|
||||
VTKM_THIRDPARTY_POST_INCLUDE
|
||||
|
||||
namespace vtkm
|
||||
{
|
||||
namespace rendering
|
||||
namespace io
|
||||
{
|
||||
|
||||
vtkm::UInt32 DecodePNG(std::vector<unsigned char>& out_image,
|
||||
@ -39,4 +40,4 @@ vtkm::UInt32 DecodePNG(std::vector<unsigned char>& out_image,
|
||||
return retcode;
|
||||
}
|
||||
}
|
||||
} // namespace vtkm::rendering
|
||||
} // namespace vtkm::io
|
37
vtkm/io/DecodePNG.h
Normal file
37
vtkm/io/DecodePNG.h
Normal file
@ -0,0 +1,37 @@
|
||||
//============================================================================
|
||||
// Copyright (c) Kitware, Inc.
|
||||
// All rights reserved.
|
||||
// See LICENSE.txt for details.
|
||||
//
|
||||
// This software is distributed WITHOUT ANY WARRANTY; without even
|
||||
// the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
|
||||
// PURPOSE. See the above copyright notice for more information.
|
||||
//============================================================================
|
||||
#ifndef vtk_m_io_DecodePNG_h
|
||||
#define vtk_m_io_DecodePNG_h
|
||||
|
||||
#include <vtkm/Types.h>
|
||||
#include <vtkm/io/vtkm_io_export.h>
|
||||
|
||||
#include <vector>
|
||||
|
||||
namespace vtkm
|
||||
{
|
||||
namespace io
|
||||
{
|
||||
|
||||
/// Decodes a PNG file buffer in memory, into a raw pixel buffer
|
||||
/// Output is RGBA 32-bit (8 bit per channel) color format
|
||||
/// no matter what color type the original PNG image had. This gives predictable,
|
||||
/// usable data from any random input PNG.
|
||||
///
|
||||
VTKM_IO_EXPORT
|
||||
vtkm::UInt32 DecodePNG(std::vector<unsigned char>& out_image,
|
||||
unsigned long& image_width,
|
||||
unsigned long& image_height,
|
||||
const unsigned char* in_png,
|
||||
std::size_t in_size);
|
||||
}
|
||||
} // vtkm::io
|
||||
|
||||
#endif //vtk_m_io_DecodePNG_h
|
@ -8,7 +8,7 @@
|
||||
// PURPOSE. See the above copyright notice for more information.
|
||||
//============================================================================
|
||||
#include <algorithm> // for std::equal
|
||||
#include <vtkm/rendering/EncodePNG.h>
|
||||
#include <vtkm/io/EncodePNG.h>
|
||||
|
||||
#include <vtkm/cont/Logging.h>
|
||||
#include <vtkm/internal/Configure.h>
|
||||
@ -19,7 +19,7 @@ VTKM_THIRDPARTY_POST_INCLUDE
|
||||
|
||||
namespace vtkm
|
||||
{
|
||||
namespace rendering
|
||||
namespace io
|
||||
{
|
||||
|
||||
vtkm::UInt32 EncodePNG(std::vector<unsigned char> const& image,
|
||||
@ -68,4 +68,4 @@ vtkm::UInt32 SavePNG(std::string const& filename,
|
||||
return error;
|
||||
}
|
||||
}
|
||||
} // namespace vtkm::rendering
|
||||
} // namespace vtkm::io
|
38
vtkm/io/EncodePNG.h
Normal file
38
vtkm/io/EncodePNG.h
Normal file
@ -0,0 +1,38 @@
|
||||
//============================================================================
|
||||
// Copyright (c) Kitware, Inc.
|
||||
// All rights reserved.
|
||||
// See LICENSE.txt for details.
|
||||
//
|
||||
// This software is distributed WITHOUT ANY WARRANTY; without even
|
||||
// the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
|
||||
// PURPOSE. See the above copyright notice for more information.
|
||||
//============================================================================
|
||||
#ifndef vtk_m_io_EncodePNG_h
|
||||
#define vtk_m_io_EncodePNG_h
|
||||
|
||||
#include <vtkm/Types.h>
|
||||
#include <vtkm/io/vtkm_io_export.h>
|
||||
|
||||
#include <vector>
|
||||
|
||||
namespace vtkm
|
||||
{
|
||||
namespace io
|
||||
{
|
||||
|
||||
VTKM_IO_EXPORT
|
||||
vtkm::UInt32 EncodePNG(std::vector<unsigned char> const& image,
|
||||
unsigned long width,
|
||||
unsigned long height,
|
||||
unsigned char* out_png,
|
||||
std::size_t out_size);
|
||||
|
||||
VTKM_IO_EXPORT
|
||||
vtkm::UInt32 SavePNG(std::string const& filename,
|
||||
std::vector<unsigned char> const& image,
|
||||
unsigned long width,
|
||||
unsigned long height);
|
||||
}
|
||||
} // vtkm::io
|
||||
|
||||
#endif //vtk_m_io_EncodePNG_h
|
@ -50,8 +50,8 @@ set(headers
|
||||
ColorLegendAnnotation.h
|
||||
ConnectivityProxy.h
|
||||
Cylinderizer.h
|
||||
DecodePNG.h
|
||||
EncodePNG.h
|
||||
DecodePNG.h # deprecated
|
||||
EncodePNG.h # deprecated
|
||||
LineRenderer.h
|
||||
MatrixHelpers.h
|
||||
Scene.h
|
||||
@ -85,8 +85,6 @@ set(sources
|
||||
|
||||
Camera.cxx
|
||||
Color.cxx
|
||||
DecodePNG.cxx
|
||||
EncodePNG.cxx
|
||||
raytracing/Logger.cxx
|
||||
)
|
||||
|
||||
@ -200,8 +198,7 @@ elseif(VTKm_ENABLE_EGL_CONTEXT)
|
||||
endif()
|
||||
|
||||
#-----------------------------------------------------------------------------
|
||||
target_link_libraries(vtkm_rendering PUBLIC vtkm_filter
|
||||
PRIVATE vtkm_lodepng)
|
||||
target_link_libraries(vtkm_rendering PUBLIC vtkm_filter vtkm_io)
|
||||
if(UNIX AND NOT APPLE)
|
||||
target_link_libraries(vtkm_rendering PRIVATE rt)
|
||||
endif()
|
||||
|
@ -12,9 +12,9 @@
|
||||
|
||||
#include <vtkm/cont/ArrayHandleCounting.h>
|
||||
#include <vtkm/cont/TryExecute.h>
|
||||
#include <vtkm/io/DecodePNG.h>
|
||||
#include <vtkm/io/EncodePNG.h>
|
||||
#include <vtkm/rendering/BitmapFontFactory.h>
|
||||
#include <vtkm/rendering/DecodePNG.h>
|
||||
#include <vtkm/rendering/EncodePNG.h>
|
||||
#include <vtkm/rendering/LineRenderer.h>
|
||||
#include <vtkm/rendering/TextRenderer.h>
|
||||
#include <vtkm/rendering/WorldAnnotator.h>
|
||||
@ -523,7 +523,7 @@ bool Canvas::LoadFont() const
|
||||
const std::vector<unsigned char>& rawPNG = Internals->Font.GetRawImageData();
|
||||
std::vector<unsigned char> rgba;
|
||||
unsigned long textureWidth, textureHeight;
|
||||
auto error = DecodePNG(rgba, textureWidth, textureHeight, &rawPNG[0], rawPNG.size());
|
||||
auto error = io::DecodePNG(rgba, textureWidth, textureHeight, &rawPNG[0], rawPNG.size());
|
||||
if (error != 0)
|
||||
{
|
||||
return false;
|
||||
@ -598,7 +598,8 @@ void Canvas::SaveAs(const std::string& fileName) const
|
||||
}
|
||||
}
|
||||
|
||||
SavePNG(fileName, img, static_cast<unsigned long>(width), static_cast<unsigned long>(height));
|
||||
vtkm::io::SavePNG(
|
||||
fileName, img, static_cast<unsigned long>(width), static_cast<unsigned long>(height));
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -9,29 +9,26 @@
|
||||
//============================================================================
|
||||
#ifndef vtk_m_rendering_DecodePNG_h
|
||||
#define vtk_m_rendering_DecodePNG_h
|
||||
|
||||
#include <vtkm/Types.h>
|
||||
#include <vtkm/Deprecated.h>
|
||||
#include <vtkm/io/DecodePNG.h>
|
||||
#include <vtkm/rendering/vtkm_rendering_export.h>
|
||||
|
||||
#include <vector>
|
||||
|
||||
namespace vtkm
|
||||
{
|
||||
namespace rendering
|
||||
{
|
||||
|
||||
/// Decodes a PNG file buffer in memory, into a raw pixel buffer
|
||||
/// Output is RGBA 32-bit (8 bit per channel) color format
|
||||
/// no matter what color type the original PNG image had. This gives predictable,
|
||||
/// usable data from any random input PNG.
|
||||
///
|
||||
VTKM_RENDERING_EXPORT
|
||||
vtkm::UInt32 DecodePNG(std::vector<unsigned char>& out_image,
|
||||
unsigned long& image_width,
|
||||
unsigned long& image_height,
|
||||
const unsigned char* in_png,
|
||||
std::size_t in_size);
|
||||
std::size_t in_size) VTKM_DEPRECATED("Please use vtkm::io::DecodePNG")
|
||||
{
|
||||
return vtkm::io::DecodePNG(out_image, image_width, image_height, in_png, in_size);
|
||||
}
|
||||
}
|
||||
} // vtkm::rendering
|
||||
|
||||
#endif //vtk_m_rendering_DecodePNG_h
|
||||
|
||||
#endif
|
||||
|
@ -10,11 +10,9 @@
|
||||
#ifndef vtk_m_rendering_EncodePNG_h
|
||||
#define vtk_m_rendering_EncodePNG_h
|
||||
|
||||
#include <vtkm/Types.h>
|
||||
#include <vtkm/io/EncodePNG.h>
|
||||
#include <vtkm/rendering/vtkm_rendering_export.h>
|
||||
|
||||
#include <vector>
|
||||
|
||||
namespace vtkm
|
||||
{
|
||||
namespace rendering
|
||||
@ -25,13 +23,19 @@ vtkm::UInt32 EncodePNG(std::vector<unsigned char> const& image,
|
||||
unsigned long width,
|
||||
unsigned long height,
|
||||
unsigned char* out_png,
|
||||
std::size_t out_size);
|
||||
std::size_t out_size) VTKM_DEPRECATED("Please use vtkm::io::EncodePNG.")
|
||||
{
|
||||
return io::EncodePNG(image, width, height, out_png, out_size);
|
||||
}
|
||||
|
||||
VTKM_RENDERING_EXPORT
|
||||
VTKM_IO_EXPORT
|
||||
vtkm::UInt32 SavePNG(std::string const& filename,
|
||||
std::vector<unsigned char> const& image,
|
||||
unsigned long width,
|
||||
unsigned long height);
|
||||
unsigned long height) VTKM_DEPRECATED("Please use SavePNG from vtkm::io")
|
||||
{
|
||||
return io::SavePNG(filename, image, width, height);
|
||||
}
|
||||
}
|
||||
} // vtkm::rendering
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user