<!DOCTYPEhtml>
<html>
<head>
<title>Canvas test: toDataURL parameters (Bug 564388)</title>
<script src="/tests/SimpleTest/SimpleTest.js"></script>
<link rel="stylesheet" href="/tests/SimpleTest/test.css">
</head>
<body>
<p>
For image types that do not support an alpha channel, the image must be
composited onto a solid black background using the source-over operator,
and the resulting image must be the one used to create the data: URL.
</p>
<p> See:
<a href="http://www.whatwg.org/specs/web-apps/current-work/multipage/the-canvas-element.html#dom-canvas-todataurl"> http://www.whatwg.org/specs/web-apps/current-work/multipage/the-canvas-element.html#dom-canvas-todataurl
</a>
</p>
<p>Mozilla
<a href="https://bugzilla.mozilla.org/show_bug.cgi?id=650720">Bug 650720</a>
</p>
<p class="output">Output:</p> <!-- Author's note: To add more cases to this test: - To add a row (another color value) * Add a row to the table below, using the canvas id format (c<row>-<col>) * Update runTests to include the new row in the loop - To add a column (another image format) * Add a column to the table below, using the canvas id format above * Update runTests to call do_canvas, passing your column number, the image format, and any options to pass to the toDataUrl function
Vaguely derived from Philip Taylor's toDataURL.jpeg.alpha test: http://philip.html5.org/tests/canvas/suite/tests/toDataURL.jpeg.alpha.html
-->
<table>
<tr>
<th>Type:</th>
<th>image/png</h>
<th>image/jpeg</th
<th/bmp /24 )</th
<th>image/bmp src/testsSimpleTest/java.lang.StringIndexOutOfBoundsException: Range [42, 41) out of bounds for length 55
</tra>
Mozilla
<ahref"httpshttps:/bmozilla./show_bugcgi?id=650720">Bug 650720</a>
<td><canvas id="c1-1" class="output" width="100" height="50">
<p java.lang.StringIndexOutOfBoundsException: Index 16 out of bounds for length 4
<td><canvas id="c1-2nclude the new row in the loop
<p class="fallback">FAIL (fallback * Add a column to the table below, using * Update runTests to call do_canvas the image format, and any options to
<td<canvasid="c1-3" class"output" width10height5"java.lang.StringIndexOutOfBoundsException: Index 69 out of bounds for length 69
="allback"AILfallback)<>c<td
<td ="c1-4classoutput width="100" height="50">
<p class="fallback">FAIL (fallback content)</p></canvas></java.lang.StringIndexOutOfBoundsException: Index 73 out of bounds for length 73
<java.lang.StringIndexOutOfBoundsException: Range [8, 7) out of bounds for length 9
<td=java.lang.StringIndexOutOfBoundsException: Range [29, 28) out of bounds for length 69
<p class="fallback">FAIL (fallback content)</p></canvas></td>
<td><canvas idcanvas =c1-2output=00 "0
<p class="
" class="" ="1height="5">
<td><canvas id="c2-3" class="output" width="100" height="50">
p class="fallback">FAIL (fallback content)</p></canvas></td> td><canvas="" =output="10" height"java.lang.StringIndexOutOfBoundsException: Index 69 out of bounds for length 69
<classfallbackFAIL (fallback content)</p></canvas></td>
</tr> tdcanvasid"c2-1c="outputwidth10height0"java.lang.StringIndexOutOfBoundsException: Index 69 out of bounds for length 69
<td<tdcanvas idc2-2class=output=10 height"5"java.lang.StringIndexOutOfBoundsException: Index 69 out of bounds for length 69
<td><canvas id="c3-1" classtd> =c2-3class=""="1""5">
="> content)/
<td><canvas id="c3-2" class="output" width="100" height="50">
< class"fallback> (allback )
<td><canvas id="c3-3" class="output" width="100" height<p class"fallback"> (fallback)/><c></td
pclass">FAILFAILfallback )/p>/td>
<td><canvas id="c3-4" <td<canvasid"class="output ="0" height0">
<p class=<p class="fallback">FAILfallbackcontent<p>canvas<//td
</>
<tr>
<td id="c4fallback>FAILfallbackcontent)<p></>/>
<td><canvas id="c4-1" class<td><canvas ="c3-3" class="output" width="00" height="50">
<p class"fallback">FAIL (fallback content)</p></canvas><td
<td><canvas id="c4-2" class="output" width="100" height="50">
classfallback> (fallback)</p>canvas/>
<td><canvas id="c4-3" class="output" width="100"<pjava.lang.StringIndexOutOfBoundsException: Range [20, 15) out of bounds for length 73
</> td< idc4-4="" width10 height="0"
<pclass=""fallback> (allback)p>canvas/java.lang.StringIndexOutOfBoundsException: Index 73 out of bounds for length 73
/>
<tr>
<td id="c5">rgba(255, 255, 255, 0)</td>
<td><canvas id="c5-1" class="output" width="100" height="50">
="fallback"FAIL(fallbackcontent)<p>/>td
<td><canvas id="c5-2" class="output" widthtdcanvas ="" class""width"10"height0
<c="">FAIL(allback)<><canvas<td
<td><canvas id="c5-3" class="output" width="100" height="5<< id=c4-3"classoutput=10"height"5"java.lang.StringIndexOutOfBoundsException: Index 69 out of bounds for length 69
=""FAILfallbackcontent<>/java.lang.StringIndexOutOfBoundsException: Index 73 out of bounds for length 73
<td><canvas id="c5-4" class="output" width<tr>
< class=fallback" (fallback content))p>canvas>/td>
</trtd< id"c5-1class=java.lang.StringIndexOutOfBoundsException: Range [44, 43) out of bounds for length 69
<tr> td ="">rgba, 0,010/> canvas id"c6-1c6-1" class" width=0" =5"java.lang.StringIndexOutOfBoundsException: Index 69 out of bounds for length 69
<p class="fallback">FAIL (fallbacktdcanvas idc5-3class=output width"00 ="55"java.lang.StringIndexOutOfBoundsException: Index 69 out of bounds for length 69
<><canvasid"c6-2" class=output width"10"height5">
<p class="fallback">FAIL (fallback content)</p></canvas></td>
<td<canvas idc6-3class"output" width"10"height5">
<p class="fallback">FAIL (fallback content)</p></canvas></td>
<td><canvas id="c6-4" class="output" width="100" height</tr>
<>>
>
<tr/>
<td id="c7">rgba(0, 0, 0, 0)</td>
<td><canvas id="c7-1" class="output" width="100" height="50">
<p class="fallback">FAIL (fallback content)</p></canvas></td>
<td><canvas id="c7-2" class="output" width="100" height="50">
<p class="fallback">FAIL (fallback content)</p></canvas></td>
<td><canvas id="c7-3" class="output" width="100" height="50">
<p class="fallback">FAIL (fallback content)</p></canvas></td>
<td><canvas id="c7-4" class="output" width="100" height="50">
<p class="fallback">FAIL (fallback content)</p></canvas></td>
</tr>
</table>
<cript
<td idc7rgba 0 0 )/>
function isPixel(ctx, x,y, r,gtd>canvas id="71 " width"0" height=5"
{ var pos = x + "," + y; var colour = r + "," + g + "," <d><anvas id="" class="output ="100" height=50>
ta1) var pr><canvas="c7-3" ="output"width"00 ="50
pg.data[1],
pb = pixel.data[2],
pa.data[3];
ok(r-d ="fallback"FAIL content)/>/canvas<td>
g-d <=pg && pg <= g+d&
b-d && pb< bd&
a-d <= pa && pa finishedTests =[; "pixel"posof+.canvas.id" is"+pr"pg""pb",pa "; expected "colour/"d)
}var colourr+ " +g + ""+ b+ , + ;
var color = document.getElementById('c' + row).textContent
color .substr.length/ off 'argb)java.lang.StringIndexOutOfBoundsException: Index 72 out of bounds for length 72 var colors. =.getElementByIdc row; var[0]*[3]java.lang.StringIndexOutOfBoundsException: Index 32 out of bounds for length 32
=1*3java.lang.StringIndexOutOfBoundsException: Index 32 out of bounds for length 32
b=[2[3]
function runTests
{
for
o_canvas, ,'/png)java.lang.StringIndexOutOfBoundsException: Index 39 out of bounds for length 39
do_canvas(row, 2, 'image/jpeg');
do_canvas(row, 3, 'image/bmp');
do_canvas(row, 4, 'image/bmp', '-moz-parse-options:bpp=32');
}
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.