chromium/third_party/blink/renderer/core/style/filter_operation.h

/*
 * Copyright (C) 2011 Apple Inc. All rights reserved.
 *
 * Redistribution and use in source and binary forms, with or without
 * modification, are permitted provided that the following conditions
 * are met:
 * 1. Redistributions of source code must retain the above copyright
 *    notice, this list of conditions and the following disclaimer.
 * 2. Redistributions in binary form must reproduce the above copyright
 *    notice, this list of conditions and the following disclaimer in the
 *    documentation and/or other materials provided with the distribution.
 *
 * THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER, INC. ``AS IS'' AND ANY
 * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
 * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL APPLE COMPUTER, INC. OR
 * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
 * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
 * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
 * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
 * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 */

#ifndef THIRD_PARTY_BLINK_RENDERER_CORE_STYLE_FILTER_OPERATION_H_
#define THIRD_PARTY_BLINK_RENDERER_CORE_STYLE_FILTER_OPERATION_H_

#include "base/notreached.h"
#include "third_party/blink/renderer/core/core_export.h"
#include "third_party/blink/renderer/core/style/shadow_data.h"
#include "third_party/blink/renderer/platform/geometry/length.h"
#include "third_party/blink/renderer/platform/geometry/length_point.h"
#include "third_party/blink/renderer/platform/graphics/box_reflection.h"
#include "third_party/blink/renderer/platform/graphics/color.h"
#include "third_party/blink/renderer/platform/graphics/filters/fe_component_transfer.h"
#include "third_party/blink/renderer/platform/graphics/filters/fe_convolve_matrix.h"
#include "third_party/blink/renderer/platform/graphics/filters/fe_turbulence.h"
#include "third_party/blink/renderer/platform/heap/garbage_collected.h"
#include "third_party/blink/renderer/platform/wtf/casting.h"
#include "third_party/blink/renderer/platform/wtf/text/wtf_string.h"
#include "ui/gfx/geometry/rect_f.h"

#include <iosfwd>

namespace blink {

class Filter;
class SVGResource;
class SVGResourceClient;

// CSS Filters

class CORE_EXPORT FilterOperation : public GarbageCollected<FilterOperation> {};

inline std::ostream& operator<<(std::ostream& stream,
                                const FilterOperation& operation) {}

class CORE_EXPORT ReferenceFilterOperation : public FilterOperation {};

template <>
struct DowncastTraits<ReferenceFilterOperation> {};

// GRAYSCALE, SEPIA, SATURATE, HUE_ROTATE and LUMINANCE_TO_ALPHA are variations
// on a basic color matrix effect.  For HUE_ROTATE, the angle of rotation is
// stored in amount_. For LUMINANCE_TO_ALPHA amount_ is unused.
class CORE_EXPORT BasicColorMatrixFilterOperation : public FilterOperation {};

// Generic color matrices
class CORE_EXPORT ColorMatrixFilterOperation : public FilterOperation {};

inline bool IsBasicColorMatrixFilterOperation(
    const FilterOperation& operation) {}

template <>
struct DowncastTraits<BasicColorMatrixFilterOperation> {};

template <>
struct DowncastTraits<ColorMatrixFilterOperation> {};

// INVERT, BRIGHTNESS, CONTRAST and OPACITY are variations on a basic component
// transfer effect.
class CORE_EXPORT BasicComponentTransferFilterOperation
    : public FilterOperation {};

inline bool IsBasicComponentTransferFilterOperation(
    const FilterOperation& operation) {}

template <>
struct DowncastTraits<BasicComponentTransferFilterOperation> {};

class CORE_EXPORT BlurFilterOperation : public FilterOperation {};

template <>
struct DowncastTraits<BlurFilterOperation> {};

class CORE_EXPORT DropShadowFilterOperation : public FilterOperation {};

template <>
struct DowncastTraits<DropShadowFilterOperation> {};

class CORE_EXPORT BoxReflectFilterOperation : public FilterOperation {};

template <>
struct DowncastTraits<BoxReflectFilterOperation> {};

class CORE_EXPORT ConvolveMatrixFilterOperation : public FilterOperation {};

template <>
struct DowncastTraits<ConvolveMatrixFilterOperation> {};

class CORE_EXPORT ComponentTransferFilterOperation : public FilterOperation {};

template <>
struct DowncastTraits<ComponentTransferFilterOperation> {};

class CORE_EXPORT TurbulenceFilterOperation : public FilterOperation {};

template <>
struct DowncastTraits<TurbulenceFilterOperation> {};

#undef DEFINE_FILTER_OPERATION_TYPE_CASTS

}  // namespace blink

#endif  // THIRD_PARTY_BLINK_RENDERER_CORE_STYLE_FILTER_OPERATION_H_