mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-06-10 01:51:03 +09:00
LibGfx: Start adding a utility for handling ICC color profiles
For now, this dumps file version and device class. https://github.com/saucecontrol/compact-icc-profiles has good test inputs.
This commit is contained in:
parent
d8867f8077
commit
7f52f45e9d
Notes:
sideshowbarker
2024-07-17 05:01:20 +09:00
Author: https://github.com/nico
Commit: 7f52f45e9d
Pull-request: https://github.com/SerenityOS/serenity/pull/16671
Reviewed-by: https://github.com/ADKaster ✅
3 changed files with 31 additions and 0 deletions
|
@ -482,6 +482,9 @@ if (BUILD_LAGOM)
|
||||||
target_link_libraries(headless-browser LibWeb LibWebSocket LibCrypto LibGemini LibHTTP LibJS LibGfx LibMain LibTLS LibIPC LibJS)
|
target_link_libraries(headless-browser LibWeb LibWebSocket LibCrypto LibGemini LibHTTP LibJS LibGfx LibMain LibTLS LibIPC LibJS)
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
|
add_executable(icc ../../Userland/Utilities/icc.cpp)
|
||||||
|
target_link_libraries(icc LibCore LibGfx LibMain)
|
||||||
|
|
||||||
add_executable(js ../../Userland/Utilities/js.cpp)
|
add_executable(js ../../Userland/Utilities/js.cpp)
|
||||||
target_link_libraries(js LibCrypto LibJS LibLine LibLocale LibMain LibTextCodec Threads::Threads)
|
target_link_libraries(js LibCrypto LibJS LibLine LibLocale LibMain LibTextCodec Threads::Threads)
|
||||||
if (EMSCRIPTEN)
|
if (EMSCRIPTEN)
|
||||||
|
|
|
@ -90,6 +90,7 @@ target_link_libraries(grep PRIVATE LibRegex)
|
||||||
target_link_libraries(gunzip PRIVATE LibCompress)
|
target_link_libraries(gunzip PRIVATE LibCompress)
|
||||||
target_link_libraries(gzip PRIVATE LibCompress)
|
target_link_libraries(gzip PRIVATE LibCompress)
|
||||||
target_link_libraries(headless-browser PRIVATE LibCrypto LibGemini LibGfx LibHTTP LibTLS LibWeb LibWebSocket LibIPC LibJS)
|
target_link_libraries(headless-browser PRIVATE LibCrypto LibGemini LibGfx LibHTTP LibTLS LibWeb LibWebSocket LibIPC LibJS)
|
||||||
|
target_link_libraries(icc PRIVATE LibGfx)
|
||||||
target_link_libraries(jail-attach PRIVATE LibCore LibMain)
|
target_link_libraries(jail-attach PRIVATE LibCore LibMain)
|
||||||
target_link_libraries(jail-create PRIVATE LibCore LibMain)
|
target_link_libraries(jail-create PRIVATE LibCore LibMain)
|
||||||
target_link_libraries(js PRIVATE LibCrypto LibJS LibLine LibLocale LibTextCodec)
|
target_link_libraries(js PRIVATE LibCrypto LibJS LibLine LibLocale LibTextCodec)
|
||||||
|
|
27
Userland/Utilities/icc.cpp
Normal file
27
Userland/Utilities/icc.cpp
Normal file
|
@ -0,0 +1,27 @@
|
||||||
|
/*
|
||||||
|
* Copyright (c) 2022, Nico Weber <thakis@chromium.org>
|
||||||
|
*
|
||||||
|
* SPDX-License-Identifier: BSD-2-Clause
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include <AK/StringView.h>
|
||||||
|
#include <LibCore/ArgsParser.h>
|
||||||
|
#include <LibCore/MappedFile.h>
|
||||||
|
#include <LibGfx/ICCProfile.h>
|
||||||
|
|
||||||
|
ErrorOr<int> serenity_main(Main::Arguments arguments)
|
||||||
|
{
|
||||||
|
Core::ArgsParser args_parser;
|
||||||
|
|
||||||
|
static StringView icc_path;
|
||||||
|
args_parser.add_positional_argument(icc_path, "Path to ICC profile", "FILE");
|
||||||
|
args_parser.parse(arguments);
|
||||||
|
|
||||||
|
auto icc_file = TRY(Core::MappedFile::map(icc_path));
|
||||||
|
auto profile = TRY(Gfx::ICC::Profile::try_load_from_externally_owned_memory(icc_file->bytes()));
|
||||||
|
|
||||||
|
outln("version: {}", profile->version());
|
||||||
|
outln("device class: {}", Gfx::ICC::device_class_name(profile->device_class()));
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
}
|
Loading…
Add table
Add a link
Reference in a new issue