BinaryWriter.h 718 B

1234567891011121314151617181920212223
  1. /*
  2. * Copyright (c) 2023, Nico Weber <thakis@chromium.org>
  3. *
  4. * SPDX-License-Identifier: BSD-2-Clause
  5. */
  6. #pragma once
  7. #include <AK/ByteBuffer.h>
  8. namespace Gfx::ICC {
  9. class Profile;
  10. // Serializes a Profile object.
  11. // Ignores the Profile's on_disk_size() and id() and recomputes them instead.
  12. // Also ignores and the offsets and sizes in tag data.
  13. // But if the profile has its tag data in tag order and has a computed id,
  14. // it's a goal that encode(Profile::try_load_from_externally_owned_memory(bytes) returns `bytes`.
  15. // Unconditionally computes a Profile ID (which is an MD5 hash of most of the contents, see Profile::compute_id()) and writes it to the output.
  16. ErrorOr<ByteBuffer> encode(Profile const&);
  17. }