File: base_rendering_context_2d.idl

package info (click to toggle)
chromium 138.0.7204.183-1
  • links: PTS, VCS
  • area: main
  • in suites: trixie
  • size: 6,071,908 kB
  • sloc: cpp: 34,937,088; ansic: 7,176,967; javascript: 4,110,704; python: 1,419,953; asm: 946,768; xml: 739,971; pascal: 187,324; sh: 89,623; perl: 88,663; objc: 79,944; sql: 50,304; cs: 41,786; fortran: 24,137; makefile: 21,806; php: 13,980; tcl: 13,166; yacc: 8,925; ruby: 7,485; awk: 3,720; lisp: 3,096; lex: 1,327; ada: 727; jsp: 228; sed: 36
file content (45 lines) | stat: -rw-r--r-- 4,114 bytes parent folder | download | duplicates (6)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
// Copyright 2024 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

enum CanvasDirection {"ltr", "rtl", "inherit"};
enum CanvasFontKerning {"auto", "normal", "none"};
enum CanvasFontStretch {"ultra-condensed", "extra-condensed", "condensed", "semi-condensed", "normal", "semi-expanded", "expanded", "extra-expanded", "ultra-expanded"};
enum CanvasFontVariantCaps {"normal", "small-caps", "all-small-caps", "petite-caps", "all-petite-caps", "unicase", "titling-caps"};
enum CanvasTextRendering {"auto", "optimizeSpeed", "optimizeLegibility", "geometricPrecision"};

interface mixin BaseRenderingContext2D {
    // state
    boolean isContextLost();

    // text (see also the CanvasPathDrawingStyles and CanvasTextDrawingStyles interfaces)
    [HighEntropy, MeasureAs=Canvas2DDrawText] void fillText(DOMString text, unrestricted double x, unrestricted double y, optional unrestricted double maxWidth);
    [HighEntropy, MeasureAs=Canvas2DDrawText] void strokeText(DOMString text, unrestricted double x, unrestricted double y, optional unrestricted double maxWidth);
    [HighEntropy, MeasureAs=Canvas2DMeasureText] TextMetrics measureText(DOMString text);
    [RuntimeEnabled=ExtendedTextMetrics] void fillTextCluster(TextCluster textCluster, double x, double y);
    [RuntimeEnabled=ExtendedTextMetrics] void fillTextCluster(TextCluster textCluster, double x, double y, TextClusterOptions options);
    [RuntimeEnabled=ExtendedTextMetrics] void strokeTextCluster(TextCluster textCluster, double x, double y);
    [RuntimeEnabled=ExtendedTextMetrics] void strokeTextCluster(TextCluster textCluster, double x, double y, TextClusterOptions options);

    // pixel manipulation
    [RaisesException] ImageData createImageData(ImageData imagedata);
    [RaisesException] ImageData createImageData([EnforceRange] long sw, [EnforceRange] long sh);
    [RaisesException] ImageData createImageData([EnforceRange] long sw, [EnforceRange] long sh, ImageDataSettings imageDataSettings);
    [HighEntropy, MeasureAs=Canvas2DGetImageData, RaisesException] ImageData getImageData([EnforceRange] long sx, [EnforceRange] long sy, [EnforceRange] long sw, [EnforceRange] long sh);
    [HighEntropy, MeasureAs=Canvas2DGetImageData, RaisesException] ImageData getImageData([EnforceRange] long sx, [EnforceRange] long sy, [EnforceRange] long sw, [EnforceRange] long sh, ImageDataSettings imageDataSettings);
    [NoAllocDirectCall, RaisesException] void putImageData(ImageData imagedata, [EnforceRange] long dx, [EnforceRange] long dy);
    [NoAllocDirectCall, RaisesException] void putImageData(ImageData imagedata, [EnforceRange] long dx, [EnforceRange] long dy, [EnforceRange] long dirtyX, [EnforceRange] long dirtyY, [EnforceRange] long dirtyWidth, [EnforceRange] long dirtyHeight);

    // text
    [RuntimeEnabled=CanvasTextLang] attribute DOMString lang; // (default: "inherit")
    [HighEntropy] attribute DOMString font; // (default 10px sans-serif)
    attribute CanvasTextAlign textAlign; // "start", "end", "left", "right", "center" (default: "start")
    attribute CanvasTextBaseline textBaseline; // "top", "hanging", "middle", "alphabetic", "ideographic", "bottom" (default: "alphabetic")
    attribute CanvasDirection direction; // "inherit", "rtl", "ltr" (default: "inherit")
    attribute CanvasFontKerning fontKerning; // "auto", "normal", "none" (default: "auto")
    attribute CanvasFontStretch fontStretch; // "ultra-condensed", "extra-condensed", "condensed", "semi-condensed", "normal", "semi-expanded", "expanded", "extra-expanded", "ultra-expanded" (default: normal)
    attribute CanvasFontVariantCaps fontVariantCaps; // "normal", "small-caps", "all-small-caps", "petite-caps", "all-petite-caps", "unicase", "titling-caps" (default: "normal")
    attribute DOMString letterSpacing; // length in pixel (default: "0px")
    attribute CanvasTextRendering textRendering; // "auto", "optimizeSpeed", "optimizeLegibility", "geometricPrecision" (default: "auto")
    attribute DOMString wordSpacing; // length in pixel (default: "0px")
};