diff options
| -rwxr-xr-x | static/dump.css | 10 | ||||
| -rwxr-xr-x | static/index.html | 3 | ||||
| -rwxr-xr-x | static/js/pichat.js | 2 | ||||
| -rw-r--r-- | static/urlbutton.png | bin | 3288 -> 2879 bytes | |||
| -rw-r--r-- | static/webcam/webcam.js | 3 | ||||
| -rw-r--r-- | static/webcam/webcam.swf | bin | 17076 -> 18933 bytes | |||
| -rwxr-xr-x | template/chat.st | 4 | ||||
| -rwxr-xr-x | template/head.st | 3 | ||||
| -rwxr-xr-x | template/profile.st | 2 | ||||
| -rw-r--r-- | webcam/Webcam.as | 2 | ||||
| -rw-r--r-- | webcam/Webcam.fla | bin | 55808 -> 57344 bytes | |||
| -rwxr-xr-x | webcam/com/neave/webcam/NeaveWebcam.as | 2 | ||||
| -rwxr-xr-x | webcam/com/neave/webcam/effects/EffectType.as | 2 | ||||
| -rwxr-xr-x | webcam/com/neave/webcam/effects/EffectsManager.as | 2 | ||||
| -rw-r--r-- | webcam/webcam.swf | bin | 17076 -> 18552 bytes |
15 files changed, 29 insertions, 6 deletions
diff --git a/static/dump.css b/static/dump.css index 36f3231..f8bbe30 100755 --- a/static/dump.css +++ b/static/dump.css @@ -61,6 +61,16 @@ right:2; bottom:30; } +#effects-msg{ +position:fixed; +bottom:68; +z-index:1111; +right:38; +font-size:15; +color:#fff; +text-shadow: #000 1px 1px 1px; + +} #footerc { text-align:center; diff --git a/static/index.html b/static/index.html index b1d650c..badf35a 100755 --- a/static/index.html +++ b/static/index.html @@ -2,6 +2,9 @@ "http://www.w3.org/TR/html4/strict.dtd"> <html><head> +<title>dump.fm</title> + <META NAME="keywords" CONTENT="dump.fm, image chat, realtime, internet 3.0, dump, dump fm, image dump, pictures, image links, image board"> +<META NAME="description" CONTENT="Talk with pictures!"> <script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.4/jquery.min.js"></script> <script type="text/javascript" src="/static/js/sha1.js"></script> <script type="text/javascript" src="/static/js/home.js"></script> diff --git a/static/js/pichat.js b/static/js/pichat.js index 8211168..4d4ed17 100755 --- a/static/js/pichat.js +++ b/static/js/pichat.js @@ -129,7 +129,7 @@ function submitMessage() { var content = $.trim($('#msgInput').val()); $('#msgInput').val(''); if (content == '') { return; } - if (content.length > 6666) { + if (content.length > 1000) { alert("POST TOO LONG DUDE!"); return; } // this shouldn't just be client side :V diff --git a/static/urlbutton.png b/static/urlbutton.png Binary files differindex ef5ab64..1fc486b 100644 --- a/static/urlbutton.png +++ b/static/urlbutton.png diff --git a/static/webcam/webcam.js b/static/webcam/webcam.js index 42af499..f2e287b 100644 --- a/static/webcam/webcam.js +++ b/static/webcam/webcam.js @@ -56,12 +56,15 @@ window.webcam = { $("body").append(camHtml) $("#webcam-button-upload").addClass("invisible") $("#webcam-button-snap").removeClass("invisible") + $("#effects-msg").removeClass("invisible").fadeOut(70000) + blinkStart() }, hide: function() { $("#webcam-button-snap").addClass("invisible") $("#webcam-button-upload").removeClass("invisible") + $("#effects-msg").addClass("invisible") blinkStop() $("#webcam-preview").remove() }, diff --git a/static/webcam/webcam.swf b/static/webcam/webcam.swf Binary files differindex 823f276..ce7b114 100644 --- a/static/webcam/webcam.swf +++ b/static/webcam/webcam.swf diff --git a/template/chat.st b/template/chat.st index 090c9e5..c903a39 100755 --- a/template/chat.st +++ b/template/chat.st @@ -1,6 +1,8 @@ <html> <head> <title>dump.fm</title> + <META NAME="keywords" CONTENT="dump.fm, image chat, realtime, internet 3.0, dump, dump fm, image dump, pictures, image links, image board"> +<META NAME="description" CONTENT="Talk with pictures!"> $head()$ $if(!user_avatar)$ <link rel="stylesheet" type="text/css" href="/static/css/dumpnewuser.css"> @@ -80,7 +82,7 @@ function pop(url) <input id="webcam-button-upload" value="Webcam" type="submit"> <input id="webcam-button-snap" value="Send Pic" type="submit" class="invisible blink"> <div id="trophy"><a href="javascript:pop('http://www.likeneveralways.com/trash/count/index.php');"class="tooltip" title="Contest Counter"><img src="/static/trophyicon.gif"></a></div> - </div> + </div><div id="effects-msg"class="invisible">click on your face for effects!</div> $else$ <div id="msgInputDiv"> diff --git a/template/head.st b/template/head.st index af2eda6..20192f8 100755 --- a/template/head.st +++ b/template/head.st @@ -1,6 +1,7 @@ <meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> +<META NAME="keywords" CONTENT="dump.fm, image chat, realtime, internet 3.0, dump, dump fm, image dump, pictures, image links, image board"> +<META NAME="description" CONTENT="Talk with pictures!"> <script type="text/javascript" src="/static/jquery-1.4.2.min.js"></script> -<!-- <script type="text/javascript" src="/static/jquery.min.js"></script> --> <script type="text/javascript" src="/static/js/sha1.js"></script> <script type="text/javascript" src="/static/js/pichat.js"></script> <script type="text/javascript" src="/static/js/jquery.lavalamp.js"></script> diff --git a/template/profile.st b/template/profile.st index e4dd467..918e659 100755 --- a/template/profile.st +++ b/template/profile.st @@ -1,6 +1,8 @@ <html> <head> <title>$nick$'s dump.fm</title> + <META NAME="keywords" CONTENT="dump.fm, image chat, realtime, internet 3.0, dump, dump fm, image dump, pictures, image links, image board"> +<META NAME="description" CONTENT="Talk with pictures!"> $head()$ <link rel="stylesheet" type="text/css" media="screen" href="/static/css/profile.css"> <script src="/static/js/jquery.editinplace.1.0.1.packed.js" type="text/javascript"></script> diff --git a/webcam/Webcam.as b/webcam/Webcam.as index e7aa3c0..2077672 100644 --- a/webcam/Webcam.as +++ b/webcam/Webcam.as @@ -1 +1 @@ -package {
/* JPEGCam v1.0.8 */
/* Webcam library for capturing JPEG images and submitting to a server */
/* Copyright (c) 2008 - 2009 Joseph Huckaby <jhuckaby@goldcartridge.com> */
/* Licensed under the GNU Lesser Public License */
/* http://www.gnu.org/licenses/lgpl.html */
import flash.display.*;
import flash.events.*;
import flash.utils.*;
import flash.media.Camera;
import flash.media.Video;
import flash.external.ExternalInterface;
import flash.net.*;
import flash.system.Security;
import flash.system.SecurityPanel;
import flash.media.Sound;
import flash.media.SoundChannel;
import flash.geom.Matrix;
import com.adobe.images.JPGEncoder;
import com.marstonstudio.UploadPostHelper;
import com.neave.media.*;
import com.neave.webcam.*;
import com.neave.webcam.effects.*
[SWF(width="320", height="240", frameRate="31", backgroundColor="0x000000")]
public class Webcam extends Sprite {
private var video:Video;
private var webcam:NeaveWebcam;
private var encoder:JPGEncoder;
private var snd:Sound;
private var channel:SoundChannel = new SoundChannel();
private var jpeg_quality:int;
private var video_width:int;
private var video_height:int;
private var server_width:int;
private var server_height:int;
private var camera:Camera;
private var bmp:Bitmap;
private var bmpdata:BitmapData;
private var url:String;
private var form_data:Object;
public function Webcam() {
// class constructor
flash.system.Security.allowDomain("*");
var flashvars:Object = LoaderInfo(this.root.loaderInfo).parameters;
video_width = Math.floor( flashvars.width );
video_height = Math.floor( flashvars.height );
server_width = Math.floor( flashvars.server_width );
server_height = Math.floor( flashvars.server_height );
form_data = {};
stage.scaleMode = StageScaleMode.NO_SCALE;
// stage.scaleMode = StageScaleMode.EXACT_FIT;
stage.align = StageAlign.TOP_LEFT;
stage.stageWidth = Math.max(video_width, server_width);
stage.stageHeight = Math.max(video_height, server_height);
// Hack to auto-select iSight camera on Mac (JPEGCam Issue #5, submitted by manuel.gonzalez.noriega)
// From: http://www.squidder.com/2009/03/09/trick-auto-select-mac-isight-in-flash/
var cameraIdx:int = -1;
for (var idx = 0, len = Camera.names.length; idx < len; idx++) {
if (Camera.names[idx] == "USB Video Class Video") {
cameraIdx = idx;
idx = len;
}
}
if (cameraIdx > -1) camera = Camera.getCamera( String(cameraIdx) );
else camera = Camera.getCamera();
if (camera != null) {
camera.addEventListener(ActivityEvent.ACTIVITY, activityHandler);
video = new Video( Math.max(video_width, server_width), Math.max(video_height, server_height) );
video.attachCamera(camera);
webcam = new NeaveWebcam(NeaveCamera.getCamera(), true);
addChild(webcam);
if ((video_width < server_width) && (video_height < server_height)) {
video.scaleX = video_width / server_width;
video.scaleY = video_height / server_height;
}
camera.setQuality(0, 100);
camera.setKeyFrameInterval(10);
camera.setMode( Math.max(video_width, server_width), Math.max(video_height, server_height), 30);
// do not detect motion (may help reduce CPU usage)
camera.setMotionLevel( 100 );
ExternalInterface.addCallback('_snap', snap);
ExternalInterface.addCallback('_configure', configure);
ExternalInterface.addCallback('_upload', upload);
ExternalInterface.addCallback('_reset', reset);
ExternalInterface.addCallback('_set_form_data', set_form_data);
if (flashvars.shutter_enabled == 1) {
snd = new Sound();
snd.load( new URLRequest( flashvars.shutter_url ) );
}
jpeg_quality = 90;
ExternalInterface.call('webcam.flash_notify', 'flashLoadComplete', true);
}
else {
trace("You need a camera.");
ExternalInterface.call('webcam.flash_notify', "error", "No camera was detected.");
}
}
public function set_quality(new_quality:int) {
// set JPEG image quality
if (new_quality < 0) new_quality = 0;
if (new_quality > 100) new_quality = 100;
jpeg_quality = new_quality;
}
public function set_form_data(new_form_data:Object) {
form_data = new_form_data;
}
public function configure(panel:String = SecurityPanel.CAMERA) {
// show configure dialog inside flash movie
Security.showSettings(panel);
}
private function activityHandler(event:ActivityEvent):void {
trace("activityHandler: " + event);
}
public function snap(url, new_quality, shutter) {
// take snapshot from camera, and upload if URL was provided
if (new_quality) set_quality(new_quality);
trace("in snap(), drawing to bitmap");
if (shutter) {
channel = snd.play();
setTimeout( snap2, 10, url );
}
else snap2(url);
}
public function snap2(url) {
// take snapshot, convert to jpeg, submit to server
bmpdata = new BitmapData( Math.max(video_width, server_width), Math.max(video_height, server_height) );
bmpdata.draw( webcam.effectBitmap );
// draw snapshot on stage
bmp = new Bitmap( bmpdata );
bmp.scaleX = -1;
addChild( bmp );
// stop capturing video
//video.attachCamera( null );
//removeChild( video );
// if URL was provided, upload now
if (url) upload( url );
}
public function upload(url) {
if (bmpdata) {
if ((video_width > server_width) && (video_height > server_height)) {
// resize image downward before submitting
var tmpdata = new BitmapData(server_width, server_height);
var matrix = new Matrix();
matrix.scale( server_width / video_width, server_height / video_height );
tmpdata.draw( bmpdata, matrix, null, null, null, true ); // smoothing
bmpdata = tmpdata;
} // need resize
trace("converting to jpeg");
var ba:ByteArray;
encoder = new JPGEncoder( jpeg_quality );
ba = encoder.encode( bmpdata );
trace("jpeg length: " + ba.length);
//URLRequest containing the form fields and the attached image
var req : URLRequest = new URLRequest(url);
req.method = URLRequestMethod.POST;
req.data = UploadPostHelper.getPostData( 'dump.fm.webcam.test.jpg', ba, form_data );
req.requestHeaders.push(new URLRequestHeader('Cache-Control', 'no-cache') );
req.requestHeaders.push(new URLRequestHeader('Content-Type', 'multipart/form-data; boundary=' + UploadPostHelper.getBoundary()));
//URLLoader to load the request
var loader : URLLoader = new URLLoader();
loader.dataFormat = URLLoaderDataFormat.BINARY;
loader.addEventListener(Event.COMPLETE, onLoaded);
trace("sending post to: " + url);
try {
loader.load(req);
}
catch (error:Error) {
trace("Unable to load requested document.");
ExternalInterface.call('webcam.flash_notify', "error", "Unable to post data: " + error);
}
}
else {
ExternalInterface.call('webcam.flash_notify', "error", "Nothing to upload, must capture an image first.");
}
}
public function onLoaded(evt:Event):void {
// image upload complete
var msg = "unknown";
if (evt && evt.target && evt.target.data) msg = evt.target.data;
ExternalInterface.call('webcam.flash_notify', "success", msg);
}
public function reset() {
// reset video after taking snapshot
if (bmp) {
removeChild( bmp );
bmp = null;
bmpdata = null;
/*video.attachCamera(camera);
addChild(video);*/
}
}
}
}
\ No newline at end of file +package {
/* JPEGCam v1.0.8 */
/* Webcam library for capturing JPEG images and submitting to a server */
/* Copyright (c) 2008 - 2009 Joseph Huckaby <jhuckaby@goldcartridge.com> */
/* Licensed under the GNU Lesser Public License */
/* http://www.gnu.org/licenses/lgpl.html */
import flash.display.*;
import flash.events.*;
import flash.utils.*;
import flash.media.Camera;
import flash.media.Video;
import flash.external.ExternalInterface;
import flash.net.*;
import flash.system.Security;
import flash.system.SecurityPanel;
import flash.media.Sound;
import flash.media.SoundChannel;
import flash.geom.Matrix;
import com.adobe.images.JPGEncoder;
import com.marstonstudio.UploadPostHelper;
import com.neave.media.*;
import com.neave.webcam.*;
import com.neave.webcam.effects.*
[SWF(width="320", height="240", frameRate="31", backgroundColor="0x000000")]
public class Webcam extends Sprite {
private var video:Video;
private var webcam:NeaveWebcam;
private var encoder:JPGEncoder;
private var snd:Sound;
private var channel:SoundChannel = new SoundChannel();
private var jpeg_quality:int;
private var video_width:int;
private var video_height:int;
private var server_width:int;
private var server_height:int;
private var camera:Camera;
private var bmp:Bitmap;
private var bmpdata:BitmapData;
private var url:String;
private var form_data:Object;
public function Webcam() {
// class constructor
flash.system.Security.allowDomain("*");
var flashvars:Object = LoaderInfo(this.root.loaderInfo).parameters;
video_width = Math.floor( flashvars.width );
video_height = Math.floor( flashvars.height );
server_width = Math.floor( flashvars.server_width );
server_height = Math.floor( flashvars.server_height );
form_data = {};
stage.scaleMode = StageScaleMode.NO_SCALE;
// stage.scaleMode = StageScaleMode.EXACT_FIT;
stage.align = StageAlign.TOP_LEFT;
stage.stageWidth = Math.max(video_width, server_width);
stage.stageHeight = Math.max(video_height, server_height);
// Hack to auto-select iSight camera on Mac (JPEGCam Issue #5, submitted by manuel.gonzalez.noriega)
// From: http://www.squidder.com/2009/03/09/trick-auto-select-mac-isight-in-flash/
var cameraIdx:int = -1;
for (var idx = 0, len = Camera.names.length; idx < len; idx++) {
if (Camera.names[idx] == "USB Video Class Video") {
cameraIdx = idx;
idx = len;
}
}
if (cameraIdx > -1) camera = Camera.getCamera( String(cameraIdx) );
else camera = Camera.getCamera();
if (camera != null) {
camera.addEventListener(ActivityEvent.ACTIVITY, activityHandler);
video = new Video( Math.max(video_width, server_width), Math.max(video_height, server_height) );
video.attachCamera(camera);
webcam = new NeaveWebcam(camera, true);
addChild(webcam);
if ((video_width < server_width) && (video_height < server_height)) {
video.scaleX = video_width / server_width;
video.scaleY = video_height / server_height;
}
camera.setQuality(0, 100);
camera.setKeyFrameInterval(10);
camera.setMode( Math.max(video_width, server_width), Math.max(video_height, server_height), 30);
// do not detect motion (may help reduce CPU usage)
camera.setMotionLevel( 100 );
ExternalInterface.addCallback('_snap', snap);
ExternalInterface.addCallback('_configure', configure);
ExternalInterface.addCallback('_upload', upload);
ExternalInterface.addCallback('_reset', reset);
ExternalInterface.addCallback('_set_form_data', set_form_data);
if (flashvars.shutter_enabled == 1) {
snd = new Sound();
snd.load( new URLRequest( flashvars.shutter_url ) );
}
jpeg_quality = 90;
ExternalInterface.call('webcam.flash_notify', 'flashLoadComplete', true);
}
else {
trace("You need a camera.");
ExternalInterface.call('webcam.flash_notify', "error", "No camera was detected.");
}
}
public function set_quality(new_quality:int) {
// set JPEG image quality
if (new_quality < 0) new_quality = 0;
if (new_quality > 100) new_quality = 100;
jpeg_quality = new_quality;
}
public function set_form_data(new_form_data:Object) {
form_data = new_form_data;
}
public function configure(panel:String = SecurityPanel.CAMERA) {
// show configure dialog inside flash movie
Security.showSettings(panel);
}
private function activityHandler(event:ActivityEvent):void {
trace("activityHandler: " + event);
}
public function snap(url, new_quality, shutter) {
// take snapshot from camera, and upload if URL was provided
if (new_quality) set_quality(new_quality);
trace("in snap(), drawing to bitmap");
if (shutter) {
channel = snd.play();
setTimeout( snap2, 10, url );
}
else snap2(url);
}
public function snap2(url) {
// take snapshot, convert to jpeg, submit to server
bmpdata = new BitmapData( Math.max(video_width, server_width), Math.max(video_height, server_height) );
bmpdata.draw( webcam.effectBitmap );
// draw snapshot on stage
bmp = new Bitmap( bmpdata );
bmp.scaleX = -1;
addChild( bmp );
// stop capturing video
//video.attachCamera( null );
//removeChild( video );
// if URL was provided, upload now
if (url) upload( url );
}
public function upload(url) {
if (bmpdata) {
if ((video_width > server_width) && (video_height > server_height)) {
// resize image downward before submitting
var tmpdata = new BitmapData(server_width, server_height);
var matrix = new Matrix();
matrix.scale( server_width / video_width, server_height / video_height );
tmpdata.draw( bmpdata, matrix, null, null, null, true ); // smoothing
bmpdata = tmpdata;
} // need resize
trace("converting to jpeg");
var ba:ByteArray;
encoder = new JPGEncoder( jpeg_quality );
ba = encoder.encode( bmpdata );
trace("jpeg length: " + ba.length);
//URLRequest containing the form fields and the attached image
var req : URLRequest = new URLRequest(url);
req.method = URLRequestMethod.POST;
req.data = UploadPostHelper.getPostData( 'dump.fm.webcam.test.jpg', ba, form_data );
req.requestHeaders.push(new URLRequestHeader('Cache-Control', 'no-cache') );
req.requestHeaders.push(new URLRequestHeader('Content-Type', 'multipart/form-data; boundary=' + UploadPostHelper.getBoundary()));
//URLLoader to load the request
var loader : URLLoader = new URLLoader();
loader.dataFormat = URLLoaderDataFormat.BINARY;
loader.addEventListener(Event.COMPLETE, onLoaded);
trace("sending post to: " + url);
try {
loader.load(req);
}
catch (error:Error) {
trace("Unable to load requested document.");
ExternalInterface.call('webcam.flash_notify', "error", "Unable to post data: " + error);
}
}
else {
ExternalInterface.call('webcam.flash_notify', "error", "Nothing to upload, must capture an image first.");
}
}
public function onLoaded(evt:Event):void {
// image upload complete
var msg = "unknown";
if (evt && evt.target && evt.target.data) msg = evt.target.data;
ExternalInterface.call('webcam.flash_notify', "success", msg);
}
public function reset() {
// reset video after taking snapshot
if (bmp) {
removeChild( bmp );
bmp = null;
bmpdata = null;
/*video.attachCamera(camera);
addChild(video);*/
}
}
}
}
\ No newline at end of file diff --git a/webcam/Webcam.fla b/webcam/Webcam.fla Binary files differindex 1447fb4..c760857 100644 --- a/webcam/Webcam.fla +++ b/webcam/Webcam.fla diff --git a/webcam/com/neave/webcam/NeaveWebcam.as b/webcam/com/neave/webcam/NeaveWebcam.as index 811446b..5372ad5 100755 --- a/webcam/com/neave/webcam/NeaveWebcam.as +++ b/webcam/com/neave/webcam/NeaveWebcam.as @@ -72,6 +72,8 @@ package com.neave.webcam // Create a sprite to hold the bitmap
videoContainer = new Sprite();
videoContainer.addChild(videoBitmap);
+ videoContainer.scaleX = -1;
+ videoContainer.x = w;
addChild(videoContainer);
}
diff --git a/webcam/com/neave/webcam/effects/EffectType.as b/webcam/com/neave/webcam/effects/EffectType.as index 217dcb5..3c9967d 100755 --- a/webcam/com/neave/webcam/effects/EffectType.as +++ b/webcam/com/neave/webcam/effects/EffectType.as @@ -1 +1 @@ -/**
* Neave Webcam // Effects Type
*
* Copyright (C) 2008 Paul Neave
* http://www.neave.com/
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation at http://www.gnu.org/licenses/gpl.html
*/
package com.neave.webcam.effects
{
final public class EffectType
{
static public const NORMAL :int = 0;
static public const RAINBOW :int = 1;
//static public const MIRROR_RIGHT :int = 2;
//static public const MIRROR_TOP :int = 3;
//static public const MIRROR_BOTTOM :int = 2;
static public const MIRROR_INVERSE :int = 2;
//static public const MIRROR_QUAD :int = 6;
static public const UPSIDE_DOWN :int = 3;
//static public const DIVIDE :int = 8;
//static public const FILMSTRIP :int = 9;
static public const FRAGMENT :int = 4;
static public const SEPIA :int = 5;
//static public const TRAIL :int = 12;
//static public const BULGE :int = 13;
//static public const FISHEYE :int = 14;
//static public const FISHBOWL :int = 15;
//static public const DENT :int = 16;
///static public const SQUEEZE :int = 17;
static public const WATER :int = 6;
static public const FIRE :int = 7;
static public const SNOW :int = 8;
//static public const STEAM :int = 21;
static public const SWARM :int = 9;
//static public const PIXELATE :int = 23;
//static public const RGB :int = 24;
//static public const HALFTONE :int = 25;
static public const MONOCHROME :int = 10;
static public const GHOST :int = 11;
static public const MIRROR_LEFT :int = 12;
//static public const ASCII :int = 14;
//static public const X_RAY :int = 30;
//static public const WARHOL :int = 31;
static public const GLOW :int = 13;
static public const SLIT_SCAN :int = 14;
static public const TOTAL_EFFECTS :int = 14;
public function EffectType() { }
}
}
\ No newline at end of file +/**
* Neave Webcam // Effects Type
*
* Copyright (C) 2008 Paul Neave
* http://www.neave.com/
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation at http://www.gnu.org/licenses/gpl.html
*/
package com.neave.webcam.effects
{
final public class EffectType
{
/*static public const NORMAL :int = 0;
static public const RAINBOW :int = 1;
//static public const MIRROR_RIGHT :int = 2;
//static public const MIRROR_TOP :int = 3;
//static public const MIRROR_BOTTOM :int = 2;
static public const MIRROR_INVERSE :int = 2;
//static public const MIRROR_QUAD :int = 6;
static public const UPSIDE_DOWN :int = 3;
//static public const DIVIDE :int = 8;
//static public const FILMSTRIP :int = 9;
static public const FRAGMENT :int = 4;
static public const SEPIA :int = 5;
//static public const TRAIL :int = 12;
//static public const BULGE :int = 13;
//static public const FISHEYE :int = 14;
//static public const FISHBOWL :int = 15;
//static public const DENT :int = 16;
///static public const SQUEEZE :int = 17;
static public const WATER :int = 6;
static public const FIRE :int = 7;
static public const SNOW :int = 8;
//static public const STEAM :int = 21;
static public const SWARM :int = 9;
//static public const PIXELATE :int = 23;
//static public const RGB :int = 24;
//static public const HALFTONE :int = 25;
static public const MONOCHROME :int = 10;
static public const GHOST :int = 11;
static public const MIRROR_LEFT :int = 12;
//static public const ASCII :int = 14;
//static public const X_RAY :int = 30;
//static public const WARHOL :int = 31;
static public const GLOW :int = 13;
static public const SLIT_SCAN :int = 14;*/
static public const NORMAL :int = 0;
static public const GLOW :int = 1;
static public const WARHOL :int = 2;
static public const HALFTONE :int = 3;
static public const SEPIA :int = 4;
static public const MONOCHROME :int = 5;
static public const X_RAY :int = 6;
static public const DIVIDE :int = 7;
static public const SLIT_SCAN :int = 8;
static public const MIRROR_INVERSE :int = 9;
static public const MIRROR_TOP :int = 10;
static public const UPSIDE_DOWN :int = 11;
static public const MIRROR_LEFT :int = 12;
static public const BULGE :int = 13;
static public const SQUEEZE :int = 14;
static public const FISHEYE :int = 15;
static public const GHOST :int = 16;
static public const TRAIL :int = 17;
static public const WATER :int = 18;
static public const SNOW :int = 19;
static public const FIRE :int = 20;
static public const SWARM :int = 21;
static public const TOTAL_EFFECTS :int = 21;
public function EffectType() { }
}
}
\ No newline at end of file diff --git a/webcam/com/neave/webcam/effects/EffectsManager.as b/webcam/com/neave/webcam/effects/EffectsManager.as index a5fa050..0c898c8 100755 --- a/webcam/com/neave/webcam/effects/EffectsManager.as +++ b/webcam/com/neave/webcam/effects/EffectsManager.as @@ -1 +1 @@ -/**
* Neave Webcam // Effects Manager
*
* Copyright (C) 2008 Paul Neave
* http://www.neave.com/
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation at http://www.gnu.org/licenses/gpl.html
*/
package com.neave.webcam.effects
{
import flash.display.*;
import flash.events.*;
import com.neave.webcam.effects.color.*;
import com.neave.webcam.effects.delay.*;
import com.neave.webcam.effects.displace.*;
import com.neave.webcam.effects.mirror.*;
import com.neave.webcam.effects.motion.*;
import com.neave.webcam.effects.pixel.*;
public class EffectsManager extends EventDispatcher
{
private var source:IBitmapDrawable;
private var targetBitmap:BitmapData;
private var effect:AbstractEffect;
private var chosenEffect:int;
/**
* Manages all of the webcam effects
*
* @param source The source object to use for the effect
* @param targetBitmap The target bitmap data to draw the resulting effect into
*/
public function EffectsManager(source:IBitmapDrawable, targetBitmap:BitmapData)
{
this.source = source;
this.targetBitmap = targetBitmap;
// Start with the normal effect
effectType = EffectType.NORMAL;
}
/**
* Sets the effect to the next effect in the EffectType class
*/
public function nextEffect():void
{
effectType = chosenEffect + 1;
}
/**
* Sets the effect to the previous effect in the EffectType class
*/
public function previousEffect():void
{
effectType = chosenEffect - 1;
}
/**
* An integer representing the current effect in the EffectType class
*/
public function set effectType(type:int):void
{
// Remove the previous effect
if (effect != null) effect.destroy();
// Wrap the chosen effect within the total effects available
if (type > EffectType.TOTAL_EFFECTS) type = 0;
if (type < 0) type = EffectType.TOTAL_EFFECTS;
// Set the effect
switch (type)
{
case EffectType.MIRROR_LEFT: effect = new LeftMirrorEffect (source, targetBitmap); break;
//case EffectType.MIRROR_RIGHT: effect = new RightMirrorEffect (source, targetBitmap); break;
//case EffectType.MIRROR_TOP: effect = new TopMirrorEffect (source, targetBitmap); break;
//case EffectType.MIRROR_BOTTOM: effect = new BottomMirrorEffect (source, targetBitmap); break;
case EffectType.MIRROR_INVERSE: effect = new InverseMirrorEffect (source, targetBitmap); break;
//case EffectType.MIRROR_QUAD: effect = new QuadMirrorEffect (source, targetBitmap); break;
case EffectType.UPSIDE_DOWN: effect = new UpsideDownEffect (source, targetBitmap); break;
//case EffectType.DIVIDE: effect = new DivideEffect (source, targetBitmap); break;
//case EffectType.FILMSTRIP: effect = new FilmstripEffect (source, targetBitmap); break;
case EffectType.FRAGMENT: effect = new FragmentEffect (source, targetBitmap); break;
case EffectType.GHOST: effect = new GhostEffect (source, targetBitmap); break;
//case EffectType.TRAIL: effect = new TrailEffect (source, targetBitmap); break;
//case EffectType.BULGE: effect = new BulgeEffect (source, targetBitmap); break;
//case EffectType.FISHEYE: effect = new FisheyeEffect (source, targetBitmap); break;
//case EffectType.FISHBOWL: effect = new FishbowlEffect (source, targetBitmap); break;
//case EffectType.DENT: effect = new DentEffect (source, targetBitmap); break;
//case EffectType.SQUEEZE: effect = new SqueezeEffect (source, targetBitmap); break;
case EffectType.WATER: effect = new WaterEffect (source, targetBitmap); break;
case EffectType.FIRE: effect = new FireEffect (source, targetBitmap); break;
case EffectType.SNOW: effect = new SnowEffect (source, targetBitmap); break;
//case EffectType.STEAM: effect = new SteamEffect (source, targetBitmap); break;
case EffectType.SWARM: effect = new SwarmEffect (source, targetBitmap); break;
//case EffectType.PIXELATE: effect = new PixelateEffect (source, targetBitmap); break;
//case EffectType.RGB: effect = new RGBEffect (source, targetBitmap); break;
//case EffectType.HALFTONE: effect = new HalftoneEffect (source, targetBitmap); break;
case EffectType.MONOCHROME: effect = new MonochromeEffect (source, targetBitmap); break;
case EffectType.SEPIA: effect = new SepiaEffect (source, targetBitmap); break;
case EffectType.RAINBOW: effect = new RainbowEffect (source, targetBitmap); break;
//case EffectType.ASCII: effect = new ASCIIEffect (source, targetBitmap); break;
//case EffectType.X_RAY: effect = new XRayEffect (source, targetBitmap); break;
//case EffectType.WARHOL: effect = new WarholEffect (source, targetBitmap); break;
case EffectType.GLOW: effect = new GlowEffect (source, targetBitmap); break;
case EffectType.SLIT_SCAN: effect = new SlitScanEffect (source, targetBitmap); break;
case EffectType.NORMAL:
default:
// Use a normal effect if the passed effect type is not valid
type = EffectType.NORMAL;
effect = new NormalEffect(source, targetBitmap);
break;
}
// Remember the chosen effect
chosenEffect = type;
// Tell anything listening that a new effect has been chosen
dispatchEvent(new EffectEvent(EffectEvent.NEW_EFFECT, false, false, chosenEffect));
}
/**
* An integer representing the current effect in the EffectType class
*/
public function get effectType():int
{
return chosenEffect;
}
/**
* The proper name of the current effect
*/
public function get effectName():String
{
return effect.effectName;
}
/**
* Updates the appearance of the current effect
*/
public function update():void
{
effect.draw();
}
/**
* Removes the current effect
*/
public function destroy():void
{
effect.destroy();
}
}
}
\ No newline at end of file +/**
* Neave Webcam // Effects Manager
*
* Copyright (C) 2008 Paul Neave
* http://www.neave.com/
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation at http://www.gnu.org/licenses/gpl.html
*/
package com.neave.webcam.effects
{
import flash.display.*;
import flash.events.*;
import com.neave.webcam.effects.color.*;
import com.neave.webcam.effects.delay.*;
import com.neave.webcam.effects.displace.*;
import com.neave.webcam.effects.mirror.*;
import com.neave.webcam.effects.motion.*;
import com.neave.webcam.effects.pixel.*;
public class EffectsManager extends EventDispatcher
{
private var source:IBitmapDrawable;
private var targetBitmap:BitmapData;
private var effect:AbstractEffect;
private var chosenEffect:int;
/**
* Manages all of the webcam effects
*
* @param source The source object to use for the effect
* @param targetBitmap The target bitmap data to draw the resulting effect into
*/
public function EffectsManager(source:IBitmapDrawable, targetBitmap:BitmapData)
{
this.source = source;
this.targetBitmap = targetBitmap;
// Start with the normal effect
effectType = EffectType.NORMAL;
}
/**
* Sets the effect to the next effect in the EffectType class
*/
public function nextEffect():void
{
effectType = chosenEffect + 1;
}
/**
* Sets the effect to the previous effect in the EffectType class
*/
public function previousEffect():void
{
effectType = chosenEffect - 1;
}
/**
* An integer representing the current effect in the EffectType class
*/
public function set effectType(type:int):void
{
// Remove the previous effect
if (effect != null) effect.destroy();
// Wrap the chosen effect within the total effects available
if (type > EffectType.TOTAL_EFFECTS) type = 0;
if (type < 0) type = EffectType.TOTAL_EFFECTS;
// Set the effect
switch (type)
{
case EffectType.GLOW: effect = new GlowEffect (source, targetBitmap); break;
case EffectType.WARHOL: effect = new WarholEffect (source, targetBitmap); break;
case EffectType.SEPIA: effect = new SepiaEffect (source, targetBitmap); break;
case EffectType.MONOCHROME: effect = new MonochromeEffect (source, targetBitmap); break;
case EffectType.X_RAY: effect = new XRayEffect (source, targetBitmap); break;
case EffectType.DIVIDE: effect = new DivideEffect (source, targetBitmap); break;
case EffectType.SLIT_SCAN: effect = new SlitScanEffect (source, targetBitmap); break;
case EffectType.MIRROR_INVERSE: effect = new InverseMirrorEffect (source, targetBitmap); break;
case EffectType.MIRROR_TOP: effect = new TopMirrorEffect (source, targetBitmap); break;
case EffectType.UPSIDE_DOWN: effect = new UpsideDownEffect (source, targetBitmap); break;
case EffectType.MIRROR_LEFT: effect = new LeftMirrorEffect (source, targetBitmap); break;
case EffectType.BULGE: effect = new BulgeEffect (source, targetBitmap); break;
case EffectType.SQUEEZE: effect = new SqueezeEffect (source, targetBitmap); break;
case EffectType.FISHEYE: effect = new FisheyeEffect (source, targetBitmap); break;
case EffectType.GHOST: effect = new GhostEffect (source, targetBitmap); break;
case EffectType.TRAIL: effect = new TrailEffect (source, targetBitmap); break;
case EffectType.WATER: effect = new WaterEffect (source, targetBitmap); break;
case EffectType.SNOW: effect = new SnowEffect (source, targetBitmap); break;
case EffectType.FIRE: effect = new FireEffect (source, targetBitmap); break;
case EffectType.SWARM: effect = new SwarmEffect (source, targetBitmap); break;
/*case EffectType.MIRROR_LEFT: effect = new LeftMirrorEffect (source, targetBitmap); break;
//case EffectType.MIRROR_RIGHT: effect = new RightMirrorEffect (source, targetBitmap); break;
//case EffectType.MIRROR_TOP: effect = new TopMirrorEffect (source, targetBitmap); break;
//case EffectType.MIRROR_BOTTOM: effect = new BottomMirrorEffect (source, targetBitmap); break;
case EffectType.MIRROR_INVERSE: effect = new InverseMirrorEffect (source, targetBitmap); break;
//case EffectType.MIRROR_QUAD: effect = new QuadMirrorEffect (source, targetBitmap); break;
case EffectType.UPSIDE_DOWN: effect = new UpsideDownEffect (source, targetBitmap); break;
//case EffectType.DIVIDE: effect = new DivideEffect (source, targetBitmap); break;
//case EffectType.FILMSTRIP: effect = new FilmstripEffect (source, targetBitmap); break;
case EffectType.FRAGMENT: effect = new FragmentEffect (source, targetBitmap); break;
case EffectType.GHOST: effect = new GhostEffect (source, targetBitmap); break;
//case EffectType.TRAIL: effect = new TrailEffect (source, targetBitmap); break;
//case EffectType.BULGE: effect = new BulgeEffect (source, targetBitmap); break;
//case EffectType.FISHEYE: effect = new FisheyeEffect (source, targetBitmap); break;
//case EffectType.FISHBOWL: effect = new FishbowlEffect (source, targetBitmap); break;
//case EffectType.DENT: effect = new DentEffect (source, targetBitmap); break;
//case EffectType.SQUEEZE: effect = new SqueezeEffect (source, targetBitmap); break;
case EffectType.WATER: effect = new WaterEffect (source, targetBitmap); break;
case EffectType.FIRE: effect = new FireEffect (source, targetBitmap); break;
case EffectType.SNOW: effect = new SnowEffect (source, targetBitmap); break;
//case EffectType.STEAM: effect = new SteamEffect (source, targetBitmap); break;
case EffectType.SWARM: effect = new SwarmEffect (source, targetBitmap); break;
//case EffectType.PIXELATE: effect = new PixelateEffect (source, targetBitmap); break;
//case EffectType.RGB: effect = new RGBEffect (source, targetBitmap); break;
//case EffectType.HALFTONE: effect = new HalftoneEffect (source, targetBitmap); break;
case EffectType.MONOCHROME: effect = new MonochromeEffect (source, targetBitmap); break;
case EffectType.SEPIA: effect = new SepiaEffect (source, targetBitmap); break;
case EffectType.RAINBOW: effect = new RainbowEffect (source, targetBitmap); break;
//case EffectType.ASCII: effect = new ASCIIEffect (source, targetBitmap); break;
//case EffectType.X_RAY: effect = new XRayEffect (source, targetBitmap); break;
//case EffectType.WARHOL: effect = new WarholEffect (source, targetBitmap); break;
case EffectType.GLOW: effect = new GlowEffect (source, targetBitmap); break;
case EffectType.SLIT_SCAN: effect = new SlitScanEffect (source, targetBitmap); break;*/
case EffectType.NORMAL:
default:
// Use a normal effect if the passed effect type is not valid
type = EffectType.NORMAL;
effect = new NormalEffect(source, targetBitmap);
break;
}
// Remember the chosen effect
chosenEffect = type;
// Tell anything listening that a new effect has been chosen
dispatchEvent(new EffectEvent(EffectEvent.NEW_EFFECT, false, false, chosenEffect));
}
/**
* An integer representing the current effect in the EffectType class
*/
public function get effectType():int
{
return chosenEffect;
}
/**
* The proper name of the current effect
*/
public function get effectName():String
{
return effect.effectName;
}
/**
* Updates the appearance of the current effect
*/
public function update():void
{
effect.draw();
}
/**
* Removes the current effect
*/
public function destroy():void
{
effect.destroy();
}
}
}
\ No newline at end of file diff --git a/webcam/webcam.swf b/webcam/webcam.swf Binary files differindex 823f276..7999270 100644 --- a/webcam/webcam.swf +++ b/webcam/webcam.swf |
