Mercurial > hg > orthanc-stone
changeset 1471:28c64c246312
working on a shared library
line wrap: on
line diff
--- a/Docs/stone-object-model-reference.md Fri Jun 12 17:38:07 2020 +0200 +++ b/Docs/stone-object-model-reference.md Mon Jun 15 12:57:54 2020 +0200 @@ -155,7 +155,7 @@ the `CMakeLists.txt` file with: ``` -set(ORTHANC_STONE_APPLICATION_RESOURCES +EmbedResources( UBUNTU_FONT ${CMAKE_BINARY_DIR}/ubuntu-font-family-0.83/Ubuntu-R.ttf ) ```
--- a/Framework/Fonts/FontRenderer.cpp Fri Jun 12 17:38:07 2020 +0200 +++ b/Framework/Fonts/FontRenderer.cpp Mon Jun 15 12:57:54 2020 +0200 @@ -171,15 +171,6 @@ } - void FontRenderer::LoadFont(Orthanc::EmbeddedResources::FileResourceId resource, - unsigned int fontSize) - { - std::string content; - Orthanc::EmbeddedResources::GetFileResource(content, resource); - LoadFont(content, fontSize); - } - - Glyph* FontRenderer::Render(uint32_t unicode) { return pimpl_->Render(unicode);
--- a/Framework/Fonts/FontRenderer.h Fri Jun 12 17:38:07 2020 +0200 +++ b/Framework/Fonts/FontRenderer.h Mon Jun 15 12:57:54 2020 +0200 @@ -23,8 +23,6 @@ #include "Glyph.h" -#include <EmbeddedResources.h> - #include <stdint.h> #include <boost/shared_ptr.hpp> @@ -43,9 +41,6 @@ void LoadFont(const std::string& fontContent, unsigned int fontSize); - void LoadFont(Orthanc::EmbeddedResources::FileResourceId resource, - unsigned int fontSize); - Glyph* Render(uint32_t unicode); }; }
--- a/Framework/Loaders/DicomResourcesLoader.h Fri Jun 12 17:38:07 2020 +0200 +++ b/Framework/Loaders/DicomResourcesLoader.h Mon Jun 15 12:57:54 2020 +0200 @@ -21,6 +21,8 @@ #pragma once +#include "../OrthancStone.h" + #if !defined(ORTHANC_ENABLE_DCMTK) # error The macro ORTHANC_ENABLE_DCMTK must be defined #endif
--- a/Framework/Loaders/OracleScheduler.h Fri Jun 12 17:38:07 2020 +0200 +++ b/Framework/Loaders/OracleScheduler.h Mon Jun 15 12:57:54 2020 +0200 @@ -21,6 +21,8 @@ #pragma once +#include "../OrthancStone.h" + #if !defined(ORTHANC_ENABLE_DCMTK) # error The macro ORTHANC_ENABLE_DCMTK must be defined #endif
--- a/Framework/Loaders/OrthancSeriesVolumeProgressiveLoader.cpp Fri Jun 12 17:38:07 2020 +0200 +++ b/Framework/Loaders/OrthancSeriesVolumeProgressiveLoader.cpp Mon Jun 15 12:57:54 2020 +0200 @@ -28,6 +28,7 @@ #include "../Toolbox/GeometryToolbox.h" #include "../Volumes/DicomVolumeImageMPRSlicer.h" +#include <Compatibility.h> #include <Images/ImageProcessing.h> #include <OrthancException.h> @@ -528,7 +529,7 @@ boost::shared_ptr<OrthancStone::DicomVolumeImage> volume, bool progressiveQuality) { - std::auto_ptr<OrthancStone::ILoadersContext::ILock> lock(loadersContext.Lock()); + std::unique_ptr<OrthancStone::ILoadersContext::ILock> lock(loadersContext.Lock()); boost::shared_ptr<OrthancSeriesVolumeProgressiveLoader> obj( new OrthancSeriesVolumeProgressiveLoader(
--- a/Framework/Loaders/SeriesFramesLoader.h Fri Jun 12 17:38:07 2020 +0200 +++ b/Framework/Loaders/SeriesFramesLoader.h Mon Jun 15 12:57:54 2020 +0200 @@ -21,6 +21,8 @@ #pragma once +#include "../OrthancStone.h" + #if !defined(ORTHANC_ENABLE_DCMTK) # error The macro ORTHANC_ENABLE_DCMTK must be defined #endif
--- a/Framework/OpenGL/OpenGLIncludes.h Fri Jun 12 17:38:07 2020 +0200 +++ b/Framework/OpenGL/OpenGLIncludes.h Mon Jun 15 12:57:54 2020 +0200 @@ -21,6 +21,8 @@ #pragma once +#include "../OrthancStone.h" + #if !defined(ORTHANC_ENABLE_OPENGL) # error The macro ORTHANC_ENABLE_OPENGL must be defined #endif
--- a/Framework/Oracle/ParseDicomSuccessMessage.h Fri Jun 12 17:38:07 2020 +0200 +++ b/Framework/Oracle/ParseDicomSuccessMessage.h Mon Jun 15 12:57:54 2020 +0200 @@ -21,6 +21,8 @@ #pragma once +#include "../OrthancStone.h" + #if !defined(ORTHANC_ENABLE_DCMTK) # error The macro ORTHANC_ENABLE_DCMTK must be defined #endif
--- a/Framework/Oracle/WebAssemblyOracle.h Fri Jun 12 17:38:07 2020 +0200 +++ b/Framework/Oracle/WebAssemblyOracle.h Mon Jun 15 12:57:54 2020 +0200 @@ -21,6 +21,8 @@ #pragma once +#include "../OrthancStone.h" + #if !defined(ORTHANC_ENABLE_WASM) # error The macro ORTHANC_ENABLE_WASM must be defined #endif
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/Framework/OrthancStone.h Mon Jun 15 12:57:54 2020 +0200 @@ -0,0 +1,18 @@ +#pragma once + +/** + * Besides the "pragma once" above that only protects this file, + * define a macro to prevent including different versions of + * "OrthancStone.h" + **/ +#ifndef __ORTHANC_STONE_H +#define __ORTHANC_STONE_H + +#include <OrthancFramework.h> + +#if ORTHANC_ENABLE_OPENGL == 1 +# define GL_GLEXT_PROTOTYPES 1 +#endif + + +#endif /* __ORTHANC_STONE_H */
--- a/Framework/Scene2D/CairoCompositor.cpp Fri Jun 12 17:38:07 2020 +0200 +++ b/Framework/Scene2D/CairoCompositor.cpp Mon Jun 15 12:57:54 2020 +0200 @@ -138,12 +138,12 @@ #if ORTHANC_ENABLE_LOCALE == 1 void CairoCompositor::SetFont(size_t index, - Orthanc::EmbeddedResources::FileResourceId resource, + const std::string& ttf, unsigned int fontSize, Orthanc::Encoding codepage) { FontRenderer renderer; - renderer.LoadFont(resource, fontSize); + renderer.LoadFont(ttf, fontSize); std::unique_ptr<GlyphBitmapAlphabet> alphabet(new GlyphBitmapAlphabet); alphabet->LoadCodepage(renderer, codepage);
--- a/Framework/Scene2D/CairoCompositor.h Fri Jun 12 17:38:07 2020 +0200 +++ b/Framework/Scene2D/CairoCompositor.h Mon Jun 15 12:57:54 2020 +0200 @@ -74,7 +74,7 @@ #if ORTHANC_ENABLE_LOCALE == 1 virtual void SetFont(size_t index, - Orthanc::EmbeddedResources::FileResourceId resource, + const std::string& ttf, unsigned int fontSize, Orthanc::Encoding codepage) ORTHANC_OVERRIDE; #endif
--- a/Framework/Scene2D/ICompositor.h Fri Jun 12 17:38:07 2020 +0200 +++ b/Framework/Scene2D/ICompositor.h Mon Jun 15 12:57:54 2020 +0200 @@ -24,8 +24,6 @@ #include "Scene2D.h" #include "ScenePoint2D.h" -#include <EmbeddedResources.h> - namespace OrthancStone { class ICompositor : public boost::noncopyable @@ -50,7 +48,7 @@ #if ORTHANC_ENABLE_LOCALE == 1 virtual void SetFont(size_t index, - Orthanc::EmbeddedResources::FileResourceId resource, + const std::string& ttf, unsigned int fontSize, Orthanc::Encoding codepage) = 0; #endif
--- a/Framework/Scene2D/LookupTableStyleConfigurator.cpp Fri Jun 12 17:38:07 2020 +0200 +++ b/Framework/Scene2D/LookupTableStyleConfigurator.cpp Mon Jun 15 12:57:54 2020 +0200 @@ -44,14 +44,6 @@ { } - void LookupTableStyleConfigurator::SetLookupTable(Orthanc::EmbeddedResources::FileResourceId resource) - { - hasLut_ = true; - std::string tmp; - Orthanc::EmbeddedResources::GetFileResource(tmp, resource); - SetLookupTable(tmp); - } - void LookupTableStyleConfigurator::SetLookupTable(const std::vector<uint8_t>& lut) { hasLut_ = true;
--- a/Framework/Scene2D/LookupTableStyleConfigurator.h Fri Jun 12 17:38:07 2020 +0200 +++ b/Framework/Scene2D/LookupTableStyleConfigurator.h Mon Jun 15 12:57:54 2020 +0200 @@ -23,8 +23,6 @@ #include "ILayerStyleConfigurator.h" -#include <EmbeddedResources.h> - namespace OrthancStone { /** @@ -44,8 +42,6 @@ public: LookupTableStyleConfigurator(); - void SetLookupTable(Orthanc::EmbeddedResources::FileResourceId resource); - void SetLookupTable(const std::string& lut); /**
--- a/Framework/Scene2D/OpenGLCompositor.cpp Fri Jun 12 17:38:07 2020 +0200 +++ b/Framework/Scene2D/OpenGLCompositor.cpp Mon Jun 15 12:57:54 2020 +0200 @@ -228,14 +228,14 @@ #if ORTHANC_ENABLE_LOCALE == 1 void OpenGLCompositor::SetFont(size_t index, - Orthanc::EmbeddedResources::FileResourceId resource, + const std::string& ttf, unsigned int fontSize, Orthanc::Encoding codepage) { if (!context_.IsContextLost()) { FontRenderer renderer; - renderer.LoadFont(resource, fontSize); + renderer.LoadFont(ttf, fontSize); GlyphBitmapAlphabet dict; dict.LoadCodepage(renderer, codepage);
--- a/Framework/Scene2D/OpenGLCompositor.h Fri Jun 12 17:38:07 2020 +0200 +++ b/Framework/Scene2D/OpenGLCompositor.h Mon Jun 15 12:57:54 2020 +0200 @@ -67,7 +67,7 @@ #if ORTHANC_ENABLE_LOCALE == 1 void SetFont(size_t index, - Orthanc::EmbeddedResources::FileResourceId resource, + const std::string& ttf, unsigned int fontSize, Orthanc::Encoding codepage) ORTHANC_OVERRIDE; #endif
--- a/Framework/StoneEnumerations.h Fri Jun 12 17:38:07 2020 +0200 +++ b/Framework/StoneEnumerations.h Mon Jun 15 12:57:54 2020 +0200 @@ -21,6 +21,8 @@ #pragma once +#include "OrthancFramework.h" + #include <string>
--- a/Framework/Toolbox/DicomStructureSet.h Fri Jun 12 17:38:07 2020 +0200 +++ b/Framework/Toolbox/DicomStructureSet.h Mon Jun 15 12:57:54 2020 +0200 @@ -21,6 +21,8 @@ #pragma once +#include "../OrthancStone.h" + #if !defined(ORTHANC_ENABLE_DCMTK) # error The macro ORTHANC_ENABLE_DCMTK must be defined #endif
--- a/Framework/Toolbox/TextRenderer.cpp Fri Jun 12 17:38:07 2020 +0200 +++ b/Framework/Toolbox/TextRenderer.cpp Mon Jun 15 12:57:54 2020 +0200 @@ -35,13 +35,12 @@ namespace OrthancStone { - Orthanc::ImageAccessor* TextRenderer::Render(Orthanc::EmbeddedResources::FileResourceId font, + Orthanc::ImageAccessor* TextRenderer::Render(const std::string& ttf, unsigned int fontSize, - const std::string& utf8String - ) + const std::string& utf8String) { FontRenderer renderer; - renderer.LoadFont(font, fontSize); + renderer.LoadFont(ttf, fontSize); // add each char to be rendered to the alphabet std::unique_ptr<GlyphBitmapAlphabet> alphabet(new GlyphBitmapAlphabet); @@ -76,12 +75,12 @@ } - Orthanc::ImageAccessor* TextRenderer::RenderWithAlpha(Orthanc::EmbeddedResources::FileResourceId resource, + Orthanc::ImageAccessor* TextRenderer::RenderWithAlpha(const std::string& ttf, unsigned int fontSize, const std::string& utf8String, uint8_t foreground) { - std::unique_ptr<Orthanc::ImageAccessor> renderedText8(Render(resource, fontSize, utf8String)); + std::unique_ptr<Orthanc::ImageAccessor> renderedText8(Render(ttf, fontSize, utf8String)); std::unique_ptr<Orthanc::Image> target(new Orthanc::Image(Orthanc::PixelFormat_RGBA32, renderedText8->GetWidth(), renderedText8->GetHeight(), true)); Orthanc::ImageProcessing::Set(*target, foreground, foreground, foreground, *renderedText8); @@ -92,14 +91,14 @@ // currently disabled because the background is actually not transparent once we use the Cairo Compositor ! // // // renders text in color + a border with alpha in a RGBA32 image - // Orthanc::ImageAccessor* TextRenderer::RenderWithAlpha(Orthanc::EmbeddedResources::FileResourceId resource, + // Orthanc::ImageAccessor* TextRenderer::RenderWithAlpha(const std::string& ttf, // unsigned int fontSize, // const std::string& utf8String, // uint8_t foreground, // uint8_t borderColor) // { - // std::unique_ptr<Orthanc::ImageAccessor> renderedBorderAlpha(RenderWithAlpha(resource, fontSize, utf8String, borderColor)); - // std::unique_ptr<Orthanc::ImageAccessor> renderedTextAlpha(RenderWithAlpha(resource, fontSize, utf8String, foreground)); + // std::unique_ptr<Orthanc::ImageAccessor> renderedBorderAlpha(RenderWithAlpha(ttf, fontSize, utf8String, borderColor)); + // std::unique_ptr<Orthanc::ImageAccessor> renderedTextAlpha(RenderWithAlpha(ttf, fontSize, utf8String, foreground)); // unsigned int textWidth = renderedBorderAlpha->GetWidth(); // unsigned int textHeight = renderedBorderAlpha->GetHeight();
--- a/Framework/Toolbox/TextRenderer.h Fri Jun 12 17:38:07 2020 +0200 +++ b/Framework/Toolbox/TextRenderer.h Mon Jun 15 12:57:54 2020 +0200 @@ -22,7 +22,6 @@ #pragma once #include <Images/Image.h> -#include <EmbeddedResources.h> namespace OrthancStone { @@ -33,18 +32,18 @@ { public: // simply renders text in GrayScale8 with a black background and a white text - static Orthanc::ImageAccessor* Render(Orthanc::EmbeddedResources::FileResourceId resource, + static Orthanc::ImageAccessor* Render(const std::string& ttf, unsigned int fontSize, const std::string& utf8String); // renders text in "color" with alpha in a RGBA32 image - static Orthanc::ImageAccessor* RenderWithAlpha(Orthanc::EmbeddedResources::FileResourceId resource, + static Orthanc::ImageAccessor* RenderWithAlpha(const std::string& ttf, unsigned int fontSize, const std::string& utf8String, uint8_t foreground); // // renders text in color + a border with alpha in a RGBA32 image - // static Orthanc::ImageAccessor* RenderWithAlpha(Orthanc::EmbeddedResources::FileResourceId resource, + // static Orthanc::ImageAccessor* RenderWithAlpha(const std::string& ttf, // unsigned int fontSize, // const std::string& utf8String, // uint8_t foreground,
--- a/Resources/CMake/OrthancStoneConfiguration.cmake Fri Jun 12 17:38:07 2020 +0200 +++ b/Resources/CMake/OrthancStoneConfiguration.cmake Mon Jun 15 12:57:54 2020 +0200 @@ -159,7 +159,6 @@ endif() add_definitions( - -DGL_GLEXT_PROTOTYPES=1 -DORTHANC_ENABLE_OPENGL=1 ) else() @@ -188,31 +187,6 @@ ##################################################################### -## Embed the colormaps into the binaries -##################################################################### - -EmbedResources( - # Resources coming from the core of Orthanc. They must be copied - # here, as HAS_EMBEDDED_RESOURCES is set to ON in - # "OrthancStoneParameters.cmake" - ${DCMTK_DICTIONARIES} - - FONT_UBUNTU_MONO_BOLD_16 ${ORTHANC_ROOT}/Resources/Fonts/UbuntuMonoBold-16.json - #FONT_UBUNTU_MONO_BOLD_64 ${ORTHANC_ROOT}/Resources/Fonts/UbuntuMonoBold-64.json - - # Resources specific to the Stone of Orthanc - COLORMAP_HOT ${ORTHANC_STONE_ROOT}/Resources/Colormaps/hot.lut - COLORMAP_JET ${ORTHANC_STONE_ROOT}/Resources/Colormaps/jet.lut - COLORMAP_RED ${ORTHANC_STONE_ROOT}/Resources/Colormaps/red.lut - COLORMAP_GREEN ${ORTHANC_STONE_ROOT}/Resources/Colormaps/green.lut - COLORMAP_BLUE ${ORTHANC_STONE_ROOT}/Resources/Colormaps/blue.lut - - # Additional resources specific to the application being built - ${ORTHANC_STONE_APPLICATION_RESOURCES} - ) - - -##################################################################### ## System-specific patches ##################################################################### @@ -538,7 +512,6 @@ ${APPLICATIONS_SOURCES} ${ORTHANC_CORE_SOURCES} ${ORTHANC_DICOM_SOURCES} - ${AUTOGENERATED_SOURCES} # Mandatory components ${CAIRO_SOURCES}
--- a/Resources/CMake/OrthancStoneParameters.cmake Fri Jun 12 17:38:07 2020 +0200 +++ b/Resources/CMake/OrthancStoneParameters.cmake Mon Jun 15 12:57:54 2020 +0200 @@ -32,7 +32,6 @@ set(ENABLE_PNG ON) set(ENABLE_SQLITE OFF) set(ENABLE_ZLIB ON) -set(HAS_EMBEDDED_RESOURCES ON) #####################################################################
--- a/Samples/Common/RtViewerView.cpp Fri Jun 12 17:38:07 2020 +0200 +++ b/Samples/Common/RtViewerView.cpp Mon Jun 15 12:57:54 2020 +0200 @@ -24,6 +24,8 @@ #include "RtViewerApp.h" #include "SampleHelpers.h" +#include <EmbeddedResources.h> + // Stone of Orthanc #include "../../Framework/Oracle/GetOrthancWebViewerJpegCommand.h" #include "../../Framework/Scene2D/CairoCompositor.h" @@ -254,11 +256,10 @@ // scaling. controller.FitContent(compositor.GetCanvasWidth(), compositor.GetCanvasHeight()); - - compositor.SetFont(0, Orthanc::EmbeddedResources::UBUNTU_FONT, - FONT_SIZE_0, Orthanc::Encoding_Latin1); - compositor.SetFont(1, Orthanc::EmbeddedResources::UBUNTU_FONT, - FONT_SIZE_1, Orthanc::Encoding_Latin1); + std::string ttf; + Orthanc::EmbeddedResources::GetFileResource(ttf, Orthanc::EmbeddedResources::UBUNTU_FONT); + compositor.SetFont(0, ttf, FONT_SIZE_0, Orthanc::Encoding_Latin1); + compositor.SetFont(1, ttf, FONT_SIZE_1, Orthanc::Encoding_Latin1); } void RtViewerView::SetInfoDisplayMessage( @@ -293,8 +294,11 @@ this->SetCtVolumeSlicer(ctLoader, style.release()); { + std::string lut; + Orthanc::EmbeddedResources::GetFileResource(lut, Orthanc::EmbeddedResources::COLORMAP_HOT); + std::unique_ptr<LookupTableStyleConfigurator> config(new LookupTableStyleConfigurator); - config->SetLookupTable(Orthanc::EmbeddedResources::COLORMAP_HOT); + config->SetLookupTable(lut); boost::shared_ptr<DicomVolumeImageMPRSlicer> tmp(new DicomVolumeImageMPRSlicer(doseVolume)); this->SetDoseVolumeSlicer(tmp, config.release());
--- a/Samples/Sdl/CMakeLists.txt Fri Jun 12 17:38:07 2020 +0200 +++ b/Samples/Sdl/CMakeLists.txt Mon Jun 15 12:57:54 2020 +0200 @@ -7,6 +7,7 @@ set(STONE_ROOT ${CMAKE_CURRENT_LIST_DIR}/../../) include(${STONE_ROOT}/Resources/CMake/OrthancStoneParameters.cmake) +include(${ORTHANC_ROOT}/Resources/CMake/AutoGeneratedCode.cmake) include(${ORTHANC_ROOT}/Resources/CMake/DownloadPackage.cmake) set(ALLOW_DOWNLOADS ON) @@ -22,20 +23,22 @@ set(ENABLE_WEB_CLIENT ON) set(ORTHANC_SANDBOXED OFF) +include(${STONE_ROOT}/Resources/CMake/BoostExtendedConfiguration.cmake) +include(${STONE_ROOT}/Resources/CMake/OrthancStoneConfiguration.cmake) +include(${STONE_ROOT}/Resources/CMake/Utilities.cmake) + + + DownloadPackage( "a24b8136b8f3bb93f166baf97d9328de" "http://orthanc.osimis.io/ThirdPartyDownloads/ubuntu-font-family-0.83.zip" "${CMAKE_BINARY_DIR}/ubuntu-font-family-0.83") -set(ORTHANC_STONE_APPLICATION_RESOURCES +EmbedResources( + COLORMAP_HOT ${ORTHANC_STONE_ROOT}/Resources/Colormaps/hot.lut UBUNTU_FONT ${CMAKE_BINARY_DIR}/ubuntu-font-family-0.83/Ubuntu-R.ttf ) -list(APPEND ORTHANC_BOOST_COMPONENTS program_options) -include(${STONE_ROOT}/Resources/CMake/OrthancStoneConfiguration.cmake) -include(${STONE_ROOT}/Resources/CMake/BoostExtendedConfiguration.cmake) -include(${STONE_ROOT}/Resources/CMake/Utilities.cmake) - add_definitions( -DORTHANC_ENABLE_LOGGING=1 -DORTHANC_ENABLE_LOGGING_PLUGIN=0 @@ -47,8 +50,12 @@ add_library(OrthancStone STATIC ${ORTHANC_STONE_SOURCES} + ${AUTOGENERATED_SOURCES} ) +message(${AUTOGENERATED_SOURCES}) + + ############################# project(RtViewerSdl)
--- a/Samples/Sdl/RtViewer/CMakeLists.txt Fri Jun 12 17:38:07 2020 +0200 +++ b/Samples/Sdl/RtViewer/CMakeLists.txt Mon Jun 15 12:57:54 2020 +0200 @@ -7,6 +7,7 @@ set(STONE_ROOT ${CMAKE_CURRENT_LIST_DIR}/../../../) include(${STONE_ROOT}/Resources/CMake/OrthancStoneParameters.cmake) +include(${ORTHANC_ROOT}/Resources/CMake/AutoGeneratedCode.cmake) include(${ORTHANC_ROOT}/Resources/CMake/DownloadPackage.cmake) SET(ENABLE_GOOGLE_TEST OFF) @@ -17,18 +18,20 @@ SET(ENABLE_WEB_CLIENT ON) SET(ORTHANC_SANDBOXED OFF) +include(${STONE_ROOT}/Resources/CMake/BoostExtendedConfiguration.cmake) +include(${STONE_ROOT}/Resources/CMake/OrthancStoneConfiguration.cmake) +include(${STONE_ROOT}/Resources/CMake/Utilities.cmake) + DownloadPackage( "a24b8136b8f3bb93f166baf97d9328de" "http://orthanc.osimis.io/ThirdPartyDownloads/ubuntu-font-family-0.83.zip" "${CMAKE_BINARY_DIR}/ubuntu-font-family-0.83") -set(ORTHANC_STONE_APPLICATION_RESOURCES +EmbedResources( + COLORMAP_HOT ${ORTHANC_STONE_ROOT}/Resources/Colormaps/hot.lut UBUNTU_FONT ${CMAKE_BINARY_DIR}/ubuntu-font-family-0.83/Ubuntu-R.ttf ) -include(${STONE_ROOT}/Resources/CMake/OrthancStoneConfiguration.cmake) -include(${STONE_ROOT}/Resources/CMake/Utilities.cmake) - add_definitions( -DORTHANC_ENABLE_LOGGING=1 -DORTHANC_ENABLE_LOGGING_PLUGIN=0 @@ -47,6 +50,7 @@ ../../Common/RtViewerView.h ../../Common/SampleHelpers.h ${ORTHANC_STONE_SOURCES} + ${AUTOGENERATED_SOURCES} ) target_link_libraries(RtViewerSdl ${DCMTK_LIBRARIES})
--- a/Samples/Sdl/RtViewer/RtViewerSdl.cpp Fri Jun 12 17:38:07 2020 +0200 +++ b/Samples/Sdl/RtViewer/RtViewerSdl.cpp Mon Jun 15 12:57:54 2020 +0200 @@ -22,6 +22,8 @@ #include "../../Common/RtViewerView.h" #include "../SdlHelpers.h" +#include <EmbeddedResources.h> + // Stone of Orthanc includes #include "../../../Framework/Loaders/GenericLoadersContext.h" #include "../../../Framework/OpenGL/OpenGLIncludes.h" @@ -205,8 +207,11 @@ ViewportController& controller = lock->GetController(); Scene2D& scene = controller.GetScene(); + std::string ttf; + Orthanc::EmbeddedResources::GetFileResource(ttf, Orthanc::EmbeddedResources::UBUNTU_FONT); + CairoCompositor compositor(canvasWidth, canvasHeight); - compositor.SetFont(0, Orthanc::EmbeddedResources::UBUNTU_FONT, FONT_SIZE_0, Orthanc::Encoding_Latin1); + compositor.SetFont(0, ttf, FONT_SIZE_0, Orthanc::Encoding_Latin1); compositor.Refresh(scene); Orthanc::ImageAccessor canvas;
--- a/Samples/WebAssembly/CMakeLists.txt Fri Jun 12 17:38:07 2020 +0200 +++ b/Samples/WebAssembly/CMakeLists.txt Mon Jun 15 12:57:54 2020 +0200 @@ -33,6 +33,7 @@ set(ORTHANC_FRAMEWORK_SOURCE "path") include(${STONE_ROOT}/Resources/CMake/OrthancStoneParameters.cmake) +include(${ORTHANC_ROOT}/Resources/CMake/AutoGeneratedCode.cmake) include(${ORTHANC_ROOT}/Resources/CMake/DownloadPackage.cmake) SET(ENABLE_DCMTK ON) @@ -41,6 +42,10 @@ SET(ENABLE_WASM ON) SET(ORTHANC_SANDBOXED ON) +# this will set up the build system for Stone of Orthanc and will +# populate the ORTHANC_STONE_SOURCES CMake variable +include(${STONE_ROOT}/Resources/CMake/OrthancStoneConfiguration.cmake) + # We embed a font to be used for on-screen overlays # --------------------------------------------------------------- @@ -50,16 +55,13 @@ "http://orthanc.osimis.io/ThirdPartyDownloads/ubuntu-font-family-0.83.zip" "${CMAKE_BINARY_DIR}/ubuntu-font-family-0.83") -set(ORTHANC_STONE_APPLICATION_RESOURCES +EmbedResources( UBUNTU_FONT ${CMAKE_BINARY_DIR}/ubuntu-font-family-0.83/Ubuntu-R.ttf ) -# this will set up the build system for Stone of Orthanc and will -# populate the ORTHANC_STONE_SOURCES CMake variable -include(${STONE_ROOT}/Resources/CMake/OrthancStoneConfiguration.cmake) - add_library(OrthancStone STATIC ${ORTHANC_STONE_SOURCES} + ${AUTOGENERATED_SOURCES} ) ################################################################################
--- a/Samples/WebAssembly/RtViewer/CMakeLists.txt Fri Jun 12 17:38:07 2020 +0200 +++ b/Samples/WebAssembly/RtViewer/CMakeLists.txt Mon Jun 15 12:57:54 2020 +0200 @@ -33,6 +33,7 @@ set(ORTHANC_FRAMEWORK_SOURCE "path") include(${STONE_ROOT}/Resources/CMake/OrthancStoneParameters.cmake) +include(${ORTHANC_ROOT}/Resources/CMake/AutoGeneratedCode.cmake) include(${ORTHANC_ROOT}/Resources/CMake/DownloadPackage.cmake) SET(ENABLE_DCMTK ON) @@ -41,6 +42,10 @@ SET(ENABLE_WASM ON) SET(ORTHANC_SANDBOXED ON) +# this will set up the build system for Stone of Orthanc and will +# populate the ORTHANC_STONE_SOURCES CMake variable +include(${STONE_ROOT}/Resources/CMake/OrthancStoneConfiguration.cmake) + # We embed a font to be used for on-screen overlays # --------------------------------------------------------------- @@ -50,14 +55,10 @@ "http://orthanc.osimis.io/ThirdPartyDownloads/ubuntu-font-family-0.83.zip" "${CMAKE_BINARY_DIR}/ubuntu-font-family-0.83") -set(ORTHANC_STONE_APPLICATION_RESOURCES +EmbedResources( UBUNTU_FONT ${CMAKE_BINARY_DIR}/ubuntu-font-family-0.83/Ubuntu-R.ttf ) -# this will set up the build system for Stone of Orthanc and will -# populate the ORTHANC_STONE_SOURCES CMake variable -include(${STONE_ROOT}/Resources/CMake/OrthancStoneConfiguration.cmake) - # Define the WASM module # --------------------------------------------------------------- add_executable(RtViewerWasm @@ -67,6 +68,7 @@ ../../Common/RtViewerView.cpp ../../Common/RtViewerView.h ${ORTHANC_STONE_SOURCES} + ${AUTOGENERATED_SOURCES} ) # Declare installation files for the module