summaryrefslogtreecommitdiff
path: root/webcam/com/neave/webcam/effects/mirror/UpsideDownEffect.as
diff options
context:
space:
mode:
Diffstat (limited to 'webcam/com/neave/webcam/effects/mirror/UpsideDownEffect.as')
-rwxr-xr-xwebcam/com/neave/webcam/effects/mirror/UpsideDownEffect.as54
1 files changed, 54 insertions, 0 deletions
diff --git a/webcam/com/neave/webcam/effects/mirror/UpsideDownEffect.as b/webcam/com/neave/webcam/effects/mirror/UpsideDownEffect.as
new file mode 100755
index 0000000..71e08d8
--- /dev/null
+++ b/webcam/com/neave/webcam/effects/mirror/UpsideDownEffect.as
@@ -0,0 +1,54 @@
+/**
+ * Neave Webcam // Upside-Down Effect
+ *
+ * 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.mirror
+{
+ import flash.display.*;
+ import flash.geom.*;
+ import com.neave.webcam.effects.*;
+
+ public class UpsideDownEffect extends AbstractEffect
+ {
+ private var flipMatrix:Matrix;
+
+ /**
+ * Creates a mirror effect where the source image is flipped vertically
+ *
+ * @param source The source object to use for the effect
+ * @param targetBitmap The target bitmap data to draw the resulting effect into
+ */
+ public function UpsideDownEffect(source:IBitmapDrawable, targetBitmapData:BitmapData)
+ {
+ super(source, targetBitmapData, "Upside-Down");
+
+ createUpsideDown();
+ }
+
+ /**
+ * Sets up the upside-down effect
+ */
+ private function createUpsideDown():void
+ {
+ flipMatrix = new Matrix();
+ flipMatrix.scale(1, -1);
+ flipMatrix.translate(0, rect.height);
+ }
+
+ /**
+ * Draws the upside-down effect
+ */
+ override public function draw():void
+ {
+ super.draw();
+ targetBitmap.draw(sourceBitmap, flipMatrix);
+ }
+ }
+} \ No newline at end of file