PGMLoader.h 729 B

123456789101112131415161718192021222324252627
  1. /*
  2. * Copyright (c) 2020, Hüseyin ASLITÜRK <asliturk@hotmail.com>
  3. * Copyright (c) 2022, the SerenityOS developers.
  4. *
  5. * SPDX-License-Identifier: BSD-2-Clause
  6. */
  7. #pragma once
  8. #include <AK/StringView.h>
  9. #include <LibGfx/ImageFormats/ImageDecoder.h>
  10. #include <LibGfx/ImageFormats/PortableImageMapLoader.h>
  11. namespace Gfx {
  12. struct PGM {
  13. static constexpr auto ascii_magic_number = '2';
  14. static constexpr auto binary_magic_number = '5';
  15. static constexpr StringView image_type = "PGM"sv;
  16. u16 max_val { 0 };
  17. };
  18. using PGMLoadingContext = PortableImageMapLoadingContext<PGM>;
  19. using PGMImageDecoderPlugin = PortableImageDecoderPlugin<PGMLoadingContext>;
  20. ErrorOr<void> read_image_data(PGMLoadingContext& context);
  21. }