#include "ui/gfx/image/image_skia_operations.h"
#include <stddef.h>
#include <memory>
#include "base/command_line.h"
#include "base/logging.h"
#include "base/memory/ptr_util.h"
#include "base/numerics/safe_conversions.h"
#include "skia/ext/image_operations.h"
#include "third_party/skia/include/core/SkClipOp.h"
#include "third_party/skia/include/core/SkPath.h"
#include "ui/gfx/canvas.h"
#include "ui/gfx/color_palette.h"
#include "ui/gfx/geometry/insets.h"
#include "ui/gfx/geometry/point.h"
#include "ui/gfx/geometry/point_conversions.h"
#include "ui/gfx/geometry/rect.h"
#include "ui/gfx/geometry/rect_conversions.h"
#include "ui/gfx/geometry/size.h"
#include "ui/gfx/geometry/size_conversions.h"
#include "ui/gfx/geometry/skia_conversions.h"
#include "ui/gfx/image/canvas_image_source.h"
#include "ui/gfx/image/image_skia.h"
#include "ui/gfx/image/image_skia_rep.h"
#include "ui/gfx/image/image_skia_source.h"
#include "ui/gfx/skbitmap_operations.h"
#include "ui/gfx/skia_paint_util.h"
namespace gfx {
namespace {
gfx::Size DIPToPixelSize(gfx::Size dip_size, float scale) { … }
gfx::Rect DIPToPixelBounds(gfx::Rect dip_bounds, float scale) { … }
ImageSkiaRep GetErrorImageRep(float scale, const gfx::Size& pixel_size) { … }
class BinaryImageSource : public gfx::ImageSkiaSource { … };
class BlendingImageSource : public BinaryImageSource { … };
class SuperimposedImageSource : public gfx::CanvasImageSource { … };
class TransparentImageSource : public gfx::ImageSkiaSource { … };
class MaskedImageSource : public BinaryImageSource { … };
class TiledImageSource : public gfx::ImageSkiaSource { … };
class HSLImageSource : public gfx::ImageSkiaSource { … };
class ButtonImageSource : public gfx::ImageSkiaSource { … };
class ExtractSubsetImageSource : public gfx::ImageSkiaSource { … };
class ResizeSource : public ImageSkiaSource { … };
class DropShadowSource : public ImageSkiaSource { … };
class HorizontalShadowSource : public CanvasImageSource { … };
class RotatedSource : public ImageSkiaSource { … };
class IconWithBadgeSource : public gfx::CanvasImageSource { … };
class ColorMaskSource : public gfx::ImageSkiaSource { … };
class ImageWithCircleBackgroundSource : public gfx::CanvasImageSource { … };
class ImageWithRoundRectBackgroundSource : public gfx::CanvasImageSource { … };
class ImageWithRoundRectClipSource : public gfx::CanvasImageSource { … };
}
ImageSkia ImageSkiaOperations::CreateBlendedImage(const ImageSkia& first,
const ImageSkia& second,
double alpha) { … }
ImageSkia ImageSkiaOperations::CreateSuperimposedImage(
const ImageSkia& first,
const ImageSkia& second) { … }
ImageSkia ImageSkiaOperations::CreateTransparentImage(const ImageSkia& image,
double alpha) { … }
ImageSkia ImageSkiaOperations::CreateMaskedImage(const ImageSkia& rgb,
const ImageSkia& alpha) { … }
ImageSkia ImageSkiaOperations::CreateTiledImage(const ImageSkia& source,
int src_x,
int src_y,
int dst_w,
int dst_h) { … }
ImageSkia ImageSkiaOperations::CreateHSLShiftedImage(
const ImageSkia& image,
const color_utils::HSL& hsl_shift) { … }
ImageSkia ImageSkiaOperations::CreateButtonBackground(SkColor color,
const ImageSkia& image,
const ImageSkia& mask) { … }
ImageSkia ImageSkiaOperations::ExtractSubset(const ImageSkia& image,
const Rect& subset_bounds) { … }
ImageSkia ImageSkiaOperations::CreateResizedImage(
const ImageSkia& source,
skia::ImageOperations::ResizeMethod method,
const Size& target_dip_size) { … }
ImageSkia ImageSkiaOperations::CreateImageWithDropShadow(
const ImageSkia& source,
const ShadowValues& shadows) { … }
ImageSkia ImageSkiaOperations::CreateHorizontalShadow(
const std::vector<ShadowValue>& shadows,
bool fades_down) { … }
ImageSkia ImageSkiaOperations::CreateRotatedImage(
const ImageSkia& source,
SkBitmapOperations::RotationAmount rotation) { … }
ImageSkia ImageSkiaOperations::CreateIconWithBadge(const ImageSkia& icon,
const ImageSkia& badge) { … }
ImageSkia ImageSkiaOperations::CreateColorMask(const ImageSkia& image,
SkColor color) { … }
ImageSkia ImageSkiaOperations::CreateImageWithCircleBackground(
int radius,
SkColor color,
const ImageSkia& image) { … }
ImageSkia ImageSkiaOperations::CreateImageWithRoundRectBackground(
const SizeF& size,
int radius,
SkColor color,
const ImageSkia& image) { … }
ImageSkia ImageSkiaOperations::CreateImageWithRoundRectClip(
int radius,
const ImageSkia& image) { … }
ImageSkia ImageSkiaOperations::CreateCroppedCenteredRoundRectImage(
const Size& size,
int border_radius,
const ImageSkia& image) { … }
}