[Flashcoders] Drawing regular, filled shapes into BitmapData
I want draw regular shapes with antialiased edges into a blank BitmapData object. A rectangle is simple (if it isn't rotated at all) but how would I go about drawing something like a filled circle at a specified position with a radius r? I figure I could easily draw what I want using vectors and then create a BitmapData instance from this but this seems a little convoluted and inefficient to me. I've also thought about writing some code to work out which pixels are completely encompassed within the circle and giving these solid colour and then manually calculating the amount to tint pixels at the edge of the circle to create the antialiasing but the routines I have in my head would be even more inefficient than the vector method. Anybody done this, know of any examples/code or have any bright ideas? Thanks, Adrian P ___ Flashcoders@chattyfig.figleaf.com To change your subscription options or search the archive: http://chattyfig.figleaf.com/mailman/listinfo/flashcoders Brought to you by Fig Leaf Software Premier Authorized Adobe Consulting and Training http://www.figleaf.com http://training.figleaf.com
Re: [Flashcoders] Drawing regular, filled shapes into BitmapData
Hi Adrian, I have no experience of doing this whatsoever - but - my immediate feeling is that you should go for your first idea. Create the shapes as vectors, then grab the BitmapData from. This is simply because the routines to draw the shapes are all native to the Flash Player, and they are therefore going to be a _lot_ faster than anything you can come up with in ActionScript. HTH, Ian On 3/20/06, Adrian Park [EMAIL PROTECTED] wrote: I want draw regular shapes with antialiased edges into a blank BitmapData object. A rectangle is simple (if it isn't rotated at all) but how would I go about drawing something like a filled circle at a specified position with a radius r? I figure I could easily draw what I want using vectors and then create a BitmapData instance from this but this seems a little convoluted and inefficient to me. I've also thought about writing some code to work out which pixels are completely encompassed within the circle and giving these solid colour and then manually calculating the amount to tint pixels at the edge of the circle to create the antialiasing but the routines I have in my head would be even more inefficient than the vector method. Anybody done this, know of any examples/code or have any bright ideas? Thanks, Adrian P ___ Flashcoders@chattyfig.figleaf.com To change your subscription options or search the archive: http://chattyfig.figleaf.com/mailman/listinfo/flashcoders Brought to you by Fig Leaf Software Premier Authorized Adobe Consulting and Training http://www.figleaf.com http://training.figleaf.com
Re: [Flashcoders] Drawing regular, filled shapes into BitmapData
That's a good point about the speed of drawing vectors. I think I'll try it this way. Thanks for the suggestion. Adrian P On 3/20/06, Ian Thomas [EMAIL PROTECTED] wrote: Hi Adrian, I have no experience of doing this whatsoever - but - my immediate feeling is that you should go for your first idea. Create the shapes as vectors, then grab the BitmapData from. This is simply because the routines to draw the shapes are all native to the Flash Player, and they are therefore going to be a _lot_ faster than anything you can come up with in ActionScript. HTH, Ian On 3/20/06, Adrian Park [EMAIL PROTECTED] wrote: I want draw regular shapes with antialiased edges into a blank BitmapData object. A rectangle is simple (if it isn't rotated at all) but how would I go about drawing something like a filled circle at a specified position with a radius r? I figure I could easily draw what I want using vectors and then create a BitmapData instance from this but this seems a little convoluted and inefficient to me. I've also thought about writing some code to work out which pixels are completely encompassed within the circle and giving these solid colour and then manually calculating the amount to tint pixels at the edge of the circle to create the antialiasing but the routines I have in my head would be even more inefficient than the vector method. Anybody done this, know of any examples/code or have any bright ideas? Thanks, Adrian P ___ Flashcoders@chattyfig.figleaf.com To change your subscription options or search the archive: http://chattyfig.figleaf.com/mailman/listinfo/flashcoders Brought to you by Fig Leaf Software Premier Authorized Adobe Consulting and Training http://www.figleaf.com http://training.figleaf.com ___ Flashcoders@chattyfig.figleaf.com To change your subscription options or search the archive: http://chattyfig.figleaf.com/mailman/listinfo/flashcoders Brought to you by Fig Leaf Software Premier Authorized Adobe Consulting and Training http://www.figleaf.com http://training.figleaf.com
Re: [Flashcoders] Drawing regular, filled shapes into BitmapData
Ok, So you want to draw a circle in AS, easy enough. Then you want to draw it to a bitmap, and the AA provided by smoothing is not enough? Can you just apply a slight blur filter to the bitmap? On Mar 20, 2006, at 10:36 AM, Ian Thomas wrote: Hi Adrian, I have no experience of doing this whatsoever - but - my immediate feeling is that you should go for your first idea. Create the shapes as vectors, then grab the BitmapData from. This is simply because the routines to draw the shapes are all native to the Flash Player, and they are therefore going to be a _lot_ faster than anything you can come up with in ActionScript. HTH, Ian On 3/20/06, Adrian Park [EMAIL PROTECTED] wrote: I want draw regular shapes with antialiased edges into a blank BitmapData object. A rectangle is simple (if it isn't rotated at all) but how would I go about drawing something like a filled circle at a specified position with a radius r? I figure I could easily draw what I want using vectors and then create a BitmapData instance from this but this seems a little convoluted and inefficient to me. I've also thought about writing some code to work out which pixels are completely encompassed within the circle and giving these solid colour and then manually calculating the amount to tint pixels at the edge of the circle to create the antialiasing but the routines I have in my head would be even more inefficient than the vector method. Anybody done this, know of any examples/code or have any bright ideas? Thanks, Adrian P ___ Flashcoders@chattyfig.figleaf.com To change your subscription options or search the archive: http://chattyfig.figleaf.com/mailman/listinfo/flashcoders Brought to you by Fig Leaf Software Premier Authorized Adobe Consulting and Training http://www.figleaf.com http://training.figleaf.com ___ Flashcoders@chattyfig.figleaf.com To change your subscription options or search the archive: http://chattyfig.figleaf.com/mailman/listinfo/flashcoders Brought to you by Fig Leaf Software Premier Authorized Adobe Consulting and Training http://www.figleaf.com http://training.figleaf.com
Re: [Flashcoders] Drawing regular, filled shapes into BitmapData
Hi Michael, The AA provided by the vector drawing API is fine, I was just wondering if there might be a less convoluted method than drawing vectors and then creating BitmapData from the results. The reason it seems convoluted to me is that I'm actually extracting data from a bitmap image and using this to create a halftone pattern to represent the image. I have already completed this part and have rendered the image as black vector dots which works pretty well. Ultimately though, I want to generate a bitmap image. It's easy to do this with what I already have but I was just wondering if there'd be a more efficient route that bypassed the vector drawing stage. Cheers Adrian P On 3/20/06, Michael Bedar [EMAIL PROTECTED] wrote: Ok, So you want to draw a circle in AS, easy enough. Then you want to draw it to a bitmap, and the AA provided by smoothing is not enough? Can you just apply a slight blur filter to the bitmap? On Mar 20, 2006, at 10:36 AM, Ian Thomas wrote: Hi Adrian, I have no experience of doing this whatsoever - but - my immediate feeling is that you should go for your first idea. Create the shapes as vectors, then grab the BitmapData from. This is simply because the routines to draw the shapes are all native to the Flash Player, and they are therefore going to be a _lot_ faster than anything you can come up with in ActionScript. HTH, Ian On 3/20/06, Adrian Park [EMAIL PROTECTED] wrote: I want draw regular shapes with antialiased edges into a blank BitmapData object. A rectangle is simple (if it isn't rotated at all) but how would I go about drawing something like a filled circle at a specified position with a radius r? I figure I could easily draw what I want using vectors and then create a BitmapData instance from this but this seems a little convoluted and inefficient to me. I've also thought about writing some code to work out which pixels are completely encompassed within the circle and giving these solid colour and then manually calculating the amount to tint pixels at the edge of the circle to create the antialiasing but the routines I have in my head would be even more inefficient than the vector method. Anybody done this, know of any examples/code or have any bright ideas? Thanks, Adrian P ___ Flashcoders@chattyfig.figleaf.com To change your subscription options or search the archive: http://chattyfig.figleaf.com/mailman/listinfo/flashcoders Brought to you by Fig Leaf Software Premier Authorized Adobe Consulting and Training http://www.figleaf.com http://training.figleaf.com ___ Flashcoders@chattyfig.figleaf.com To change your subscription options or search the archive: http://chattyfig.figleaf.com/mailman/listinfo/flashcoders Brought to you by Fig Leaf Software Premier Authorized Adobe Consulting and Training http://www.figleaf.com http://training.figleaf.com ___ Flashcoders@chattyfig.figleaf.com To change your subscription options or search the archive: http://chattyfig.figleaf.com/mailman/listinfo/flashcoders Brought to you by Fig Leaf Software Premier Authorized Adobe Consulting and Training http://www.figleaf.com http://training.figleaf.com