comparison Plugins/Engine/OrthancPlugins.cpp @ 1916:5bcf721bde4f

IImageWriter
author Sebastien Jodogne <s.jodogne@gmail.com>
date Tue, 09 Feb 2016 15:26:37 +0100
parents d7c1cb559431
children e8c2f993f6b3
comparison
equal deleted inserted replaced
1915:7454019be8f3 1916:5bcf721bde4f
1326 { 1326 {
1327 const _OrthancPluginCompressImage& p = *reinterpret_cast<const _OrthancPluginCompressImage*>(parameters); 1327 const _OrthancPluginCompressImage& p = *reinterpret_cast<const _OrthancPluginCompressImage*>(parameters);
1328 1328
1329 std::string compressed; 1329 std::string compressed;
1330 1330
1331 ImageAccessor accessor;
1332 accessor.AssignReadOnly(Plugins::Convert(p.pixelFormat), p.width, p.height, p.pitch, p.buffer);
1333
1331 switch (p.imageFormat) 1334 switch (p.imageFormat)
1332 { 1335 {
1333 case OrthancPluginImageFormat_Png: 1336 case OrthancPluginImageFormat_Png:
1334 { 1337 {
1335 PngWriter writer; 1338 PngWriter writer;
1336 writer.WriteToMemory(compressed, p.width, p.height, p.pitch, Plugins::Convert(p.pixelFormat), p.buffer); 1339 writer.WriteToMemory(compressed, accessor);
1337 break; 1340 break;
1338 } 1341 }
1339 1342
1340 case OrthancPluginImageFormat_Jpeg: 1343 case OrthancPluginImageFormat_Jpeg:
1341 { 1344 {
1342 JpegWriter writer; 1345 JpegWriter writer;
1343 writer.SetQuality(p.quality); 1346 writer.SetQuality(p.quality);
1344 writer.WriteToMemory(compressed, p.width, p.height, p.pitch, Plugins::Convert(p.pixelFormat), p.buffer); 1347 writer.WriteToMemory(compressed, accessor);
1345 break; 1348 break;
1346 } 1349 }
1347 1350
1348 default: 1351 default:
1349 throw OrthancException(ErrorCode_ParameterOutOfRange); 1352 throw OrthancException(ErrorCode_ParameterOutOfRange);