|
1 /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- |
|
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/. */ |
|
6 |
|
7 #ifndef MOZILLA_IMAGELIB_IMAGEOPS_H_ |
|
8 #define MOZILLA_IMAGELIB_IMAGEOPS_H_ |
|
9 |
|
10 #include "nsCOMPtr.h" |
|
11 |
|
12 class imgIContainer; |
|
13 struct nsIntRect; |
|
14 |
|
15 namespace mozilla { |
|
16 namespace image { |
|
17 |
|
18 class Image; |
|
19 class Orientation; |
|
20 |
|
21 class ImageOps |
|
22 { |
|
23 public: |
|
24 /** |
|
25 * Creates a version of an existing image which does not animate and is frozen |
|
26 * at the first frame. |
|
27 * |
|
28 * @param aImage The existing image. |
|
29 */ |
|
30 static already_AddRefed<Image> Freeze(Image* aImage); |
|
31 static already_AddRefed<imgIContainer> Freeze(imgIContainer* aImage); |
|
32 |
|
33 /** |
|
34 * Creates a clipped version of an existing image. Animation is unaffected. |
|
35 * |
|
36 * @param aImage The existing image. |
|
37 * @param aClip The rectangle to clip the image against. |
|
38 */ |
|
39 static already_AddRefed<Image> Clip(Image* aImage, nsIntRect aClip); |
|
40 static already_AddRefed<imgIContainer> Clip(imgIContainer* aImage, nsIntRect aClip); |
|
41 |
|
42 /** |
|
43 * Creates a version of an existing image which is rotated and/or flipped to |
|
44 * the specified orientation. |
|
45 * |
|
46 * @param aImage The existing image. |
|
47 * @param aOrientation The desired orientation. |
|
48 */ |
|
49 static already_AddRefed<Image> Orient(Image* aImage, Orientation aOrientation); |
|
50 static already_AddRefed<imgIContainer> Orient(imgIContainer* aImage, Orientation aOrientation); |
|
51 |
|
52 private: |
|
53 // This is a static utility class, so disallow instantiation. |
|
54 virtual ~ImageOps() = 0; |
|
55 }; |
|
56 |
|
57 } // namespace image |
|
58 } // namespace mozilla |
|
59 |
|
60 #endif // MOZILLA_IMAGELIB_IMAGEOPS_H_ |