1 /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*-
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 ImageMetadata_h___
8 #define ImageMetadata_h___
11 #include "mozilla/Maybe.h"
13 #include "Orientation.h"
20 // The metadata about an image that decoders accumulate as they decode.
30 // Set the metadata this object represents on an image.
31 void SetOnImage(RasterImage
* image
);
33 void SetHotspot(uint16_t hotspotx
, uint16_t hotspoty
)
38 void SetLoopCount(int32_t loopcount
)
40 mLoopCount
= loopcount
;
43 void SetSize(int32_t width
, int32_t height
, Orientation orientation
)
46 mSize
.emplace(nsIntSize(width
, height
));
47 mOrientation
.emplace(orientation
);
51 bool HasSize() const { return mSize
.isSome(); }
52 bool HasOrientation() const { return mOrientation
.isSome(); }
54 int32_t GetWidth() const { return mSize
->width
; }
55 int32_t GetHeight() const { return mSize
->height
; }
56 nsIntSize
GetSize() const { return *mSize
; }
57 Orientation
GetOrientation() const { return *mOrientation
; }
60 // The hotspot found on cursors, or -1 if none was found.
64 // The loop count for animated images, or -1 for infinite loop.
67 Maybe
<nsIntSize
> mSize
;
68 Maybe
<Orientation
> mOrientation
;
72 } // namespace mozilla
74 #endif // ImageMetadata_h___