2020-06-22 15:19:57 +03:00
|
|
|
/*
|
|
|
|
|
* Copyright (c) 2020, Hüseyin ASLITÜRK <asliturk@hotmail.com>
|
2022-03-12 11:16:30 -07:00
|
|
|
* Copyright (c) 2022, the SerenityOS developers.
|
2020-06-22 15:19:57 +03:00
|
|
|
*
|
2021-04-22 01:24:48 -07:00
|
|
|
* SPDX-License-Identifier: BSD-2-Clause
|
2020-06-22 15:19:57 +03:00
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
#pragma once
|
|
|
|
|
|
2022-03-12 11:16:30 -07:00
|
|
|
#include <AK/StringView.h>
|
2023-03-21 14:58:06 -04:00
|
|
|
#include <LibGfx/ImageFormats/ImageDecoder.h>
|
|
|
|
|
#include <LibGfx/ImageFormats/PortableImageMapLoader.h>
|
2020-06-22 15:19:57 +03:00
|
|
|
|
|
|
|
|
namespace Gfx {
|
|
|
|
|
|
2022-03-12 11:16:30 -07:00
|
|
|
struct PGM {
|
|
|
|
|
static constexpr auto ascii_magic_number = '2';
|
|
|
|
|
static constexpr auto binary_magic_number = '5';
|
2022-07-11 17:32:29 +00:00
|
|
|
static constexpr StringView image_type = "PGM"sv;
|
2022-03-12 11:16:30 -07:00
|
|
|
u16 max_val { 0 };
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
using PGMLoadingContext = PortableImageMapLoadingContext<PGM>;
|
2022-03-13 11:58:58 -06:00
|
|
|
using PGMImageDecoderPlugin = PortableImageDecoderPlugin<PGMLoadingContext>;
|
2020-06-22 15:19:57 +03:00
|
|
|
|
2023-03-12 22:55:47 -04:00
|
|
|
ErrorOr<void> read_image_data(PGMLoadingContext& context);
|
2020-06-22 15:19:57 +03:00
|
|
|
}
|