ActionScript 3.0 :: BitmapData.CopyPixels Method With Many Objects Be Faster?

Feb 7, 2010

I'm trying to know if you can copy the pixels of many objects in one BitmapData without a huge slowdown. The slow down is made by calling the method multiple times, thus making a lot of variable declaration and disposal for the garbage collector. If someone know how to either immitate the copyPixel method or have any other way of solving this problem,

View 4 Replies


Similar Posts:


ActionScript 3.0 :: BitmapData's Draw() Method Also Draws Objects With 0 Alpha

Mar 17, 2011

I am drawing a flash sprite on a BitmapData using its draw() method. This sprite has some nested objects with 0 alpha, yet the draw() method draws them on the bitmap data.

I think it has to do with the color transform I am using, but I have no idea how to change it to achieve the effect I want.

The color transform is the following:

Code:
new ColorTransform(1, 1, 1, 1, 255, 255, 255, 255);

I am using these values in order for the Bitmap to have white pixels wherever the object was, and black where there is nothing. The draw() also draws my alpha = 0 objects in white as well.

View 1 Replies

AS3 :: CopyPixels From A Huge BitmapData?

Sep 5, 2010

I need to load a very big image on AS3 (currently sized at 8192x8192). I am aware that it does not fit any of the limits imposed by Flash regarding drawing to screen or creating a BitmapData of that size. I just want to load the image so I can copyPixels() some parts of it here and there.The thing is, I'm loading the .jpg file of that size with no problems. The size is recognized correctly from my Loader object. I load it like this:[code]But I am greeted with the #2015 "Invalid BitmapData" error usually reserved for BitmapDatas that are too big. The error also happens if I try to do a copyPixels(), which is what I need to do.Is there any workaround I can use so I can get data from an image this big on AS3?

View 1 Replies

ActionScript 3.0 :: Flash BitmapData.copyPixels And BlendMode?

Oct 4, 2010

I'm loading a batch of 50 jpgs and once loaded, on enter frame, I'd like to change their alpha individually and apply BlendMode.ADD to all of them (also individually).

I can do this easy using normal Sprite objects, but this is not efficient enough (processor wise). I've played a bit with BitmapData.draw(source, null, null, BlendMode.Add) and that's still not efficient enough.

So I was wondering if I could achieve similar effect using copyPixels (which I know should be more efficient). Still, I'm a bit clueless on how could I apply BlendMode and alpha on a bitmapData object (I mean, I know I can't, but I was wondering if I could make this work using Matrix and filter manipulations).

View 8 Replies

ActionScript 3.0 :: Blitting CopyPixels With Pooling BitmapData?

Nov 7, 2010

What do you think about mixing this two up? Would it lead to better performance for the scenario described below?However, method done below still contains jerking/stuttering in animationWhat my app does is to create a random mix of smiley and draw it into the canvas, and update the movement of the smiley (x,y)I have a source bitmapdata containing different smileys each of the same size.Example:The app creates a random mixture of smileys inrandom length;Example:tc...I have 2 vector that acts as pool. 1 vector is to store bitmapdata1 vector to store SmileyObject (SmileyObject has 3 properties, positionX, positionY,bitmapData)If the pools is empty, I create a new bitmapdata and SmileyObjectThe bitmapdata copypixels random smileys from the source bitmapdata.This is then placed into SmileyObject.I have a loop that goes through each smiley objectand copypixel each bitmapdata into the canvas along with the x,y position.However, even with copypixel and pooling bitmapdata + smiley object,I can still view the stutter / jerk / stuttering / jerking in the smiley animation.

View 6 Replies

ActionScript 3.0 :: Faster Caching Of BitmapData?

Apr 5, 2012

I have a test that loads and pre-caches 20 images(1280x720 px). After the loading is done I use copyPixel to cache the loaded data. I'm left with a catching time of about 2 seconds, resulting in an average of 100ms per image. I've tried every trick I can think of, nothing is making it any faster. I have one idea left:Do you think it would speed the caching up by frst comverting the images to binary, then loading the binary images and using setPixels to cache them?

View 14 Replies

ActionScript 3.0 :: Faster Method To Find An Index Than IndexOf()?

Mar 16, 2011

I have a function that finds the smallest five numbers out of an array of values and returns their index numbers. Here's a block of code from that function[code]...

The whole thing is slow, but I imagine that indexOf() is probably the worst offender. Is there any more efficient way to correlate a series of minimum values with their indexes without having to use indexOf()?

The values don't necessarily have to be stored in _elements, but they're pulled from a multidimensional array so I figure that it's the most efficient I can get at the moment.

View 3 Replies

Flex :: What Is Faster - Plain Or Strongly Typed Objects

Feb 15, 2010

So is
public var user:Object = {};
user["firstName"] = "Bill";
user["lastName"] = "Cosby";

Slower than if I have a value object like User?
var user:User = new User();
user.firstName = "Bill";
user.lastName = "Cosby";

View 2 Replies

Actionscript :: How Much Faster Is Blitting Than Using Vector Sprite Objects In Flash

Feb 18, 2011

