/ src / core / frontend / image_interface.h
image_interface.h
 1  // Copyright 2019 Citra Emulator Project
 2  // Licensed under GPLv2 or any later version
 3  // Refer to the license.txt file included.
 4  
 5  #pragma once
 6  
 7  #include <span>
 8  #include <string>
 9  #include <vector>
10  #include <dds-ktx.h>
11  #include "common/common_types.h"
12  
13  namespace Frontend {
14  
15  /**
16   * Utility class that provides image decoding/encoding to the custom texture manager.
17   * Can be optionally overriden by frontends to provide a custom implementation.
18   */
19  class ImageInterface {
20  public:
21      virtual ~ImageInterface() = default;
22  
23      virtual bool DecodePNG(std::vector<u8>& dst, u32& width, u32& height, std::span<const u8> src);
24      virtual bool DecodeDDS(std::vector<u8>& dst, u32& width, u32& height, ddsktx_format& format,
25                             std::span<const u8> src);
26      virtual bool EncodePNG(const std::string& path, u32 width, u32 height, std::span<const u8> src);
27  };
28  
29  } // namespace Frontend