| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (C) 2006, 2007, 2009, 2010, 2011, 2012 Apple Inc. All rights reserv
ed. | 2 * Copyright (C) 2006, 2007, 2009, 2010, 2011, 2012 Apple Inc. All rights reserv
ed. |
| 3 * | 3 * |
| 4 * Redistribution and use in source and binary forms, with or without | 4 * Redistribution and use in source and binary forms, with or without |
| 5 * modification, are permitted provided that the following conditions | 5 * modification, are permitted provided that the following conditions |
| 6 * are met: | 6 * are met: |
| 7 * 1. Redistributions of source code must retain the above copyright | 7 * 1. Redistributions of source code must retain the above copyright |
| 8 * notice, this list of conditions and the following disclaimer. | 8 * notice, this list of conditions and the following disclaimer. |
| 9 * 2. Redistributions in binary form must reproduce the above copyright | 9 * 2. Redistributions in binary form must reproduce the above copyright |
| 10 * notice, this list of conditions and the following disclaimer in the | 10 * notice, this list of conditions and the following disclaimer in the |
| 11 * documentation and/or other materials provided with the distribution. | 11 * documentation and/or other materials provided with the distribution. |
| 12 * | 12 * |
| 13 * THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER, INC. ``AS IS'' AND ANY | 13 * THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER, INC. ``AS IS'' AND ANY |
| 14 * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE | 14 * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE |
| 15 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR | 15 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR |
| 16 * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE COMPUTER, INC. OR | 16 * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE COMPUTER, INC. OR |
| 17 * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, | 17 * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, |
| 18 * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, | 18 * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, |
| 19 * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR | 19 * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR |
| 20 * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY | 20 * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY |
| 21 * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | 21 * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT |
| 22 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE | 22 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE |
| 23 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | 23 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
| 24 */ | 24 */ |
| 25 | 25 |
| 26 #ifndef SKY_ENGINE_CORE_HTML_CANVAS_CANVASRENDERINGCONTEXT2D_H_ | 26 #ifndef SKY_ENGINE_CORE_HTML_CANVAS_CANVASRENDERINGCONTEXT2D_H_ |
| 27 #define SKY_ENGINE_CORE_HTML_CANVAS_CANVASRENDERINGCONTEXT2D_H_ | 27 #define SKY_ENGINE_CORE_HTML_CANVAS_CANVASRENDERINGCONTEXT2D_H_ |
| 28 | 28 |
| 29 #include "sky/engine/bindings/core/v8/ScriptWrappable.h" | 29 #include "sky/engine/tonic/dart_wrappable.h" |
| 30 #include "sky/engine/core/css/CSSFontSelectorClient.h" | 30 #include "sky/engine/core/css/CSSFontSelectorClient.h" |
| 31 #include "sky/engine/core/html/canvas/Canvas2DContextAttributes.h" | 31 #include "sky/engine/core/html/canvas/Canvas2DContextAttributes.h" |
| 32 #include "sky/engine/core/html/canvas/CanvasPathMethods.h" | 32 #include "sky/engine/core/html/canvas/CanvasPathMethods.h" |
| 33 #include "sky/engine/core/html/canvas/CanvasRenderingContext.h" | 33 #include "sky/engine/core/html/canvas/CanvasRenderingContext.h" |
| 34 #include "sky/engine/core/html/canvas/HitRegion.h" | 34 #include "sky/engine/core/html/canvas/HitRegion.h" |
| 35 #include "sky/engine/platform/fonts/Font.h" | 35 #include "sky/engine/platform/fonts/Font.h" |
| 36 #include "sky/engine/platform/geometry/FloatSize.h" | 36 #include "sky/engine/platform/geometry/FloatSize.h" |
| 37 #include "sky/engine/platform/graphics/Color.h" | 37 #include "sky/engine/platform/graphics/Color.h" |
| 38 #include "sky/engine/platform/graphics/GraphicsTypes.h" | 38 #include "sky/engine/platform/graphics/GraphicsTypes.h" |
| 39 #include "sky/engine/platform/graphics/ImageBuffer.h" | 39 #include "sky/engine/platform/graphics/ImageBuffer.h" |
| (...skipping 17 matching lines...) Expand all Loading... |
| 57 class FloatRect; | 57 class FloatRect; |
| 58 class GraphicsContext; | 58 class GraphicsContext; |
| 59 class HTMLCanvasElement; | 59 class HTMLCanvasElement; |
| 60 class HTMLImageElement; | 60 class HTMLImageElement; |
| 61 class ImageBitmap; | 61 class ImageBitmap; |
| 62 class ImageData; | 62 class ImageData; |
| 63 class TextMetrics; | 63 class TextMetrics; |
| 64 | 64 |
| 65 typedef HashMap<String, RefPtr<MutableStylePropertySet> > MutableStylePropertyMa
p; | 65 typedef HashMap<String, RefPtr<MutableStylePropertySet> > MutableStylePropertyMa
p; |
| 66 | 66 |
| 67 class CanvasRenderingContext2D final: public CanvasRenderingContext, public Scri
ptWrappable, public CanvasPathMethods { | 67 class CanvasRenderingContext2D final: public CanvasRenderingContext, public Dart
Wrappable, public CanvasPathMethods { |
| 68 DEFINE_WRAPPERTYPEINFO(); | 68 DEFINE_WRAPPERTYPEINFO(); |
| 69 public: | 69 public: |
| 70 static PassOwnPtr<CanvasRenderingContext2D> create(HTMLCanvasElement* canvas
, const Canvas2DContextAttributes* attrs) | 70 static PassOwnPtr<CanvasRenderingContext2D> create(HTMLCanvasElement* canvas
, const Canvas2DContextAttributes* attrs) |
| 71 { | 71 { |
| 72 return adoptPtr(new CanvasRenderingContext2D(canvas, attrs)); | 72 return adoptPtr(new CanvasRenderingContext2D(canvas, attrs)); |
| 73 } | 73 } |
| 74 virtual ~CanvasRenderingContext2D(); | 74 virtual ~CanvasRenderingContext2D(); |
| 75 | 75 |
| 76 CanvasStyle* strokeStyle() const; | 76 CanvasStyle* strokeStyle() const; |
| 77 void setStrokeStyle(PassRefPtr<CanvasStyle>); | 77 void setStrokeStyle(PassRefPtr<CanvasStyle>); |
| (...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 114 void save() { ++m_stateStack.last()->m_unrealizedSaveCount; } | 114 void save() { ++m_stateStack.last()->m_unrealizedSaveCount; } |
| 115 void restore(); | 115 void restore(); |
| 116 | 116 |
| 117 void scale(float sx, float sy); | 117 void scale(float sx, float sy); |
| 118 void rotate(float angleInRadians); | 118 void rotate(float angleInRadians); |
| 119 void translate(float tx, float ty); | 119 void translate(float tx, float ty); |
| 120 void transform(float m11, float m12, float m21, float m22, float dx, float d
y); | 120 void transform(float m11, float m12, float m21, float m22, float dx, float d
y); |
| 121 void setTransform(float m11, float m12, float m21, float m22, float dx, floa
t dy); | 121 void setTransform(float m11, float m12, float m21, float m22, float dx, floa
t dy); |
| 122 void resetTransform(); | 122 void resetTransform(); |
| 123 | 123 |
| 124 String strokeColor(); |
| 124 void setStrokeColor(const String& color); | 125 void setStrokeColor(const String& color); |
| 125 void setStrokeColor(float grayLevel); | 126 void setStrokeColor(float grayLevel); |
| 126 void setStrokeColor(const String& color, float alpha); | 127 void setStrokeColor(const String& color, float alpha); |
| 127 void setStrokeColor(float grayLevel, float alpha); | 128 void setStrokeColor(float grayLevel, float alpha); |
| 128 void setStrokeColor(float r, float g, float b, float a); | 129 void setStrokeColor(float r, float g, float b, float a); |
| 129 void setStrokeColor(float c, float m, float y, float k, float a); | 130 void setStrokeColor(float c, float m, float y, float k, float a); |
| 130 | 131 |
| 132 String fillColor(); |
| 131 void setFillColor(const String& color); | 133 void setFillColor(const String& color); |
| 132 void setFillColor(float grayLevel); | 134 void setFillColor(float grayLevel); |
| 133 void setFillColor(const String& color, float alpha); | 135 void setFillColor(const String& color, float alpha); |
| 134 void setFillColor(float grayLevel, float alpha); | 136 void setFillColor(float grayLevel, float alpha); |
| 135 void setFillColor(float r, float g, float b, float a); | 137 void setFillColor(float r, float g, float b, float a); |
| 136 void setFillColor(float c, float m, float y, float k, float a); | 138 void setFillColor(float c, float m, float y, float k, float a); |
| 137 | 139 |
| 138 void beginPath(); | 140 void beginPath(); |
| 139 | 141 |
| 140 void fill(const String& winding = "nonzero"); | 142 void fill(const String& winding = "nonzero"); |
| (...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 207 | 209 |
| 208 bool imageSmoothingEnabled() const; | 210 bool imageSmoothingEnabled() const; |
| 209 void setImageSmoothingEnabled(bool); | 211 void setImageSmoothingEnabled(bool); |
| 210 | 212 |
| 211 PassRefPtr<Canvas2DContextAttributes> getContextAttributes() const; | 213 PassRefPtr<Canvas2DContextAttributes> getContextAttributes() const; |
| 212 | 214 |
| 213 void drawFocusIfNeeded(Element*); | 215 void drawFocusIfNeeded(Element*); |
| 214 void drawFocusIfNeeded(Path2D*, Element*); | 216 void drawFocusIfNeeded(Path2D*, Element*); |
| 215 | 217 |
| 216 void addHitRegion(ExceptionState&); | 218 void addHitRegion(ExceptionState&); |
| 217 void addHitRegion(const Dictionary&, ExceptionState&); | |
| 218 void removeHitRegion(const String& id); | 219 void removeHitRegion(const String& id); |
| 219 void clearHitRegions(); | 220 void clearHitRegions(); |
| 220 HitRegion* hitRegionAtPoint(const LayoutPoint&); | 221 HitRegion* hitRegionAtPoint(const LayoutPoint&); |
| 221 unsigned hitRegionsCount() const; | 222 unsigned hitRegionsCount() const; |
| 222 | 223 |
| 223 void loseContext(); | 224 void loseContext(); |
| 224 void restoreContext(); | 225 void restoreContext(); |
| 225 | 226 |
| 226 private: | 227 private: |
| 227 enum Direction { | 228 enum Direction { |
| (...skipping 121 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 349 Timer<CanvasRenderingContext2D> m_dispatchContextLostEventTimer; | 350 Timer<CanvasRenderingContext2D> m_dispatchContextLostEventTimer; |
| 350 Timer<CanvasRenderingContext2D> m_dispatchContextRestoredEventTimer; | 351 Timer<CanvasRenderingContext2D> m_dispatchContextRestoredEventTimer; |
| 351 Timer<CanvasRenderingContext2D> m_tryRestoreContextEventTimer; | 352 Timer<CanvasRenderingContext2D> m_tryRestoreContextEventTimer; |
| 352 }; | 353 }; |
| 353 | 354 |
| 354 DEFINE_TYPE_CASTS(CanvasRenderingContext2D, CanvasRenderingContext, context, con
text->is2d(), context.is2d()); | 355 DEFINE_TYPE_CASTS(CanvasRenderingContext2D, CanvasRenderingContext, context, con
text->is2d(), context.is2d()); |
| 355 | 356 |
| 356 } // namespace blink | 357 } // namespace blink |
| 357 | 358 |
| 358 #endif // SKY_ENGINE_CORE_HTML_CANVAS_CANVASRENDERINGCONTEXT2D_H_ | 359 #endif // SKY_ENGINE_CORE_HTML_CANVAS_CANVASRENDERINGCONTEXT2D_H_ |
| OLD | NEW |