I know there are different situations where one would be better than the other, but I'm comortable with a generalized statistic of... How much faster is blitting than using vector Sprite objects in Flash?

View 2 Replies

ActionScript 3.0 :: Does Better Faster CPU Necessarily Equal Faster SWF Compile Times

Jan 25, 2010

My question is, does a better, faster CPU necessarily equal faster SWF compile times? Or does it rely on something else (OS, memory, etc). I only use AS3 and some of my projects take a while to compile. If certain hardware can guarantee me a faster compile time, it'd be worth including those things in my shopping list.

View 2 Replies

ActionScript 2.0 :: Preloader Rotation - Faster And Faster When The Percent Loaded Goes Up

Sep 26, 2005

I can make a normal preloader, with a bar and percent shown and so on... But I want to make a little thing in the middle of the preloader that rotates faster and faster when the percent loaded goes up. This is what I thought would work:

[Code].....

View 2 Replies

Flash :: BitmapData.draw Method Or Bug?

Oct 2, 2009

I have problem when drawing transparent png image on transparent bitmapData.

code of first frame:
 
stop();import flash.display.Bitmap;import flash.display.BitmapData;import flash.display.BlendMode;import flash.geom.ColorTransform;import flash.geom.Matrix;
var bmd: BitmapData = new BitmapData(500, 400, true, 0);var bitmap: Bitmap = new flash.display.Bitmap(bmd);addChildAt(bitmap, 1);

[Code]...

View 1 Replies

ActionScript 3.0 :: BitmapData Method Lock Not Work?

Mar 30, 2012

import flash.display.BitmapData;
import flash.display.Bitmap;
import flash.geom.Rectangle;

[code].....

View 4 Replies

ActionScript 3.0 :: Timer Run Faster And Faster

Jun 1, 2010

[code]in my original code..function "test" will change the x axis of the images by Timer..I wanna the x axis of the images can be changed after every two seconds..but when I run it..it's obvies faster and faster every time when the Timer dispatch the TimeEvent the delay always shorter than the last time.

View 7 Replies

ActionScript 3.0 :: Use The BitmapData.setPixels Method To Set Certain Pixels In The Bitmap Transparent?

May 2, 2009

I am trying to use the bitmapData.setPixels method to set certain pixels in the bitmap transparent.But no matter what I do, it always seems to set the pixel(s) black (non-transparent).Here is my code:

[AS]
bmpd = new ImageFromLibrary(0, 0);
bmpd.setPixel(0, 0, 0x00000000);
[/AS]

why its not setting the pixel(s) transparent?

View 4 Replies

ActionScript 3.0 :: Making A Copy Of A Sprite Via The BitmapData Draw Method?

Dec 1, 2009

I'm making a copy of a Sprite via the BitmapData Draw method. It kind of works other than the top portion of the bitmap gets cut off (replaced with transparent pixels). It looks like it's about the same height as the Sprite's y value.

looks like this:
_________________________
| |
| TRANSPARENT PIXELS |
|_________________________|
| |
| IMAGE |
| |
| |
| |
| |
| |
| |
|_________________________|

View 5 Replies

Professional :: BitmapData Objects And The GPU?

Sep 7, 2011

Are BitmapData objects automatically GPU accelerated for rendering, rotating, and scaling,or does the bitmap they connect to need to have cacheAsBitmap set to true?

View 1 Replies

Flex :: ClipRect Parameter Of The BitmapData.draw Method Really Clips The Source?

Dec 10, 2009

The documentation says that clipRect parameter of the BitmapData.draw method sets clipping for the source.Reading this I wrote an AnimatedObject class for my potential flash game. This class draws a frame from a .png animation strip, and doesn't work with Flash scene hierarchy.

[Code]...

View 4 Replies

Actionscript 3 :: Use The Method SetPixels(rectangle, ByteArray) Of BitmapData In Adobe Flex

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

Flash :: Find The Size Of The Area In A Bitmap Which Has Been Filled Using The Bitmapdata.floodfill Method?

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

ActionScript 3.0 :: PNG To ByteArray To Multiple BitmapData Objects?

Sep 17, 2010

is there anything that will take a very large png (even larger then the total pixel limit of BitmapData) and load in the png as raw bytes into a bytearray and then take that array and grab only portions of the image to be able to generate a grid of usable bitmaps to render the very large png..I got to the point where I was able to get the png as a bytearray but from there I don't know how to grab a portion of the bytearray and attempt to load the partial bytes in a loader via loadBytes()..basically I think I need a decoder to decode the partial bytes to a bitmapdata.

View 2 Replies

ActionScript 2.0 :: How To Delete BitmapData Objects With No Linkage

Apr 10, 2006

