PNGWriter.h 665 B

1234567891011121314151617181920212223242526272829303132
  1. /*
  2. * Copyright (c) 2021, Pierre Hoffmeister
  3. * Copyright (c) 2021, Andreas Kling <kling@serenityos.org>
  4. *
  5. * SPDX-License-Identifier: BSD-2-Clause
  6. */
  7. #pragma once
  8. #include <AK/Vector.h>
  9. #include <LibGfx/Forward.h>
  10. namespace Gfx {
  11. class PNGChunk;
  12. class PNGWriter {
  13. public:
  14. static ByteBuffer encode(Gfx::Bitmap const&);
  15. private:
  16. PNGWriter() { }
  17. Vector<u8> m_data;
  18. void add_chunk(PNGChunk const&);
  19. void add_png_header();
  20. void add_IHDR_chunk(u32 width, u32 height, u8 bit_depth, u8 color_type, u8 compression_method, u8 filter_method, u8 interlace_method);
  21. void add_IDAT_chunk(Gfx::Bitmap const&);
  22. void add_IEND_chunk();
  23. };
  24. }