Flash :: BitmapData - Scale And Select Area In One Matrix?
Jun 29, 2011
I'm using a transform matrix as part of a bitmap draw to select an area of my target rather than drawing from 0,0:
var bmd:BitmapData = new BitmapData(target.width,target.height,true,0);
var mat:Matrix = new Matrix(1,0,0,1,-target.x,-target.y);
bmd.draw(this,mat);
[code]......
View 1 Replies
Similar Posts:
Feb 4, 2008
how to scale down flash images using BitmapData and Matrix?? I'm using it for fullscreen so that the images are always perfect. I've been tampering with this, but cannot get it to work properly.
View 3 Replies
Mar 14, 2011
Most often, questions are asked about how to scale a DisplayObject, and the answer is usually to use a Matrix.
My question is, how to you GET the scale of a Matrix (scaleX and scaleY)?
There's a Matrix.scale method to set the scaleX and scaleY, but it doesn't return a value, and no other properties exist to read it back.
The reason I ask, I'm using object burried deep down into a Display list, and each may be transformed. So I use the child object's sprite.transform.concatenatedMatrix getter, but am stuck at this point on how to read the scale from it.
View 2 Replies
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
Aug 5, 2011
I have this function:
public static function cloneDpObj(target:DisplayObject):Bitmap
{
var duplicate:Bitmap;
[code]....
to clone target displayObject (MovieClip or Sprite) and return Bitmap Object.
It can get bitmap from the target object, but it seem don't get all the area of the image.
By give the width and height of target object, but the target object in design was applied by Glow Effect, so my question can we get the all view of bitmapdata from a displayobject?
View 4 Replies
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
Jul 21, 2009
Unfortunately geometry is not my strong point and I am on a deadline. I am trying to determine if a textfield is larger than a displayObject and that it does not sit outside the x and y of said object. If it is larger, I need to scale it and make sure it is always in the confines of the displayObject space. On a side note, i need to scale the size of the text accordingly.
View 0 Replies
May 31, 2011
Im currently building a little 3D particle engine in flash the uses sprites.to set the position of each sprite I am using the projectVector function below. (the viewTransform matrix is the particles world matrix concatenated with a perspective projection matrix)
var projectedPoint:Vector3D = Utils3D.projectVector(viewTransform, point);
sprite.x = projectedPoint.x;
sprite.y = projectedPoint.y;
[code].....
View 1 Replies
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
Sep 27, 2011
I am using the floodfill method to colour-in sections of a bitmap image. That part is easy enough but the issue comes in with the way I am adding an effect to the colour fill routine.
To add the effect, first a copy of the bitmap data is created and floodfill is used on that instead of the original bitmap. Then the bitmapdata.compare method is used to set the alpha value of everything apart from the filled-in section to 0 and the result is saved in another bitmapdata. After that, a 1 px radius circle sprite is added to the stage and is being tweened to the image dimensions and its mask is set to the sprite which contains the result of the compare operation.
This works perfectly except for the fact that the fill sprite has to be tweened to the complete image dimensions irrespective of how small the area is being coloured-in since I am not able to find a way to get the dimensions of the fill area. I am doing an bitmap image update at the end of the tween and I have to disable user interaction till the tween is complete to avoid the errors which come in if another fill-in operation is started before the base image has been updated. If I could somehow get the dimensions of the fill area then the time during which I have to disable the user interaction will go down considerably.
View 3 Replies
Sep 28, 2009
Whenever I scroll to a new area to select a frame, it selects that frame to all the way back to the beginning as if i clicked and dragged to the beginning. Its very difficult to explain in words so I recorded it: [URL]..
View 5 Replies
Jul 2, 2011
I've searched but haven't found anyone wanting to do this with a bitmapData object.I'm using the following code:
matrix.identity();
matrix.translate(pan.x, pan.y);
matrix.translate(-zoomPoint.x, -zoomPoint.y);[code].....
Panning works, but using this method scale does not scale around my mouse.Has anyone done this successfully?
View 2 Replies
Oct 11, 2009
Flex 3, ActionScript 3, Flash player 9.
I have a picture in a BitmapData object. And an array of points. I nead to erase the part of the picture inside a polygon specified by the points. In other words, draw a polygon specified by the points and fill it with transparency.
View 2 Replies
Mar 19, 2010
I'm trying to resize each image without success. After pulling my hair a few time, I can't figure out to make the smoothing works on Stage. Basically I want to be able to resize any pics: 600x900 -> 400x600
Code: Select all // Call LoadBitmap class, bitmapWidth & bitmapHeight are the desired 400x600
loadBitmap = new LoadBitmap(bitmapWidth, bitmapHeight);
loadBitmap.loadBitmapData(theImage);
[code]....
View 2 Replies
Mar 15, 2010
I am trying to grab part of stage area using BitmapData and copyPixels method:
bmd = new BitmapData(stage.stageWidth, stage.stageHeight);
bmdRect = new BitmapData(320, 240);
rectangle = new Rectangle(360, 20, 320, 240);
bmdRect.copyPixels(bmd, rectangle, new Point());
[Code].....
The result i get is an empty .jpg I m pretty sure that the error is in the Bitmap procedure and not the saving one...
View 2 Replies
Jun 20, 2011
I have a BitmapData with 2 red circles. I want to find the rectangle area or each circle. If i use [B]getColorBoundsRect[/B] I get the smallest area enclosed by the 2 circles. How can i go about this and get individual area of the circles?
View 1 Replies
Nov 18, 2011
I've been looking for a JSFL command that might do this, but haven't come across anything even remotely similar to what I'm trying to achieve. Perhaps there is another solution besides JSFL that someone might know of.Question: Is there a way that I can select multiple symbols (either in a single frame or across multiple frames) and apply a scale transform that will adhere to each symbol's registration point?
Scenario:In an animation sequence, a movieclip of a tall rectangle is tweened on the timeline using "classic" tween. There are 20keyframes, where the mc changes position and rotation.In a duplicate of that animation sequence, I want to change the height of all instances of the mc in the animation, but keep the position and rotation. The rectangle should stay a rectangle, only shorter.I go to a keyframe, select the mc, and enter the desired scale percentage for the height in the transform pane. Then I repeat this for the other 19 keyframes. Imagine the pain and suffering I go through when this is done for several sequences!
Ideally,I would want to use the "edit multiple frame" mode in the timeline, select all instances of the mc across all 20 keyframes, and apply the height transform to all mcs via JSFL or dark magic.Flash's default behavior transforms multiple objects as a group,so not only will it squash and shear the different mc instances(creating diamonds),it will also shrink the distances between the different positions(changing the path of the tweens).I'm looking for a way to apply the transform so that each instance scales to their own registration point,preserving their position and respective of their rotation.
View 1 Replies
Apr 5, 2003
Has anyone here ever developed a function (or general library of relevant functions) that will allow one to find the inverse of a matrix? I've searched the forum archives, as well as the internet more generally, but haven't found anything. If anyone has some leads, I hope you'll pass them along.
If I don't hear anything within the next few days, I might try to develop something on my own, but I'd hate to do so if someone has already done the dirty work.
A solution to this problem would be very useful for 3-D work or anyone doing mathematical programming more generally.
View 14 Replies
Jan 31, 2007
I'm using Flash 8, with this code in the first frame:
import flash.display.BitmapData;
rissa._x=Stage.width/2;
rissa._y=Stage.height/2;[code].....
When I publish the file, I'm getting the following error message in the Output panel:
**Error** Scene=Scene 1, layer=Layer 2, frame=1:Line 7: The class or interface 'BitmapData.loadBitmap' could not be loaded.
var plaid:BitmapData.loadBitmap("plaid");
Total ActionScript Errors: 1 Reported Errors: 1
View 8 Replies
Oct 14, 2009
I am trying to use the reflect class from "http://pixelfumes.blogspot.com/2007/03/reflection-class-v3-with-source .html" but I keep getting this error:
ArgumentError: Error #2015: Invalid BitmapData.
at flash.display::BitmapData()
at Reflect()
at Site_fla::GalleryPage_29/loadThumbs()
at Site_fla::GalleryPage_29/sortXML()
[Code]...
btw, first I used assigned thumbContainer as the mc argument (outside the loadThumbs() function) and it worked but not exactly what I wanted... because I thought it is supposed to update when the movieclip is animated but it actually didn't... when I use a scroller, only the thumbs that are first loaded to the stage get the reflection..
View 10 Replies
Feb 19, 2010
I want my flash content to scale when I scale my browser window.
View 5 Replies
Sep 29, 2011
I have a movie clip named circle_mc(see the image on the link below) and a mask object(movie clip) which determines visible area of the circle. User can change the portion which is visible (extend the red area and make it red+blue, gray area is invisible). I need to find proportion of visible area to invisible area (red+blue/gray) so that I can calculate angle.
View 1 Replies
Jun 23, 2010
I have a comboBox and values like basic and advanced. And viewstack container conatains 2 grids.When i select the base option in Combobox, the first grid has to be selected. select the advanced value in comboBox, the second grid has to be selected.
<mx:ViewStack id="viewstack1" width="95%" height="85%" x="0" y="63" >
<tables:KeyMetricsBasicTable basicArrayDataProvider="{basicArrayResult1}" width="100%" height="100%"/>
<tables:KeyMetricsAdvTable advArrayDataProvider="{advArrayResult1}" width="100%" height="100%"/>
</mx:ViewStack>
View 1 Replies
Dec 4, 2009
My Flash image will not scale.if you zoom in, it gets chopped up. if you zoom out, it has a big blank area.What should I change in order to have this Flash image scale just like the rest of the site? [URL]It is the Flash in the center.
View 1 Replies
Dec 6, 2011
Flex 4 Combobox is extended with a Text Input that helps in getting to the item that is searched for.I have created a Check Box as an itemrenderer for this Flex 4 Combobox. I would like to Add a Select All and Select None options in the drop down of the Combobox. I know that i could accomplish by editing the dropdownfactory in case of a Flex 3 Combobox. But in Flex 4 the dropdownfactory doesnt exist.
View 2 Replies
May 31, 2011
I have to use Flash CS3, so I can't use the properties rotationX, roationY and rotationZ.I have a movieclip, that looks like this. It is now flat, no 3D rotation or shearing But what I want is that this movieclip has a rotationX, or that it is a bit in perspective like this: As I said, I can't use rotationX, so I have been playing around with Matrix. But I can not get it right.Here is how I try to do it
myMC.transform.matrix = new
Matrix(1,0.15,0.35, 1, 0, 0);
And this is the result get the matrix right, or is there another way?
View 3 Replies
Jan 8, 2012
In the 4 * 5 array that makes up a colour matrix, what do ALL the values do? All I have found is basically this:
0, 0, 0, 0, 0 <-R
0, 0, 0, 0, 0 <-G
0, 0, 0, 0, 0 <-B
0, 0, 0, 0, 0 <-A
What does each thing do?
View 1 Replies
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
Sep 1, 2010
I have transformation matrix properties (a,b,c,d). How to calculate scaleX, scaleY, scewX, scewY and rotation angle from those values?
When only one type of transformation is applied, I can figure out that:
scaleX = a
scaleY = d
scewX = c
scewY = b
rotation = arccos(a) or -arcsin(c)
But when multiple transformations are applied at once I don't know how to calculate those values.
I need to do this outside of flash so I can't use any flash helper methods.
View 1 Replies
Dec 29, 2011
I've been using BitmapData.copyPixels() to draw graphics onto a canvas (Bitmap).I need to rotate the resulting graphics without the use of draw() because it's vastly slower.How can I rotate the target graphic? I'm assuming that there might be a formula or library that I can use which will first reorganize the pixels that make up a graphic based on an origin (point) and radians.I'm pretty certain that I'm not capable of creating such logic, so if there are any known libraries that do this, that would be awesome.I'd like to achieve something similar to XNA's SpriteBatch.Draw() method, which accepts rotation as its 5th argument.
View 3 Replies