Actionscript 3 :: Bitmapdata - GetColorBoundsRect - Find The Rectangle Area Or Each Circle
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
Similar Posts:
Jan 2, 2010
Is there a way to apply a colorTransform to a BitmapData in a circle rather than in a rectangle?
Instead of erasing rectangular parts of an image by reducing the alpha channel as in the code below, I'd like to do it in circles.[code]...
View 1 Replies
Dec 23, 2010
I have two circles, an inner circle and an outter circle. I'm trying to find points that reside within the area between the edge of the inner circle and the edge of the outer circle.
View 1 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
May 20, 2009
I draw a rectangle i should see a little bold circle to indicate a perfect rectangle, I seemed to lost mine, can somebody please tell me how to get it back!
View 2 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
Mar 22, 2009
most efficient way to test for a collision between a circle and a rectangle?
View 3 Replies
Oct 16, 2010
I have a paint brush that has a stroke of a circle i wanted to replaced it with rectangle instead here is my code.
Code:
private function drawCircle():Void
{
var r:Number = 40;
var xcenter:Number = _xmouse;
[code]....
View 3 Replies
Aug 28, 2011
I'm a newbie in flash.I want to click a circle to show a rectangle surrounding it,and click any other places in this stage to hide this rectangle,how to implement this event?
View 1 Replies
Oct 9, 2010
In AS3 is there an easy way for collisions to take place between a moving circle and a rectangle object. A moving circle has a direction and you need to know how it collides with an object rather than knowing it just hits. In .net you use a points test where you test several points around a circle to see what hits an object and then you can work out what direction it will bounce off.
View 2 Replies
Aug 5, 2010
I'm using following code:
ActionScript Code:
var bd:BitmapData = new BitmapData(stage.stageWidth, stage.stageHeight);
bd.draw(stage, null, null, null, new Rectangle(tmpX - (tmpW/2), tmpY - (tmpH/2), tmpW,
[code]....
View 9 Replies
May 2, 2009
I'm trying to take a 'snapshot' of a movieclip that i've got on the stage with "BitmapData" and then starting a "draw()" command on it. I'm able to get it drawing.. however.. it only takes the things from (0,0).( the upper left corner of the movieclip. Doing a trace on "BitmapData.rectangle" gives me it's X and Y coordinates .. and it's width and height..
How do I change the X and Y locations of the BitmapData for it to start the drawing from? As I have some stuff on the negative side of x.
View 1 Replies
Jul 15, 2011
I was working on some blitting code today and after profiling it found that I was creating 1000s of new rectangles. I was shocked because I only had 1 or 2 different new Rectangle() calls or I was using the .rect property of BitmapData.
I started commenting out huge swathes of code until I was left with this code in my sprite class:
canvas.bitmapData.copyPixels(_bitmapData, _bitmapData.rect, destination, null, null, true);
I cached the result of _bitmapData.rect at object creation and my thousand of new rectangle calls were suddenly gone from the profiler.
Why the heck would BitmapData.rect create a new rectangle? Is there a way to check the core libraries or something and confirm this is true?
View 4 Replies
Oct 11, 2011
I have a movieclip which contains a bitmap and I wan't to increase the hit area. I understand I can add a transparent shape behind it but this is to be compiled through air for ios and I don't want to cause unnecessary redraws.Is there a way to define a rectangle as the hit area or another solution perhaps?
View 2 Replies
Oct 6, 2007
After seeing the I've been told that movieclips aren't suited for games, what do you use? thread, I thought I would try to incorporate the approach into a game I'm currently programming to make it a little less processor intensive.
I have a giant movieclip of a football field, of which only 5-10% is shown at any given time. I'm guessing that flash still has to make calculations for the other 90-95% of the field every frame, even though it's of no use. From what I understand (not much), copyPixels seems like the perfect candidate for such a situation.
It seems simple, but I'm having trouble actually implementing it, and I'm not sure which actions are needed and what might be introducing unnecessary work. I have a movieclip (mc_field, exported for as), but if it would save the processor some effort,I could easily save this as a bitmap and export that for actionscript. The width and height of the final product (bitmap/BitmapData) will be Stage.width, Stage. height,respectively,and I can handle making the calculations of the x,y coordinates of the rectangle cropping (which part of the source bitmap I want to crop).I'm sure it's only 3 lines of code, and I know that there are a few examples online, but for some reason.
Say, for frame one, I want to take the field (either mc_field or bm_field) and copy 500px x 300px, starting at 140,230 from the source bitmap to mc_container.Then, for frame two, I want to copy 500px x 300px starting at 240,540 from the source bitmap to mc_container.
View 4 Replies
May 17, 2011
I am looking for the most efficient way to create a circle mask on a BitmapData, so that everything inside the circle is visible and everything outside the circle is black. Here is my current code:
[Code]...
As the radius of this circle is going to be changing rapidly, storing the mask would be useless. how to make this more efficient, preferably keeping to methods that can use GPU accleration?
View 0 Replies
May 11, 2009
I want to make an editor like this site. [URL] If you browse this link you will find "Button. If you press this button you will navigate to a editor to design your layout. After draw a rectangle or circle or line you can resize that or can rotate that. When you finish if press the "you will back to the previous page where your desinged layout display. If you press the "" again then you will navigate the editor with the previously designed layout. I want to make a site like this. I want to use the flash cs4 to make the editor. Anybody knows how to draw a rectangle or circle shape with mouse and how to scale by setting the point and how to rotate by setting the rotation point also by using flash cs4 and as3?.
View 3 Replies
Apr 29, 2010
I'm working on a simple tutorial, and I'd like to randomly generate the positions of the red and green boxes in the accompanying images anywhere inside the dark gray area, but not in the white area. Are there any particularly elegant algorithms to do this? There are some hackish ideas I have that are really simple (continue to generate while the coordinates are not outside the inside rectangle, etc.)
View 2 Replies
Feb 3, 2011
Error #2030: End of file was encountered.
This method is not working
I am using it like this
var ba:ByteArray = new ByteArray();
ba = bmd.getPixels(bmd.rect);
bmd.setPixels(srcRect, ba);
bm.bitmapData = bmd;
img.source = bm;
View 1 Replies
Mar 25, 2011
What I need to do is find the rectangle of a rotated rectangle. I have a house that is diagonal and I need to find the rectangle of the bottom of the house so I can check for collisions. I was hoping to use the rectangles to find intersections. Something like - if (playerRect.intersects(houseRect.bottom){ do something };Every time I try to get the rectangle of a rotated rectangle, all I get is the bounding box which is not rotated.
View 4 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 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
Aug 21, 2010
The link elements I'm talking about are single words, so they are not wrapped inside the container, which means that they should have a single bounding rectangle. But how do I go about finding this rectangle? I'm familiar with Flex3 but don't know enough about the new Text Layout Engine in Flex4.
View 1 Replies
Oct 31, 2004
Okay without putting a million boxes around the circle, which i found laggs out my game alot. How can i use some sort of code to find all the coordinates inside a circle.
View 2 Replies
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
May 2, 2010
I have a rectangle of any arbitrary width and height. I know X,Y, width, and height. How do I solve the upper right hand coordinates when the rectangle is rotated N degrees? I realized if it were axis aligned I would simply solve for (x,y+width). Unforunatly this doesn't hold true when I apply a transform matrix on the rectangle to rotate it around its center.
View 2 Replies
Dec 6, 2009
How to find out different circle's center point of a bitmap?
just like photo above, how can i locate the 2 center points of circles?
i only know using .getColorBoundsRect to get a point, but this only apply to one circle, in fact i wanna get different points according to the bitmap.
View 1 Replies
May 20, 2010
I'm drawing a 3D pie chart that is calculated with in 3D vectors, projected to 2D vectors and then drawn on a Graphics object. I want to calculate the most left and right point of the circle after projected in 2d. (So not 0 and 1 Pi!) The method to create a vector, draw and project to a 2d vector are below. Anyone knows the answer?
[Code]...
View 1 Replies
Mar 7, 2011
how do you find the display area and/or resolution of the screen in actionscript 3?
View 1 Replies
Jul 19, 2009
I have a AS2 movie clip that has a drag navigation. The movie clip is bigger then the visible area. How can I find the center xy of the current visible area when I stop the drag?
View 2 Replies