Mercurial > hg > orthanc
comparison Core/Images/JpegWriter.h @ 1916:5bcf721bde4f
IImageWriter
author | Sebastien Jodogne <s.jodogne@gmail.com> |
---|---|
date | Tue, 09 Feb 2016 15:26:37 +0100 |
parents | 7454019be8f3 |
children | baf8dd89b4e0 |
comparison
equal
deleted
inserted
replaced
1915:7454019be8f3 | 1916:5bcf721bde4f |
---|---|
30 **/ | 30 **/ |
31 | 31 |
32 | 32 |
33 #pragma once | 33 #pragma once |
34 | 34 |
35 #include "ImageAccessor.h" | 35 #include "IImageWriter.h" |
36 | |
37 #include <string> | |
38 #include <stdint.h> | |
39 #include <boost/noncopyable.hpp> | |
40 | 36 |
41 namespace Orthanc | 37 namespace Orthanc |
42 { | 38 { |
43 class JpegWriter : public boost::noncopyable | 39 class JpegWriter : public IImageWriter |
44 { | 40 { |
41 protected: | |
42 virtual void WriteToFileInternal(const std::string& filename, | |
43 unsigned int width, | |
44 unsigned int height, | |
45 unsigned int pitch, | |
46 PixelFormat format, | |
47 const void* buffer); | |
48 | |
49 virtual void WriteToMemoryInternal(std::string& jpeg, | |
50 unsigned int width, | |
51 unsigned int height, | |
52 unsigned int pitch, | |
53 PixelFormat format, | |
54 const void* buffer); | |
55 | |
45 private: | 56 private: |
46 uint8_t quality_; | 57 uint8_t quality_; |
47 | 58 |
48 public: | 59 public: |
49 JpegWriter() : quality_(90) | 60 JpegWriter() : quality_(90) |
54 | 65 |
55 uint8_t GetQuality() const | 66 uint8_t GetQuality() const |
56 { | 67 { |
57 return quality_; | 68 return quality_; |
58 } | 69 } |
59 | |
60 void WriteToFile(const char* filename, | |
61 unsigned int width, | |
62 unsigned int height, | |
63 unsigned int pitch, | |
64 PixelFormat format, | |
65 const void* buffer); | |
66 | |
67 void WriteToMemory(std::string& jpeg, | |
68 unsigned int width, | |
69 unsigned int height, | |
70 unsigned int pitch, | |
71 PixelFormat format, | |
72 const void* buffer); | |
73 | |
74 void WriteToFile(const char* filename, | |
75 const ImageAccessor& accessor) | |
76 { | |
77 WriteToFile(filename, accessor.GetWidth(), accessor.GetHeight(), | |
78 accessor.GetPitch(), accessor.GetFormat(), accessor.GetConstBuffer()); | |
79 } | |
80 | |
81 void WriteToMemory(std::string& jpeg, | |
82 const ImageAccessor& accessor) | |
83 { | |
84 WriteToMemory(jpeg, accessor.GetWidth(), accessor.GetHeight(), | |
85 accessor.GetPitch(), accessor.GetFormat(), accessor.GetConstBuffer()); | |
86 } | |
87 }; | 70 }; |
88 } | 71 } |