Bug 1839170 - Refactor Snap pulling, Add Firefox Snap Core22 and GNOME 42 SDK symbols...
[gecko.git] / dom / canvas / ImageUtils.h
blob46b391515c73679dea07fbe77e45172d12c2bcc6
1 /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
2 /* vim:set ts=2 sw=2 sts=2 et cindent: */
3 /* This Source Code Form is subject to the terms of the Mozilla Public
4 * License, v. 2.0. If a copy of the MPL was not distributed with this
5 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
7 #ifndef mozilla_dom_ImageBitmapFormatUtils_h
8 #define mozilla_dom_ImageBitmapFormatUtils_h
10 #include <cstdint>
12 #include "nsTArrayForwardDeclare.h"
14 namespace mozilla {
16 namespace layers {
17 class Image;
20 class ErrorResult;
22 namespace dom {
24 struct ChannelPixelLayout;
25 enum class ImageBitmapFormat : uint8_t;
27 typedef nsTArray<ChannelPixelLayout> ImagePixelLayout;
30 * ImageUtils is a wrapper around layers::Image. It provides three unified
31 * methods to all sub-classes of layers::Image, which are:
33 * (1) GetFormat() converts the image's format into ImageBitmapFormat enum.
34 * (2) GetBufferLength() returns the number of bytes that are used to store
35 * the image's underlying raw data.
37 * In theory, the functionalities of this class could be merged into the
38 * interface of layers::Image. However, this is designed as a isolated wrapper
39 * because we don't want to pollute the layers::Image's interface with methods
40 * that are only meaningful to the ImageBitmap.
42 class ImageUtils {
43 public:
44 class Impl;
45 ImageUtils() = delete;
46 ImageUtils(const ImageUtils&) = delete;
47 ImageUtils(ImageUtils&&) = delete;
48 ImageUtils& operator=(const ImageUtils&) = delete;
49 ImageUtils& operator=(ImageUtils&&) = delete;
51 explicit ImageUtils(layers::Image* aImage);
52 ~ImageUtils();
54 ImageBitmapFormat GetFormat() const;
56 uint32_t GetBufferLength() const;
58 protected:
59 Impl* mImpl;
62 } // namespace dom
63 } // namespace mozilla
65 #endif /* mozilla_dom_ImageBitmapFormatUtils_h */