#pragma once
#if USE(CAIRO)
#include "DashArray.h"
#include "GraphicsContext.h"
#include "GraphicsTypes.h"
#include <cairo.h>
namespace WebCore {
class AffineTransform;
class Color;
class FloatRect;
class FloatRoundedRect;
class FloatSize;
class Path;
class PlatformContextCairo;
struct GraphicsContextState;
namespace Cairo {
namespace State {
void setStrokeThickness(PlatformContextCairo&, float);
void setStrokeStyle(PlatformContextCairo&, StrokeStyle);
void setCompositeOperation(PlatformContextCairo&, CompositeOperator, BlendMode);
void setShouldAntialias(PlatformContextCairo&, bool);
void setCTM(PlatformContextCairo&, const AffineTransform&);
AffineTransform getCTM(PlatformContextCairo&);
IntRect getClipBounds(PlatformContextCairo&);
FloatRect roundToDevicePixels(PlatformContextCairo&, const FloatRect&);
bool isAcceleratedContext(PlatformContextCairo&);
}
struct FillSource {
FillSource() = default;
explicit FillSource(const GraphicsContextState&);
float globalAlpha { 0 };
struct {
RefPtr<cairo_pattern_t> object;
FloatSize size;
AffineTransform transform;
bool repeatX { false };
bool repeatY { false };
} pattern;
struct {
RefPtr<cairo_pattern_t> base;
RefPtr<cairo_pattern_t> alphaAdjusted;
} gradient;
Color color;
WindRule fillRule { WindRule::NonZero };
};
struct StrokeSource {
StrokeSource() = default;
explicit StrokeSource(const GraphicsContextState&);
float globalAlpha { 0 };
RefPtr<cairo_pattern_t> pattern;
struct {
RefPtr<cairo_pattern_t> base;
RefPtr<cairo_pattern_t> alphaAdjusted;
} gradient;
Color color;
};
struct ShadowState {
ShadowState() = default;
WEBCORE_EXPORT explicit ShadowState(const GraphicsContextState&);
bool isVisible() const;
bool isRequired(PlatformContextCairo&) const;
FloatSize offset;
float blur { 0 };
Color color;
bool ignoreTransforms { false };
float globalAlpha { 1.0 };
CompositeOperator globalCompositeOperator { CompositeSourceOver };
};
void setLineCap(PlatformContextCairo&, LineCap);
void setLineDash(PlatformContextCairo&, const DashArray&, float);
void setLineJoin(PlatformContextCairo&, LineJoin);
void setMiterLimit(PlatformContextCairo&, float);
void fillRect(PlatformContextCairo&, const FloatRect&, const FillSource&, const ShadowState&);
void fillRect(PlatformContextCairo&, const FloatRect&, const Color&, const ShadowState&);
void fillRect(PlatformContextCairo&, const FloatRect&, cairo_pattern_t*);
void fillRoundedRect(PlatformContextCairo&, const FloatRoundedRect&, const Color&, const ShadowState&);
void fillRectWithRoundedHole(PlatformContextCairo&, const FloatRect&, const FloatRoundedRect&, const FillSource&, const ShadowState&);
void fillPath(PlatformContextCairo&, const Path&, const FillSource&, const ShadowState&);
void strokeRect(PlatformContextCairo&, const FloatRect&, float, const StrokeSource&, const ShadowState&);
void strokePath(PlatformContextCairo&, const Path&, const StrokeSource&, const ShadowState&);
void clearRect(PlatformContextCairo&, const FloatRect&);
void drawGlyphs(PlatformContextCairo&, const FillSource&, const StrokeSource&, const ShadowState&, const FloatPoint&, cairo_scaled_font_t*, double, const Vector<cairo_glyph_t>&, float, TextDrawingModeFlags, float, const FloatSize&, const Color&);
void drawNativeImage(PlatformContextCairo&, cairo_surface_t*, const FloatRect&, const FloatRect&, CompositeOperator, BlendMode, ImageOrientation, InterpolationQuality, float, const ShadowState&);
void drawPattern(PlatformContextCairo&, cairo_surface_t*, const IntSize&, const FloatRect&, const FloatRect&, const AffineTransform&, const FloatPoint&, CompositeOperator, BlendMode);
WEBCORE_EXPORT void drawSurface(PlatformContextCairo&, cairo_surface_t*, const FloatRect&, const FloatRect&, InterpolationQuality, float, const ShadowState&);
void drawRect(PlatformContextCairo&, const FloatRect&, float, const Color&, StrokeStyle, const Color&);
void drawLine(PlatformContextCairo&, const FloatPoint&, const FloatPoint&, StrokeStyle, const Color&, float, bool);
void drawLinesForText(PlatformContextCairo&, const FloatPoint&, const DashArray&, bool, bool, const Color&, float);
void drawLineForDocumentMarker(PlatformContextCairo&, const FloatPoint&, float, DocumentMarkerLineStyle);
void drawEllipse(PlatformContextCairo&, const FloatRect&, const Color&, StrokeStyle, const Color&, float);
void drawFocusRing(PlatformContextCairo&, const Path&, float, const Color&);
void drawFocusRing(PlatformContextCairo&, const Vector<FloatRect>&, float, const Color&);
void save(PlatformContextCairo&);
void restore(PlatformContextCairo&);
void translate(PlatformContextCairo&, float, float);
void rotate(PlatformContextCairo&, float);
void scale(PlatformContextCairo&, const FloatSize&);
void concatCTM(PlatformContextCairo&, const AffineTransform&);
void beginTransparencyLayer(PlatformContextCairo&, float);
void endTransparencyLayer(PlatformContextCairo&);
void clip(PlatformContextCairo&, const FloatRect&);
void clipOut(PlatformContextCairo&, const FloatRect&);
void clipOut(PlatformContextCairo&, const Path&);
void clipPath(PlatformContextCairo&, const Path&, WindRule);
void clipToImageBuffer(PlatformContextCairo&, cairo_surface_t*, const FloatRect&);
} }
#endif // USE(CAIRO)