PPMLoader.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 PPM {
  13. static constexpr auto ascii_magic_number = '3';
  14. static constexpr auto binary_magic_number = '6';
  15. static constexpr StringView image_type = "PPM"sv;
  16. u16 max_val { 0 };
  17. };
  18. using PPMLoadingContext = PortableImageMapLoadingContext<PPM>;
  19. using PPMImageDecoderPlugin = PortableImageDecoderPlugin<PPMLoadingContext>;
  20. ErrorOr<void> read_image_data(PPMLoadingContext& context);
  21. }