Actionscript 3.0 :: Bitmap Data .draw() With Transform Matrix

Jun 29, 2011

Long time since i've been on here. I'm working on a project wherein a user can take a snapshot of themselves using their webcam and then edit this image by transforming scale and rotation and save the result. I've got most of it working, the user can take a snapshot of themselves, transform the object using Senocular's Transform Tool and i'm using .draw() to then save this transformed object. The problem is .draw() is only grabbing data from the top left corner of the stage. It is drawing the transformed object but only from the top left corner. Why does it only draw from the top left corner and how can i get set the coordinates to only draw from the area where the captured image is set?

[Code]....

View 2 Replies


Similar Posts:


Flash :: Bitmap Data .draw() With Transform Matrix

Jun 29, 2011

I'm working on a project wherein a user can take a snapshot of themselves using their webcam and then edit this image by transforming scale and rotation and save the result.

I've got most of it working, the user can take a snapshot of themselves, transform the object using Senocular's Transform Tool and i'm using .draw() to then save this transformed object. The problem is .draw() is only grabbing data from the top left corner of the stage. It is drawing the transformed object but only from the top left corner.

Why does it only draw from the top left corner and how can i get set the coordinates to only draw from the area where the captured image is set?

You can view the file as is at: [URL]

And i've zipped the FLA and relevant classes at [URL]

import flash.display.Bitmap;
import flash.display.BitmapData;
import flash.display.Sprite;

[Code]....

View 2 Replies

Actionscript 3 :: Get An Accurate Reading Of The Pixel Data From A Bitmap With A Matrix Transformation?

Mar 24, 2011

i've filled a circle shape with the bitmap data of a bitmap asset.i need to rotate the circle from the center, so i added the bitmap to the center of the circle and used a matrix transformation to shift the bitmapdata upward and leftward so it appears centered.
now i'm trying to read the bitmap data with getPixel() but the return value is off since it is returning the untransformed position of the bitmap data instead of the visible transformed bitmapdata.

Bitmap(Sprite(evt.currentTarget).getChildAt(0)).bitmapData.getPixel(evt.localX, evt.localY)

how can i get an accurate reading of the pixel data from a bitmap with a matrix transformation? updated with code. assume the redCircleData in my example is more colorful and something worth retrieving pixel data.

var redCircleData:Sprite = new Sprite();
redCircleData.graphics.beginFill(0xFF0000, 1.0);
redCircleData.graphics.drawCircle(0, 0, 100);[code]............

View 2 Replies

ActionScript 1/2 :: Bitmap Data Can't Draw MC With FLV

Aug 1, 2010

I've created a prototype that will copy the pixel data from a movie clip then create a JPG image from it via PHP. It works perfectly. But when the MovieClip (called mcImage) contains a Video Object loaded with a streamed FLV, it won't copy the pixel data to the Bitmap object. The image generated is white. Here's a sample code:
 
var oBitmap:BitmapData = new BitmapData(nW, nH, true);
var oMatrix = new Matrix();
var oColorTrans:ColorTransform = new ColorTransform();

[Code].....

View 4 Replies

ActionScript 3.0 :: Draw A Bitmap - Store Data?

Feb 10, 2012

