Client.h 850 B

12345678910111213141516171819202122232425262728293031323334353637383940414243
  1. /*
  2. * Copyright (c) 2020, Andreas Kling <kling@serenityos.org>
  3. *
  4. * SPDX-License-Identifier: BSD-2-Clause
  5. */
  6. #pragma once
  7. #include <AK/HashMap.h>
  8. #include <ImageDecoder/ImageDecoderClientEndpoint.h>
  9. #include <ImageDecoder/ImageDecoderServerEndpoint.h>
  10. #include <LibIPC/ServerConnection.h>
  11. namespace ImageDecoderClient {
  12. struct Frame {
  13. RefPtr<Gfx::Bitmap> bitmap;
  14. u32 duration { 0 };
  15. };
  16. struct DecodedImage {
  17. bool is_animated { false };
  18. u32 loop_count { 0 };
  19. Vector<Frame> frames;
  20. };
  21. class Client final
  22. : public IPC::ServerConnection<ImageDecoderClientEndpoint, ImageDecoderServerEndpoint>
  23. , public ImageDecoderClientEndpoint {
  24. C_OBJECT(Client);
  25. public:
  26. Optional<DecodedImage> decode_image(const ByteBuffer&);
  27. Function<void()> on_death;
  28. private:
  29. Client();
  30. virtual void die() override;
  31. };
  32. }