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 "mozilla/UniquePtr.h"
11 #include "nsTArrayForwardDeclare.h"
23 struct ChannelPixelLayout
;
24 enum class ImageBitmapFormat
: uint8_t;
26 typedef nsTArray
<ChannelPixelLayout
> ImagePixelLayout
;
29 * ImageUtils is a wrapper around layers::Image. It provides three unified
30 * methods to all sub-classes of layers::Image, which are:
32 * (1) GetFormat() converts the image's format into ImageBitmapFormat enum.
33 * (2) GetBufferLength() returns the number of bytes that are used to store
34 * the image's underlying raw data.
36 * In theory, the functionalities of this class could be merged into the
37 * interface of layers::Image. However, this is designed as a isolated wrapper
38 * because we don't want to pollute the layers::Image's interface with methods
39 * that are only meaningful to the ImageBitmap.
44 ImageUtils() = delete;
45 ImageUtils(const ImageUtils
&) = delete;
46 ImageUtils(ImageUtils
&&) = delete;
47 ImageUtils
& operator=(const ImageUtils
&) = delete;
48 ImageUtils
& operator=(ImageUtils
&&) = delete;
50 explicit ImageUtils(layers::Image
* aImage
);
53 ImageBitmapFormat
GetFormat() const;
55 uint32_t GetBufferLength() const;
62 } // namespace mozilla
64 #endif /* mozilla_dom_ImageBitmapFormatUtils_h */