summaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
authorofftkp <parisoplop@gmail.com>2022-07-16 12:34:47 +0300
committerTomaž Vajngerl <quikee@gmail.com>2022-07-19 10:00:10 +0200
commit089b101e5447aac42e6fc79345e60da3ec63893d (patch)
tree23a1a96092b6b77c07d3e968a622a81f35ca2df3 /include
parent3d1032cf6b67f3f6fa539d1d42d681080517d38c (diff)
Add ms-gif PNG chunk export support in PngImageWriter
Added export support for msOG chunks in the new PngImageWriter and unit test Change-Id: I258c9ca23e41c1d5ce01fc6711bc55c13636db17 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/137093 Tested-by: Jenkins Reviewed-by: Tomaž Vajngerl <quikee@gmail.com>
Diffstat (limited to 'include')
-rw-r--r--include/vcl/filter/PngImageWriter.hxx26
1 files changed, 13 insertions, 13 deletions
diff --git a/include/vcl/filter/PngImageWriter.hxx b/include/vcl/filter/PngImageWriter.hxx
index 667dd540e332..4fb11b1ca48a 100644
--- a/include/vcl/filter/PngImageWriter.hxx
+++ b/include/vcl/filter/PngImageWriter.hxx
@@ -13,11 +13,19 @@
#include <com/sun/star/uno/Sequence.hxx>
#include <tools/stream.hxx>
#include <vcl/bitmapex.hxx>
+#include <vector>
#pragma once
namespace vcl
{
+// Similar to png_unknown_chunk
+struct PngChunk
+{
+ std::array<uint8_t, 5> name;
+ std::vector<sal_uInt8> data;
+ size_t size;
+};
class VCL_DLLPUBLIC PngImageWriter
{
SvStream& mrStream;
@@ -25,23 +33,15 @@ class VCL_DLLPUBLIC PngImageWriter
sal_Int32 mnCompressionLevel;
bool mbInterlaced;
+ std::vector<PngChunk> maAdditionalChunks;
public:
PngImageWriter(SvStream& rStream);
- virtual ~PngImageWriter() {}
-
- void setParameters(css::uno::Sequence<css::beans::PropertyValue> const& rParameters)
- {
- for (auto const& rValue : rParameters)
- {
- if (rValue.Name == "Compression")
- rValue.Value >>= mnCompressionLevel;
- else if (rValue.Name == "Interlaced")
- rValue.Value >>= mbInterlaced;
- }
- }
- bool write(BitmapEx& rBitmap);
+ virtual ~PngImageWriter() = default;
+
+ void setParameters(css::uno::Sequence<css::beans::PropertyValue> const& rParameters);
+ bool write(const BitmapEx& rBitmap);
};
} // namespace vcl