How fast can I draw a bitmap? (60 htz = 60 fps right? That's what I need)Does player's visual stay in sync with the refresh rate of the monitor? I mean if I had multiple threads running in the backround but Flashplayer's priority to High would it not be interrupted (choppy)?

Do event listeners work when the user's focus is on another application? (say voice chat for example. Hit a key and BOOM. You speak. But if the user is tapped out would it pick up? Can I make an actual SAFE place I can store data? I mean, does the FileSystem have any tricks that allows only the application requesting the file to read it? I mean there's "locking" but can't all files can be unlocked? Even if they can't it doesn't take a pro to scan for all files on the system..An undetectable file

Do bitwise operations work at the same speed on all compilers? Does anyone know where that GreenThread build went? I had a good one a while ago but deleted a lot of things in confusion (in order to get that "start fresh" feeling...recovering all files as we speak) Speaking of recovering, how does File Recovery work? I hear it scans the hd sectors for file headers and pieces them together. I would like to make one (instead of using the one I have now) Is this the MAIN forum for as3? I've only been to this and flash develop (though I hear stackoverflow is good too?)

[Code]...

View 8 Replies

ActionScript 3.0 :: Resize Bitmap Data After Draw

Mar 1, 2012

So I am working on this project for work and we have a bunch of sprites with transform matrix that contain the rotation, scale, x, and y coordinates of various parts of a character, i.e arms, legs etc. so we are then drawing the individual sprites onto the same bitmap data. Then we store it in a vector and display it later.

The problem is the models are too big. So I want to resize them, without having to rebuild the entire matrix, since I don't want to go through every matrix in the sprites and manual calculate the scale, rotation, x, and y after it has been made samller. Is there a easy way to do this? To resize the bitmap data and maintain the data that is already set up to construct the model? I can't share the code but the psuedo code is: we create a bitmapdata of a specific width and hight.

We the loop through all the children of a wrapper sprite and do a bitmapData.draw of each of the children and use their matrix for the second param, and then have it build to the bitmap.rect.

View 2 Replies

ActionScript 3.0 :: Transform Matrix TopLeft?

Dec 29, 2010

I ran into an issue with an app that I have been working on.The application lets a user draw a rectangle, which base class is UIComponent, on an SVG Canvas. The user can rotate, skew, scale,flip horizontal and flip vertical the rectangle. Then they can drop an image into the rectangle.We just cloned the rectangles matrix and applied it to the image and the image would transform the same as the rectangle. Well now we have changed the way the app works.

Now we don't want the image rotated or flipped on the initial drop, and this is where I'm having trouble.I was wondering if there is a way to always find the true top left of any rectangle no matter what kind of matrix is placed on it. I can find the center of the rectangle but when a user flips the rectangle the center point is outside the rectangle.Instead of finding the center I would like to find the topLeft.I have tried several things. Like transform.pixelBounds, but this gives me big numbers like 2200 instead of 400. I have also looked at senocular.com but not sure that I understand it.I just need a dynamic way to always find the top left.

View 1 Replies

Flash :: Using Bitmap Data To Draw Massive Image?

Feb 18, 2011

I am making a snow boarding game in AS3. The problem I am having is that I want to leave a trail in the snow behind the board.

I have had a think and feel that the best way of achieving this would be to use the lineTo() method to draw a line form the snowboards previous position to its current position. If I do this all of the way down the slope I would end up with a line almost 23000 pixels long which seems extremely large and will have a major impact on performance.

If I were to convert the trail movieclip to a bitmap would it improve performance? I am targeting a minimum of flash player 9 which I have found to have issues when handling bmp's over 2880 pixels so I think this method might not work.

View 2 Replies

ActionScript 3.0 :: Assign A Transform Matrix To An Object

Jan 28, 2009

i want to assign a transform matrix to an object, but i want to assign the values myself (as in, no 'rotate, scale etc'), but for example, set a matrix like

[Code]...

which if applied, would have no effect, but would be valid (actually not exactly that matrix, but you get the idea). i want to set the values of the matrix and the object should be affected by those values that i set by myself, no scale rotate or any predefined operations. how can i set my own matrix?

View 4 Replies

Flash :: Transformation Using MovieClip.transform.matrix ?

Jul 2, 2009

I have problem when dealing with transform in Flash cs4 ....When I rotate my movieclip and trace the output, my movieclip's width also changed....

View 4 Replies

Actionscript 3 :: Override The Transform.matrix Setter?

Aug 13, 2010

I have a class which extends the Sprite object in as3. I need to be able to override the transform.matrix setter in this class but haven't been successful in doing so.

I've tried many things, along with creating my own separate class which extends the Transform class and then overrides its set matrix function, and set my transform = new CustomTransform(). Sadly this didn't work.

In code this is what i tried:

public class MyClass extends Sprite
{
public function MyClass()
{

[Code]....

View 1 Replies

ActionScript 3.0 :: Tweening A Zoom Transform Matrix?

Dec 10, 2009

Im using Daniel Gasienica's Zooming in Flash where he uses the transform matrix to calculate the mouse position so the zooming reference point is the same. Its pretty handy, but i need the zoom to more smooth. I've tried almost everything (mainly the TweenLite engine), but with no luck.

[Code]...

View 3 Replies

Actionscript 3.0 :: MC's Transform.matrix Equals Null?

Nov 10, 2010

I am having quite a bit of trouble with one of my classes not working with the custom PixelPerfect-Class. Looking into it I found the error occurring in this line:

Code: Select allbM:Matrix = objB.transform.matrix.clone();

It's throwing a 1009. Playing arounf with trace I have come to the point, that the hero in my little game has no transform.matrix (it's null). This is not related to the CollisionClass, i traced it independently of that.

View 2 Replies

Flex :: Animating A Transformation Based On Transform Matrix?

Oct 18, 2010

I have a UI component that I wish to relocate and scale, but in a rather complex way. I've figured out the necessary transformations using the transform matrix, to which I applied several translate and scale operations. I can set the new transform matrix for this UI component to be the above calculated matrix, and the results are accurate; but I need to animate the transition. I can't use the Scale/Move effects alone because they aren't as powerful when it comes to calculating the necessary transformation as the matrices are.So how can I animate the transition of an object given a source and a target transform matrix?Figured it outUsing a tweener and its onUpdate event to reassign the matrix with each intermediate value:

var animMatrix : Matrix = gi.transform.matrix;
TweenMax.to(animMatrix, 1, {
a : m.a,

[code]......

View 1 Replies

Flash :: Zoom Fit A Flex Component With Transform Matrix?

Jul 8, 2011

someone could tell me how I can zoom a Canvas, with transform.matrix, so that the content of the component fits into the parent container (application), either inward or outward

this function is called Zoomfit(), I have this code:

[Code]...

View 1 Replies

ActionScript 3.0 :: Matrix Transform - Rotate Object Around External Point

Oct 14, 2010

I found the function:
rotateAroundExternalPoint(m:Matrix, x:Number, y:Number, angleDegrees:Number)
to rotate an object around an external point. The top of the object will always point at the center point which is exactly what I want.

It works fine but its possible to rotate it in an oval instead of in a perfect circle...I think it should be something with the angleDegrees Parameter but im not sure what to do with it. I also tried to set up an own matrix but I failed. Any right direction to orbit an object in an oval, and where the top of the object always point at the rotation center?

View 2 Replies

ActionScript 3.0 :: Scale - Rotate Or Translate A Display Object Using Its Transform.matrix

Jun 22, 2011

my problem is that if i scale, rotate or translate a display object using its transform.matrix i am not getting the value in the display object but the transform is happening like displayObject.scaleX or displayObject.scaleY etc. i get this new transform value using the dislayobject? as i am using a matrix transform manager which actually changing the transform matrix of the display object.

View 8 Replies

Flex :: Why Does Matrix Transform Snap Child Back To Top Corner Of Parent

Apr 14, 2011

I'm having trouble with Matrix Transforms in Flex.

I have a Flex Canvas with nothing but an Image in it, like so.

<mx:Canvas>
<mx:Image id="img" source="/some/Url" />
</mx:Canvas>

[Code].....

View 5 Replies

ActionScript 3.0 :: BitmapData Draw() Method - Draw The Bitmap On The Stage At Design Time?

Mar 18, 2009

I am using the draw() method of the BitmapData to encode a jpeg of part of the image. Now this should be easy enough given the object I want to draw to the bitmap is on the stage at design time so I know its location and dimetions exactly! Heres the code I have in place.

Code:
var myBitmapSource:BitmapData = new BitmapData ( street.width, street.height, false, 0x333333);
myBitmapSource.draw(street, null, null, null, new Rectangle( 96, 5, 571, 450 ), true );

I know for a FACT that no part of the street clip I am drawing out is in negative space, and it's registration is (0,0). However, it cuts off A lot of the top of my image. y=5 in the above rectangle is where I need the top to be, but it cuts the top off of the image... even if I change it to 0, it has no effect.

View 2 Replies

ActionScript 3.0 :: Matrix & BitmapData.draw?

Apr 28, 2010

I am trying to copy an image.The green stuff on the first image is a mask(which is not set, its just there to show it)Everything works fine when I dont set a mask to an image (picture 1)But when I set the mask I get picture 2.What I want is to copy a part of the image which is visible when the mask is set. I know what size the mask and image are going to be so I can calculate the size of the area which i need to copy.This is the code I am using, image has registration point in the center, thats why i use matrix.translate (not sure if its the right way).Also there is no image scaling applied (there might be later), thats why I am using matrix.scale.

Code:
var _reflectionHolder:Sprite = new Sprite();
addChild(_reflectionHolder);
_reflectionHolder.y =_targetObject.y + _targetObject.height / 2 + 10;[code]......

View 0 Replies

ActionScript 3.0 :: Text Is Incorrectly Rendered If The Movieclip Containing The Text Has A 3d Matrix Transform And Quality Is Set To Medium Or Low?

Nov 19, 2010

I have an odd problem in CS4/AS3 with one of my flash files where text is incorrectly rendered if the movieclip containing the text has a 3d matrix transform and quality is set to medium or low. It is easy to reproduce:

[Code]...

View 11 Replies

Flash :: Intermittent Bitmapdata Draw With Scaling Matrix?

Sep 10, 2009

We have discovered that when we draw one bitmapdata into another bitmapdata using draw, there is an upper bound on the scaling transformAt some point the IBitmapDrawable parameter ceases to be rendered on the target bitmap.Does anyone know what the parameters of this upper bound are? Is this documented somewhere?

View 4 Replies

ActionScript 3.0 :: Draw Bitmap Instead Of Export Bitmap?

Nov 5, 2009

I'm using Sandy to animate some objects in 3D. What I currently do to images which are EXPORTED in the library, I want to do to some bitmaps that I create using the DRAW technique. But it wont work :-(

CODE FOR 'CREATED BITMAP' :
ActionScript Code:
var bData:BitmapData = new BitmapData(myObject.width,myObject.height);
bData.draw(mask5);

[Code]....

Sandy doesn't seem to treat the 'created' bitmap the same as those that are exported from the library.

View 0 Replies

ActionScript 3.0 :: Transform And Distort Sprite Which Has Bitmap Childs?

Nov 7, 2010

I wanna transform and distort my sprite which has bitmap childs from this ._ |_| To this .._ /__

View 3 Replies

ActionScript 3.0 :: Bitmapdata.hitTest - Bitmap 'emptyBitmap' With Bitmap Data Created

Feb 3, 2009

I'm cutting my teeth in actionscript 3 on a game that has a character running through a world. So, I have set up my Hit Testing by using the bitmap data hit test method, since I figured my world is going to be destructible - it'd be nice to update the level and then redraw it and have the character interact with the new change. (That works beautifully) I am however; a bit confused as to how I have my hit Testing set up. I've been messing around with it, and it works for now - but I'm not sure why.. currently, I have a character set up by using a class I built and using a series of animations I created. So, this character has a walking and falling animation, etc. This is a movie clip.

Then there's a bitmap 'emptyBitmap' with bitmap data created - however; I never really added this as a child to the character. This is sized to the dimensions of my character. My level is created as a movielip, then it's drawn to a bitmap - when the level movieclip is changed, the bitmap redraws, and that's how this updates.

[Code]....

View 1 Replies

ActionScript 3.0 :: Get Bitmap.draw() To Work?

Apr 16, 2009

I can't seem to get bitmap.draw() to work. I've used it before in exactly the same way but this time Flash decides to put out this error:

"ReferenceError: Error #1069: Property draw not found on flash.display.Bitmap and there is no default value."

With the following code, tile1-5 are movieclips in the library consisting of a few instanced movieclips inside them.

Code:
// Add the tiles from the library into arrays for each area.
private var a1Tile1Bmp = new Bitmap();
private var a1Tile2Bmp = new Bitmap();
private var a1Tile3Bmp = new Bitmap();

[Code]....

View 3 Replies

ActionScript 3.0 :: Draw Bitmap With Exectfit?

May 16, 2011

I have a movieclip with textfield placed on it. My stage size is 1003 X 560 pixels. When i open it in html page with exectfit and 1366 width and draw bitmap of that movieclip. Then text always gotowards right.

View 3 Replies

Actionscript 3 :: Draw() With Transparency On A Bitmap

Nov 7, 2011

I want to apply transparency to a non-transparent logo then add it to an image. So I change the alpha of the logo, then I draw() the logo on the image. But it doesn't work, the transparency isn't applied as expected.

Note: I will later save the resulting bitmapData to a file, so an addChild() won't be enough to solve this.

var image:Bitmap;
var logo:Bitmap;
//...
logo.alpha = 0.3;
image.bitmapData.draw(logo);

View 1 Replies

ActionScript 3.0 :: Draw TextField Into Bitmap

Oct 24, 2007

I have a need to draw a TextField into a Bitmap. And I can do it with one minor problem. When the TextField is added to the display list it has no background. When I draw it to the bitmapData object it always has an opaque white background. Is there any way to get the TextField to draw to the bitmapData with a transparent background? Here is the code I currently have that does draw the TextField in the bitmapData, but with an opaque background.

[Code]...

View 9 Replies

Actionscript 3.0 :: Bitmap Draw Only A Section?

Oct 23, 2010

i have video playing on the stage.. there is a sprite called _rect that is moving around the screen when it finds a face in the video.. that part works great.. but what i want to do is capture the face the _rect is currently over, from the video underneath and draw it into a bitmap,, but it keeps just drawing the upper left corner of the video..what i want is if the _rect has an x of 300 and a y of 300 and its dimensions are lets say 200x200hen the bitmap it draws from the video is 200x200 but starting from x:300 and y:300.. but like i said..o matter where the _rect is located it keeps drawing from 0,0.

Code: Select allvar myBitmapData:BitmapData = new BitmapData(rect.width,rect.height,false);
var clipArea:Rectangle = new Rectangle(rect.x,rect.y,rect.width,rect.height);
var myBitmap:Bitmap = new Bitmap(myBitmapData);

[code]......

View 1 Replies







Copyrights 2005-15 www.BigResource.com, All rights reserved