skia_util.h 1.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445
  1. // Copyright (c) 2019 GitHub, Inc.
  2. // Use of this source code is governed by the MIT license that can be
  3. // found in the LICENSE file.
  4. #ifndef ELECTRON_SHELL_COMMON_SKIA_UTIL_H_
  5. #define ELECTRON_SHELL_COMMON_SKIA_UTIL_H_
  6. #include <cstdint>
  7. #include "base/containers/span.h"
  8. namespace base {
  9. class FilePath;
  10. } // namespace base
  11. namespace gfx {
  12. class ImageSkia;
  13. }
  14. namespace electron::util {
  15. bool PopulateImageSkiaRepsFromPath(gfx::ImageSkia* image,
  16. const base::FilePath& path);
  17. bool AddImageSkiaRepFromBuffer(gfx::ImageSkia* image,
  18. base::span<const uint8_t> data,
  19. int width,
  20. int height,
  21. double scale_factor);
  22. bool AddImageSkiaRepFromJPEG(gfx::ImageSkia* image,
  23. base::span<const uint8_t> data,
  24. double scale_factor);
  25. bool AddImageSkiaRepFromPNG(gfx::ImageSkia* image,
  26. base::span<const uint8_t> data,
  27. double scale_factor);
  28. #if BUILDFLAG(IS_WIN)
  29. bool ReadImageSkiaFromICO(gfx::ImageSkia* image, HICON icon);
  30. #endif
  31. } // namespace electron::util
  32. #endif // ELECTRON_SHELL_COMMON_SKIA_UTIL_H_