image/src/ImageOps.h

changeset 0
6474c204b198
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/image/src/ImageOps.h	Wed Dec 31 06:09:35 2014 +0100
     1.3 @@ -0,0 +1,60 @@
     1.4 +/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*-
     1.5 + *
     1.6 + * This Source Code Form is subject to the terms of the Mozilla Public
     1.7 + * License, v. 2.0. If a copy of the MPL was not distributed with this
     1.8 + * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
     1.9 +
    1.10 +#ifndef MOZILLA_IMAGELIB_IMAGEOPS_H_
    1.11 +#define MOZILLA_IMAGELIB_IMAGEOPS_H_
    1.12 +
    1.13 +#include "nsCOMPtr.h"
    1.14 +
    1.15 +class imgIContainer;
    1.16 +struct nsIntRect;
    1.17 +
    1.18 +namespace mozilla {
    1.19 +namespace image {
    1.20 +
    1.21 +class Image;
    1.22 +class Orientation;
    1.23 +
    1.24 +class ImageOps
    1.25 +{
    1.26 +public:
    1.27 +  /**
    1.28 +   * Creates a version of an existing image which does not animate and is frozen
    1.29 +   * at the first frame.
    1.30 +   *
    1.31 +   * @param aImage         The existing image.
    1.32 +   */
    1.33 +  static already_AddRefed<Image> Freeze(Image* aImage);
    1.34 +  static already_AddRefed<imgIContainer> Freeze(imgIContainer* aImage);
    1.35 +
    1.36 +  /**
    1.37 +   * Creates a clipped version of an existing image. Animation is unaffected.
    1.38 +   *
    1.39 +   * @param aImage         The existing image.
    1.40 +   * @param aClip          The rectangle to clip the image against.
    1.41 +   */
    1.42 +  static already_AddRefed<Image> Clip(Image* aImage, nsIntRect aClip);
    1.43 +  static already_AddRefed<imgIContainer> Clip(imgIContainer* aImage, nsIntRect aClip);
    1.44 +
    1.45 +  /**
    1.46 +   * Creates a version of an existing image which is rotated and/or flipped to
    1.47 +   * the specified orientation.
    1.48 +   *
    1.49 +   * @param aImage         The existing image.
    1.50 +   * @param aOrientation   The desired orientation.
    1.51 +   */
    1.52 +  static already_AddRefed<Image> Orient(Image* aImage, Orientation aOrientation);
    1.53 +  static already_AddRefed<imgIContainer> Orient(imgIContainer* aImage, Orientation aOrientation);
    1.54 +
    1.55 +private:
    1.56 +  // This is a static utility class, so disallow instantiation.
    1.57 +  virtual ~ImageOps() = 0;
    1.58 +};
    1.59 +
    1.60 +} // namespace image
    1.61 +} // namespace mozilla
    1.62 +
    1.63 +#endif // MOZILLA_IMAGELIB_IMAGEOPS_H_

mercurial