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
12 #include "nsTArrayForwardDeclare.h"
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.
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
);
54 ImageBitmapFormat
GetFormat() const;
56 uint32_t GetBufferLength() const;
63 } // namespace mozilla
65 #endif /* mozilla_dom_ImageBitmapFormatUtils_h */