Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/mapsme/omim.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
path: root/coding
diff options
context:
space:
mode:
authorvng <viktor.govako@gmail.com>2015-05-15 12:57:53 +0300
committerAlex Zolotarev <alex@maps.me>2015-09-23 02:48:05 +0300
commitea6fbf1a0b39e52cd5ff37881c71e81adbb544a0 (patch)
tree92c93e0326f789951cc23f20a3d60531b1ff0f7c /coding
parent6bd773ad22d77b4f0b4d1ac4d976f6056632607d (diff)
Added png encoder.
Diffstat (limited to 'coding')
-rw-r--r--coding/coding.pro2
-rw-r--r--coding/png_memory_encoder.cpp17
-rw-r--r--coding/png_memory_encoder.hpp12
3 files changed, 31 insertions, 0 deletions
diff --git a/coding/coding.pro b/coding/coding.pro
index 9946d2860e..4013ec2f33 100644
--- a/coding/coding.pro
+++ b/coding/coding.pro
@@ -37,6 +37,7 @@ SOURCES += \
compressed_bit_vector.cpp \
# compressed_varnum_vector.cpp \
bit_streams.cpp \
+ png_memory_encoder.cpp \
HEADERS += \
internal/xmlparser.hpp \
@@ -104,3 +105,4 @@ HEADERS += \
# compressed_varnum_vector.hpp \
varint_misc.hpp \
bit_streams.hpp \
+ png_memory_encoder.hpp \
diff --git a/coding/png_memory_encoder.cpp b/coding/png_memory_encoder.cpp
new file mode 100644
index 0000000000..36f9fba90c
--- /dev/null
+++ b/coding/png_memory_encoder.cpp
@@ -0,0 +1,17 @@
+#include "png_memory_encoder.hpp"
+#include "lodepng.hpp"
+
+#include "base/assert.hpp"
+
+namespace il
+{
+
+void EncodePngToMemory(size_t width, size_t height,
+ vector<uint8_t> const & rgba,
+ vector<uint8_t> & out)
+{
+ CHECK(LodePNG::encode(out, rgba, width, height) == 0, ());
+ CHECK(out.size() != 0, ());
+}
+
+} // namespace il
diff --git a/coding/png_memory_encoder.hpp b/coding/png_memory_encoder.hpp
new file mode 100644
index 0000000000..b94643a892
--- /dev/null
+++ b/coding/png_memory_encoder.hpp
@@ -0,0 +1,12 @@
+#pragma once
+
+#include "../std/vector.hpp"
+
+namespace il
+{
+
+void EncodePngToMemory(size_t width, size_t height,
+ vector<uint8_t> const & rgba,
+ vector<uint8_t> & out);
+
+} // namespace il