How to dispose bitmapdata objects that have no linkage. The thing is that I have bitmap pictures (PNG) wrapped inside movieclips (as you can't set linkage to PNG files with jsfl) and when I begin to load them into my movie from the library I can't dispose of them to free up ram memory, i've tried to use movieclip.removeMovieClip(); and movieclip.dispose(); but the bitmap inside still takes up ram! I use over 1000 pictures so i really need to dispose them... How to get linkage set to PNG files with jsfl??

View 6 Replies

Flash :: Rotate BitmapData When Using Draw Method. Width Height Bounds Clipping / Cropping?

Jan 29, 2010

I wrote a collision detection class that works off using BitmapData.hitTest. Basically, every update, the .draw method is called and then two BitmapData's are hitTest'ed against each other to see if there is a collision.It works pretty well, however if I start rotating the source MovieClip I use for the BitmapData, the transformations don't get registered in the draw method. So what I did was pass through a Matrix in the draw method. That works. But here's the actual issue. If I output the BitmapData to a Bitmap on the stage, I see that Bitmap is, in fact, rotating, but now it's exceeding the bounds (width and height) of the BitmapData. Which is cropping / clipping the image of the source MovieClip.

UPDATE: Basically, when the Bitmap clone of the MovieClip rotates outside the positive co-ordinate space, it doesn't get drawn. It rotates outside the bounds of the BitmapData set width and height. I can multiply the bounds by 2, and then center the bitmap inside the set bounds, but then the origin point is never fixed and the object is always being moved around. Works pretty well, but makes aligning the object to any specific point impossible.Here's my isolated test code. It requires you to have a MovieClip on the stage named "iTest". I used a fairly vertical arrow shape (higher than it is wide) so I could keep track of rotations visually accentuate the clipping problem:

var rotateTimer:Timer = new Timer(10);
function rotateObject_init():void
{

[code].....

View 2 Replies

Actionscript 3 :: Flash - Combine Two BitmapData Objects Via Max( Channel )?

Feb 2, 2010

I have two BitmapData objects with alpha channels. I'd like to combine them into a single one by using max(channel_image_one, channel_image_two) for each channel, including the alpha. Is there an easy way to achieve this result?

View 2 Replies

Actionscript 3 :: Merging Two Bitmapdata Objects' Alpha Channels?

Aug 22, 2011

i have the following situation:

one drawing layer (graphics object with lineTo, etc.)

one png with an alpha channel (supposed to serve only as a mask)

now i want to be able to only draw lines within an area restricted by the png mask.

i am trying like this:

var bitmapData:BitmapData = new BitmapData( 320, 320 );
bitmapData.draw( drawingLayer );
bitmapData.copyChannel( maskBitmapData, new Rectangle( 0, 0, 320, 320 ), new Point( 0, 0 ), BitmapDataChannel.ALPHA, BitmapDataChannel.ALPHA );

now the borders get cut off fine, but i get a black background, since the drawing layer has an alpha between the drawn lines (and it should remain like this) and the mask bitmap has an alpha outside the shape. so naturally the mask's alpha replaces the drawing layer's.

i tried it with merge, copyPixels and also with just setting the mask property on the drawing layer (i set everything to cacheAsBitmap) but to no avail.

ADDITION:

when trying to use a mask i tried it with

<s:BitmapImage id="mask" source="@Embed(source='...')" cacheAsBitmap="true" />

and also as

[Embed("...")]
private const BodyMask:Class;
var maskBitmap:Bitmap = new BodyMask();

and assigned them to the mask property of a s:Group element (cacheAsBitmap=true) where the operations on the graphics object occured. i also tried reassigning the mask after each draw operation.

View 1 Replies

Actionscript 3 :: Why Do Loader Objects Kill Bitmapdata Draw();

Mar 27, 2012

The code below is a simple add and save program. You press the addButton to add content to the canvas and than press the exportButton to save an image of the canvas in its current state to your desktop. This code works fine when I add circle objects to the canvas that are drawn to the canvas. The problem lies when I try to load a .png into the canvas. Once the loaded content is added to the canvas the exportButton stops working all together and no longer responds. What is causing the loaded content to break the code?

[Code]...

View 1 Replies

Flash :: Merge Multiple BitmapData Objects Into One So That It Can Be Encoded Using PNGEncoder?

Jan 30, 2012

I am creating a program that is effectively an sprite creator. I'm very new to AS3, but I know JQuery, JS, PHP, etc. After going through multiple steps of selecting pieces to customize a character, you are supposed to be able to download the final product using fileReference(). Everything works, and I can download the image in the end, but the problem is that I cannot capture all of several movieclips on the stage, I can only capture one. Maybe this will help clarify:

[Code]...

Could it be that each of the movieclips I'm adding to the sprite have children of their own?

View 1 Replies

Actionscript 3 :: Two BitmapData Objects - Apply A Colorburn Or Darken Or Multiplay Filter

Dec 27, 2011

Photoshop and Fireworks both have some nice filters. When you put one bitmap over the other, the first bitmap can act as filter. For example, the white pixels of the top bitmap lighten the pixels of the bottom bitmap. Is there any way to apply this in as3? What I am trying to accomplish: I have a large single-color bitmapdata object. I want to overlay perlin noise and lighten/darken the single-color bitmap to give it some random/natural look.

View 1 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 :: Access The Newly Created Bitmap Data To Access The Method CacheAsBitmap.bitmapdata.dispose() ?

Oct 22, 2010

So, you have a sprite, you draw some graphics, you set cacheasbitmap=true... I can't seem to access the newly created bitmap data, to access the dispose() method.

[Code]...

View 6 Replies







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