ActionScript 3.0 :: Crop A Bitmap In Runtime?
Jul 26, 2010Is it possible to crop a bitmap in runtime using AS3
View 1 RepliesIs it possible to crop a bitmap in runtime using AS3
View 1 RepliesIm working on this project where I get a stream and eventually a bitmap from a webcam. Right now I'm kind of stuck trying to crop a subset from theis bitmap along a path of x,y coordinates. The path will always contain four corners, but these are not necessarily 90 degrees, so It is usually a somewhat skewed square. what classes to use for a custom crop ( not really keen to make one fresh)
View 7 RepliesIs there any easy way to crop my BitmapData without converting it to Bitmap (I only want the first 300x200 pixels).
View 9 RepliesI want to be able to crop an image based on what is viewable through the mask and then saved that cropped image out to a new file. I'm not exactly sure how to do this though
View 3 RepliesI just started working with bitmaps and I do not get them at all, I've read the entire page adobe has on bitmap and bitmapdata. I've got this code together but all it does is displays a white rectangle and not my image.
ActionScript Code:
package {
import flash.display.MovieClip;
import flash.display.Loader;
import flash.display.Bitmap;
import flash.display.BitmapData;
This code should load the image into the bitmap (which works), then crop it with the rectangle (which just crops the fill from the bitmapdata)
I have been trying to figure out a good strategy to perform a bitmap crop using Actionscript3. For example: I have a picture of a car and I want to crop out the car from the image alone and feather the edges so that they do not look jagged.
I am a flash noob and have only been using it for a couple of weeks. I've tried a couple of options and here is the last one that I have come up with it: I place red dots on stage that are draggable so that you can outline the object you want to crop and the dots are the bounds for a gradientFill that is used as the bitmap's mask. (I am using a radial gradient ... so the results are far from what I want, since the car is not an oval).
[Code]...
1) How can I fade just the edges of this custom-shaped fill outlined by the red dots?
2) I want to save the image out to a file once it's cropped. What strategy would be better for doing this using a BitmapFill or a GradientFill as a Mask (If it's possible with both)?
3) I may be using this strategy to crop faces later on.. anyone know of any good face detection APIs for as3? (also edge detection APIs)
Does anyone know a way to crop a SWF like you would crop an image in Photoshop? I'm building a Flash Banners application in my Flash portfolio website and I'm loading a SWF using addChild via a URL loader object. There is no way to mask the outsides of the SWF because addChild puts the SWF at the front of the display list so the masks would just show up anyway and the masks will just be huge white sheets that will look dreadful. I need to LITERALLY crop the SWF down to 550 X 325 pixels.
View 5 RepliesI'm drawing some cars. They're Bitmap's, loaded from PNG's in the library. I need to be able to color the cars-- red ones and green ones and blue ones, whatever. However, when you paint the car green, the tires should stay black, and the windows stay window-color.
I know of two ways to handle this, neither one of which makes me happy. First, I could have two bitmaps for each car; one underneath for the body color, and one on top for detail bits. The underneath bitmap gets its transform.colorTransform set to turn the white car-body into whatever color I need. Not great, because I end up with twice as many Bitmap's running around on screen at runtime.
Second, I could programmatically search-and-replace "white" with "car-body" color when I load the bitmap for each car. Not great either, because the amount of memory I take up multiplies by however many colors I need.
What I would LIKE would be a way to say "draw this Bitmap with JUST THE WHITE PARTS turned into this other color" at runtime. Is there anything like this available? I will be less than surprised if the answer is "no," but I figure it's worth asking.
i need to vectorize a bitmap object in runtime?
View 4 RepliesAfter drawing some lines with moveTo and lineTo, how to convert them to bitmap so they do not lag if there are many.
View 14 RepliesHow can i take a snape shot of swf movie at runtime. I want to put this feature both in online application and ofline application. Requirement is this that when user click on a capture button a bitmap of flash movie should be saved on his/her computer.
View 2 RepliesI looked at the following example in the AS3 Reference: [URL] It is unclear to me looking at the package example how to apply this in standard ActionScript 3 without packages to a Movie Clip resident in my Library that gets called at RunTime. how I would push the DropShadow filter onto my Movie Clip at RunTime?
View 6 RepliesI've seen the Loom project, but are there any alternatives that are more mature (and actively developed)? I am looking for something that would allow load-time weaving of pointcuts into existing binary code at runtime with the AVM2 runtime.
Has any work been done in this area?
I've been into coding for about 5 years now, but I'm a recent convert to Flash development. One of the questions I have at the moment is, considering that SWF files can be run by either Adobe Flash Player OR Adobe AIR, what's the real difference between the two runtime environments? What API's and Objects exist in one environment, but not the other?
Basically what I'm more or less trying to establish is, when would I want to develop an SWF for AIR, and when would I want to develop for Flash Player, considering that Flash Player can also execute locally (providing support for creating "desktop applications")
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]....
I know the topic of "duplicating" movieclips is a hot issue with the new virtual machine. Luckily, I understand the implications. I only am [currently] interested in duplicating a Bitmap. See, I load an image from an URL using 'flash.display.Loader.load', which is a non-blocking operation in Flash Player.However,I may use multiple copies of the loaded image (which is reported to be a Bitmap, naturally) in the display list at the same time.Hence, I naturally do not want to load the image from an URL every time, because I don't want to wait for a non-blocking call to complete. Nor do I need to - I mean one copy is already loaded, so it should be possible to just "duplicate" it, right?
My idea is to do use the bitmapData property of a Bitmap and pass it to the constructor of a new Bitmap object. I have not tried the following in action, but I want to hear whether any of you did and if the following would not work, what would:
Code:
var original_bitmap: Bitmap;
var copy_of_original_bitmap: Bitmap = new Bitmap(original_bitmap.bitmapData);
LiveDocs mention that the BitmapData being passed to a Bitmap constructor is "being referenced", which to me might suggest it cannot be used twice? There is also the BitmapData::clone() method, which I am not sure is applicable here or not.I know this is a lot of talk instead of just trying this out, but I test so much Flash Player code daily just to see "what works" (which should be documented instead by Adobe),
I have a 'puzzle' with the pieces 'scattered' haphazardly around. These pieces are all instances of my PTPuzzlePiece.as class, which works great for all intents and purposes. When the user selects a photo from the picture library, the pieces all properly display their 'masked' portion of the image. However, I have a problem in that the masked bitmap displayed in each piece is only 'masked' and not cropped.
This means that, for instance on the third piece down on the left hand side, 100 not-visible pixels of bitmap extend below the piece and out of the 'framed' area. This totally throws off my calculations when I go to scale and then print the screen using the AIR PrintJob, and when I scale that 'card' down to a 'button' on the menu where the user chooses which 'card' they wish to use. Is there a way to crop the not-visible area out, or copy only the visible pixels as BitmapData into a new Bitmap entity so that the layout is entirely contained within the 'frame'?
I have drawn objects outside the stage in the belief they would be croped automatically when creating the swf. BUT it doesn't. The objects are of course on the stage but pour over the edge... Anyone who knows what I need to do? To actually draw the objects inside the stage can be trickey since they are sort of supposed to be bigger than the stage. If I draw them inside the stage there is a risk of a little gap.
View 5 RepliesI was wondering if it is possible to crop an swf file through a program that doesn't convert the swf to anything.I've seen a few programs like this online, but none of them actually work. Has anyone has success with this?
View 1 RepliesIf I have a BitmapData that's already been drawn onto a Sprite. Is there a way to redraw the BitmapData onto a Sprites Graphics object without having to invoke beginBitmapFill and passing in the same BitmapData?
View 1 RepliesI'm working on a game, and to keep performance good, instead of addChild'ing 50 new sprites to the stage every second, I decided to have each player draw to their own bitmap, and then to the 'master' bitmap. This introduces an issue though: the second player would override all data the first player has put into to bitmap...My basic debugging proof of concept:
Code:
// bitmap test
import flash.display.Bitmap;
import flash.display.Bitmap;[code]......
I have an animated logo .fla file, there some some AS 2.0 in it. I basically need to scale and crop the entire file (just like you'd scale and crop an image in photoshop).
View 1 RepliesI have created a little banner on the stage and would like to crop it. I can't seem to find any crop tool, can't I crop an image in Flash CS5?
View 1 RepliesIs there any way to crop my drawings in Flash CS5? I want to make a scrolling background out of this:and I want to crop the ends of those layers so that they are smooth, like this:but that was done in Paint, so it isn't vector graphic anymore. So is there a way to achieve the above by cropping or some other way in Flash CS5?
View 3 RepliesI've been croping my pictures to use in my flash in photoshop but I want to crop the pictures so they fit the size of my page in flash. Does anyone know how to crop pictures in flash?
View 1 RepliesI have this image over which i have a circular crop. The user can move the underlying image and when he is ok with the result hits the crop button. How can i crop only that part of the image which is under the mask?
View 1 RepliesI just started with flash/actionscript.
Now I've created an movieclip width a 2 images who change every second. The images are 100x100 px, now I wanna crop the movieclip to 80x100.
I got a swf file called 'NW_site_4_diap.swf' centered in my browser with html. At the moment, anything that sticks out from the stage to the surrounding area get's displayed in the browser. Now I'd like to crop the swf file at its stage size. How do I get flash or html to crop all elements to the exact stage size? Here's the html code I used:
HTML Code:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
[Code].....
I have a bitmap which has several frames (packed along the horizontal axis). In order to render them I copy it to the backbuffer (larger bitmap) as follows:
Actionscript Code:
public override function copyToBackBuffer(db:BitmapData):void{ if (active) var drawRect:Rectangle = new Rectangle((currentFrame-1) * frameWidth, 0, frameWidth,
[code].....
In pure AS3, I have a pixelbender and a large bitmap. The pixelbender is configurable with a distance parameter to affect only a small area of the bitmap. The problem is that the pixelbender is executing over the whole bitmap. What would be the best way to update only the effected region of the bitmap? Given this config:
[Code]...