-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Initial Commit - moved from Google Code
- Loading branch information
1 parent
8c08e45
commit d68f6d6
Showing
218 changed files
with
37,755 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,114 @@ | ||
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> | ||
<!-- saved from url=(0014)about:internet --> | ||
<html xmlns="http://www.w3.org/1999/xhtml" lang="en" xml:lang="en"> | ||
<!-- | ||
Smart developers always View Source. | ||
This application was built using Adobe Flex, an open source framework | ||
for building rich Internet applications that get delivered via the | ||
Flash Player or to desktops via Adobe AIR. | ||
Learn more about Flex at http://flex.org | ||
// --> | ||
<head> | ||
<title>Pibeca - Pixel Bender filters for Canvas by Mario Klingemann, Quasimondo</title> | ||
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> | ||
<!-- Include CSS to eliminate any default margins/padding and set the height of the html element and | ||
the body element to 100%, because Firefox, or any Gecko based browser, interprets percentage as | ||
the percentage of the height of its parent container, which has to be set explicitly. Initially, | ||
don't display Pibeca div so it won't show if JavaScript disabled. | ||
--> | ||
<style type="text/css" media="screen"> | ||
html, body { height:100%; } | ||
body { margin:0; padding:0; overflow:auto; text-align:center; | ||
background-color: #ffffff; } | ||
#Pibeca { display:none; } | ||
</style> | ||
|
||
|
||
<script type="text/javascript" src="swfobject.js"></script> | ||
|
||
<script src="Pibeca.js" language="javascript"></script> | ||
|
||
<script type="text/javascript"> | ||
<!-- For version detection, set to min. required Flash Player version, or 0 (or 0.0.0), for no version detection. --> | ||
var swfVersionStr = "10.0.0"; | ||
<!-- To use express install, set to playerProductInstall.swf, otherwise the empty string. --> | ||
var xiSwfUrlStr = "playerProductInstall.swf"; | ||
var flashvars = {}; | ||
var params = {}; | ||
params.quality = "high"; | ||
params.bgcolor = "#ffffff"; | ||
params.allowscriptaccess = "sameDomain"; | ||
params.allowfullscreen = "true"; | ||
params.hasPriority = "true"; | ||
var attributes = {}; | ||
attributes.id = "Pibeca"; | ||
attributes.name = "Pibeca"; | ||
attributes.align = "middle"; | ||
swfobject.embedSWF( | ||
"Pibeca.swf", "Pibeca", | ||
"1", "1", | ||
swfVersionStr, xiSwfUrlStr, | ||
flashvars, params, attributes); | ||
<!-- JavaScript enabled so display the Pibecadiv in case it is not replaced with a swf object. --> | ||
swfobject.createCSS("#Pibeca", "display:block;text-align:left;"); | ||
</script> | ||
</head> | ||
<body> | ||
<!-- SWFObject's dynamic embed method replaces this alternative HTML content with Flash content when enough | ||
JavaScript and Flash plug-in support is available. The div is initially hidden so that it doesn't show | ||
when JavaScript is disabled. | ||
--> | ||
<div id="Pibeca"> | ||
<p> | ||
To view this page ensure that Adobe Flash Player version | ||
10.0.0 or greater is installed. | ||
</p> | ||
<script type="text/javascript"> | ||
var pageHost = ((document.location.protocol == "https:") ? "https://" : "http://"); | ||
document.write("<a href='http://www.adobe.com/go/getflashplayer'><img src='" | ||
+ pageHost + "www.adobe.com/images/shared/download_buttons/get_flash_player.gif' alt='Get Adobe Flash player' /></a>" ); | ||
</script> | ||
</div> | ||
|
||
<noscript> | ||
<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" width="1" height="1" id="Pibeca"> | ||
<param name="movie" value="Pibeca.swf" /> | ||
<param name="quality" value="high" /> | ||
<param name="bgcolor" value="#ffffff" /> | ||
<param name="allowScriptAccess" value="sameDomain" /> | ||
<param name="allowFullScreen" value="true" /> | ||
<param name="hasPriority" value="true" /> | ||
<!--[if !IE]>--> | ||
<object type="application/x-shockwave-flash" data="Pibeca.swf" width="1" height="1"> | ||
<param name="quality" value="high" /> | ||
<param name="bgcolor" value="#ffffff" /> | ||
<param name="allowScriptAccess" value="sameDomain" /> | ||
<param name="allowFullScreen" value="true" /> | ||
<param name="hasPriority" value="true" /> | ||
<!--<![endif]--> | ||
<!--[if gte IE 6]>--> | ||
<p> | ||
Either scripts and active content are not permitted to run or Adobe Flash Player version | ||
10.0.0 or greater is not installed. | ||
</p> | ||
<!--<![endif]--> | ||
<a href="http://www.adobe.com/go/getflashplayer"> | ||
<img src="http://www.adobe.com/images/shared/download_buttons/get_flash_player.gif" alt="Get Adobe Flash Player" /> | ||
</a> | ||
<!--[if !IE]>--> | ||
</object> | ||
<!--<![endif]--> | ||
</object> | ||
</noscript> | ||
<div id="imageHolder" style="position:absolute;left:20px; top:20px;text-align:center;font-size:10px;"> | ||
<img id="srcimg" src="assets/lonerider2.jpg"/><br> | ||
<a href="#" onclick="filterImage( 'demo', 'srcimg', 'canvas', 'filters/inversion.pbj', {center:[Math.random()*Math.random()*375], radius:[20 + Math.random()*500,20 + Math.random()*500], limit:[100 + Math.random()*900,100 + Math.random()*900]})">Run Pixel Bender Filter</a> (Click again to randomize parameters) | ||
</div> | ||
<div id="canvasHolder" style="position:absolute;left:20px; top:20px;text-align:center;font-size:10px;"> | ||
<canvas id="canvas"> | ||
</div> | ||
|
||
</body> | ||
</html> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,140 @@ | ||
/* | ||
Pibeca - Pixel Bender For Canvas v0.2 | ||
Pibeca allows the use of The Adobe® Pixel Bender™ technology | ||
together with Canvas by having the bitmaps processed by | ||
Adobe® Flash™. This tool is not endorsed or supported by Adobe®. | ||
Version: 0.2 | ||
Author: Mario Klingemann | ||
Contact: [email protected] | ||
Website: http://www.quasimondo.com/PixelBenderForCanvas | ||
Copyright (c) 2010 Mario Klingemann | ||
Permission is hereby granted, free of charge, to any person | ||
obtaining a copy of this software and associated documentation | ||
files (the "Software"), to deal in the Software without | ||
restriction, including without limitation the rights to use, | ||
copy, modify, merge, publish, distribute, sublicense, and/or sell | ||
copies of the Software, and to permit persons to whom the | ||
Software is furnished to do so, subject to the following | ||
conditions: | ||
The above copyright notice and this permission notice shall be | ||
included in all copies or substantial portions of the Software. | ||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, | ||
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES | ||
OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND | ||
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT | ||
HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, | ||
WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING | ||
FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR | ||
OTHER DEALINGS IN THE SOFTWARE. | ||
*/ | ||
|
||
var PibecaEngine; | ||
var PibecaLookup; | ||
|
||
function initPibeca() | ||
{ | ||
PibecaEngine = document.getElementById( "Pibeca" ); | ||
PibecaLookup = []; | ||
for ( var i = 0; i < 256; i++ ) | ||
{ | ||
PibecaLookup[i] = String.fromCharCode(i); | ||
} | ||
PibecaLookup[0] = String.fromCharCode(1) + String.fromCharCode(1); | ||
PibecaLookup[1] = String.fromCharCode(1) + String.fromCharCode(2); | ||
} | ||
|
||
function filterImage( bitmapID, imageID, canvasID, kernelURL, parameters ) | ||
{ | ||
var img = document.getElementById( imageID ); | ||
var w = img.naturalWidth; | ||
var h = img.naturalHeight; | ||
|
||
var canvas = document.getElementById( canvasID ); | ||
|
||
canvas.style.width = w + "px"; | ||
canvas.style.height = h + "px"; | ||
canvas.width = w; | ||
canvas.height = h; | ||
|
||
var context = canvas.getContext("2d"); | ||
context.clearRect( 0, 0, w, h ); | ||
context.drawImage( img, 0, 0 ); | ||
|
||
filterCanvas( bitmapID, canvasID, 0, 0, w, h, kernelURL, parameters ); | ||
} | ||
|
||
|
||
function filterCanvas( bitmapID, id, x, y, width, height, kernelURL, parameters ) | ||
{ | ||
if ( PibecaEngine == null ) initPibeca(); | ||
|
||
if ( !PibecaEngine.hasBitmap( bitmapID ) ) | ||
{ | ||
var canvas = document.getElementById( id ); | ||
try { | ||
var dataURL = canvas.toDataURL("image/png"); | ||
PibecaEngine.setPNG( bitmapID, dataURL.substr(dataURL.indexOf(","))); | ||
} catch(e) { | ||
var context = canvas.getContext("2d"); | ||
|
||
var imageData; | ||
try { | ||
try { | ||
imageData = context.getImageData( x, y, width, height ); | ||
} catch(e) { | ||
netscape.security.PrivilegeManager.enablePrivilege("UniversalBrowserRead"); | ||
imageData = context.getImageData( x, y, width, height ); | ||
} | ||
} catch(e) { | ||
throw new Error("unable to access image data: " + e); | ||
} | ||
|
||
var iData = imageData.data; | ||
var data = ""; | ||
for ( var i = 0; i < iData.length; i+=4 ) | ||
{ | ||
data += PibecaLookup[iData[i+3]]; | ||
data += PibecaLookup[iData[i]]; | ||
data += PibecaLookup[iData[i+1]]; | ||
data += PibecaLookup[iData[i+2]]; | ||
} | ||
|
||
PibecaEngine.setBitmap( bitmapID, width, height, data ); | ||
|
||
} | ||
} | ||
|
||
PibecaEngine.runFilter( bitmapID, id, x, y, kernelURL, parameters ); | ||
|
||
} | ||
|
||
function onFilterComplete( canvasID, x, y, width, height, data ) | ||
{ | ||
var d; | ||
var j = 0; | ||
var i = 0; | ||
var rpl = [0,0,1]; | ||
|
||
var cvs = document.getElementById( canvasID ); | ||
var context = cvs.getContext("2d"); | ||
var imageData = context.createImageData( width, height ); | ||
var iData = imageData.data; | ||
while ( i < data.length ) | ||
{ | ||
iData[j++] = ( ( d = data.charCodeAt(i++) ) != 1 ? d : rpl[ data.charCodeAt(i++) ] ); | ||
} | ||
|
||
context.putImageData( imageData, x ,y ); | ||
} | ||
|
||
function flashLog( msg ) | ||
{ | ||
alert(msg); | ||
} |
Binary file not shown.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file not shown.
Binary file not shown.
Oops, something went wrong.