Re: [Flashcoders] Antialiasing BitmapData in AS2?

2007-02-05 Thread Henry Cooke

Thanks for the heads-up, Alias (and good to hear from you again ;) )

The original attachment's up at
http://www.prehensile.co.uk/dropbox/Untitled-1.gif. I'm using the old
blur-lots-then-threshold technique.

I've done a bit more research, and the way I understand it, most
antialiasing techniques work by calculating the sub-pixel positions of
things, and setting the brightness of the closest corresponding pixels
accordingly. In this case, however, I already have an aliased bitmap with no
sub-pixel information.

I guess an algorithm could be conceived that would somehow infer sub-pixel
values, but this feels like it would be unnecessary faff, and very slow.
Anyone know of a quick-and-dirty way of smoothing a bitmap? I guess I could
render at a higher resolution than needed and scale down, to mimic
calculating sub-pixels, but that also feels inefficient. There must be a
clever cheaty way of doing this?

h.

On 04/02/07, Alias™ [EMAIL PROTECTED] wrote:


Can you throw the example image onto a web server so we can see it?
The list strips out attachments :(

Alias

On 01/02/07, Henry Cooke [EMAIL PROTECTED] wrote:
 Hey all,

 I've been mucking about with a metablob-type thing, and have got it
 rendering quite nicely. However, it only renders a black-or-white (1bit)
 bitmap - does anyone know of a good technique to do fast antialiasing on
 such a bitmap? I've tried blurring a bit (which is slow as hell, and
looks
 crap) and rendering at 1/2 res and scaling up with a draw() with
smoothing
 on, which also looks crap. Any better suggestions?

 Example image attached.

 h.


 ___
 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


Re: [Flashcoders] Antialiasing BitmapData in AS2?

2007-02-05 Thread Zeh Fernando

I guess an algorithm could be conceived that would somehow infer sub-pixel
values, but this feels like it would be unnecessary faff, and very slow.
Anyone know of a quick-and-dirty way of smoothing a bitmap? I guess I could
render at a higher resolution than needed and scale down, to mimic
calculating sub-pixels, but that also feels inefficient. There must be a
clever cheaty way of doing this?


From what I know, rendering at a higher size then scaling is the only 
correct way; it's more or less what 3d cards do when rendering antialias 
on games.


All antialiasing techniques that take an image into account and try to 
create antialias out of thin air will just be different blurring 
techniques and will fail under certain specific situations. If you only 
have 'rounded' linear art as the example you linked to this might be 
feasible as you won't have to worry abour corners, so blurring + a few 
different threshold levels will create some nice antialias for you... 
but I personally think rendering at a higher size then scaling would be 
faster.



Zeh
___
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] Antialiasing BitmapData in AS2?

2007-02-05 Thread lincoln
I am also having a similar unsightly antialiasing or ripping issue  
that I was hoping for a solution.  I have a jpg in flash that i'm  
skewing and distorting while animating.  The combination of these  
effects is causing a very noticeable ripping artifact in the image  
where it looks as if the image is literally breaking apart and not  
being able to catch up to the animation.


Does anyone know or have a proper sample of a technique to avoid  
this? Smoothing on, of course...anything else?


-lm

On Feb 5, 2007, at 3:27 AM, Zeh Fernando wrote:

I guess an algorithm could be conceived that would somehow infer  
sub-pixel
values, but this feels like it would be unnecessary faff, and very  
slow.
Anyone know of a quick-and-dirty way of smoothing a bitmap? I  
guess I could

render at a higher resolution than needed and scale down, to mimic
calculating sub-pixels, but that also feels inefficient. There  
must be a

clever cheaty way of doing this?


From what I know, rendering at a higher size then scaling is the  
only correct way; it's more or less what 3d cards do when rendering  
antialias on games.


All antialiasing techniques that take an image into account and  
try to create antialias out of thin air will just be different  
blurring techniques and will fail under certain specific  
situations. If you only have 'rounded' linear art as the example  
you linked to this might be feasible as you won't have to worry  
abour corners, so blurring + a few different threshold levels will  
create some nice antialias for you... but I personally think  
rendering at a higher size then scaling would be faster.



Zeh
___
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] Antialiasing BitmapData in AS2?

2007-02-05 Thread Thimon Sistermans

The answer is in the help files:
use the BitmapData of you image and set the smoothing argument 'true'
 

import flash.display.*;
import flash.geom.*;

var bmpd:BitmapData = new BitmapData(20,20);
var rect1:Rectangle = new Rectangle(0,0,10,10);
var rect2:Rectangle = new Rectangle(0, 10, 10, 20);
var rect3:Rectangle = new Rectangle(10, 0, 20, 10);
var rect4:Rectangle = new Rectangle(10, 10, 20, 20);
bmpd.fillRect(rect1, 0xAAFF);
bmpd.fillRect(rect2, 0xAA00FF00);
bmpd.fillRect(rect3, 0xAAFF);
bmpd.fillRect(rect4, 0xAA99);

this.createEmptyMovieClip(bmp_fill_mc, this.getNextHighestDepth());
with (bmp_fill_mc) {
matrix = new Matrix(); 
matrix.rotate(Math.PI/8);
repeat = true;
smoothing = true;
beginBitmapFill(bmpd, matrix, repeat, smoothing);
moveTo(0, 0);
lineTo(0, 60);
lineTo(60, 60);
lineTo(60, 0);
lineTo(0, 0);
endFill();
}

bmp_fill_mc._xscale = 200;
bmp_fill_mc._yscale = 200;

 

-Original Message-
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] On Behalf Of lincoln
Sent: Monday, February 05, 2007 16:34
To: Flashcoders mailing list
Subject: Re: [Flashcoders] Antialiasing BitmapData in AS2?

I am also having a similar unsightly antialiasing or ripping issue
that I was hoping for a solution.  I have a jpg in flash that i'm
skewing and distorting while animating.  The combination of these
effects is causing a very noticeable ripping artifact in the image where
it looks as if the image is literally breaking apart and not being able
to catch up to the animation.

Does anyone know or have a proper sample of a technique to avoid this?
Smoothing on, of course...anything else?

-lm

On Feb 5, 2007, at 3:27 AM, Zeh Fernando wrote:

 I guess an algorithm could be conceived that would somehow infer 
 sub-pixel values, but this feels like it would be unnecessary faff, 
 and very slow.
 Anyone know of a quick-and-dirty way of smoothing a bitmap? I guess I

 could render at a higher resolution than needed and scale down, to 
 mimic calculating sub-pixels, but that also feels inefficient. There 
 must be a clever cheaty way of doing this?

 From what I know, rendering at a higher size then scaling is the only 
 correct way; it's more or less what 3d cards do when rendering 
 antialias on games.

 All antialiasing techniques that take an image into account and try 
 to create antialias out of thin air will just be different blurring 
 techniques and will fail under certain specific situations. If you 
 only have 'rounded' linear art as the example you linked to this might

 be feasible as you won't have to worry abour corners, so blurring + a 
 few different threshold levels will create some nice antialias for 
 you... but I personally think rendering at a higher size then scaling 
 would be faster.


 Zeh
 ___
 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


Re: [Flashcoders] Antialiasing BitmapData in AS2?

2007-02-05 Thread lincoln
Yeah, I knew about the smoothing option, but even with smoothing on  
you'll find a very noticeable and unsightly ripping of the image when  
undergoing animation.  Anything more accurate and rendering an image  
to NOT cause this effect?  Perhaps some papervision3D?


-lm


On Feb 5, 2007, at 8:03 AM, Thimon Sistermans wrote:



The answer is in the help files:
use the BitmapData of you image and set the smoothing argument 'true'


import flash.display.*;
import flash.geom.*;

var bmpd:BitmapData = new BitmapData(20,20);
var rect1:Rectangle = new Rectangle(0,0,10,10);
var rect2:Rectangle = new Rectangle(0, 10, 10, 20);
var rect3:Rectangle = new Rectangle(10, 0, 20, 10);
var rect4:Rectangle = new Rectangle(10, 10, 20, 20);
bmpd.fillRect(rect1, 0xAAFF);
bmpd.fillRect(rect2, 0xAA00FF00);
bmpd.fillRect(rect3, 0xAAFF);
bmpd.fillRect(rect4, 0xAA99);

this.createEmptyMovieClip(bmp_fill_mc, this.getNextHighestDepth());
with (bmp_fill_mc) {
matrix = new Matrix();
matrix.rotate(Math.PI/8);
repeat = true;
smoothing = true;
beginBitmapFill(bmpd, matrix, repeat, smoothing);
moveTo(0, 0);
lineTo(0, 60);
lineTo(60, 60);
lineTo(60, 0);
lineTo(0, 0);
endFill();
}

bmp_fill_mc._xscale = 200;
bmp_fill_mc._yscale = 200;



-Original Message-
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] On Behalf Of  
lincoln

Sent: Monday, February 05, 2007 16:34
To: Flashcoders mailing list
Subject: Re: [Flashcoders] Antialiasing BitmapData in AS2?

I am also having a similar unsightly antialiasing or ripping issue
that I was hoping for a solution.  I have a jpg in flash that i'm
skewing and distorting while animating.  The combination of these
effects is causing a very noticeable ripping artifact in the image  
where
it looks as if the image is literally breaking apart and not being  
able

to catch up to the animation.

Does anyone know or have a proper sample of a technique to avoid this?
Smoothing on, of course...anything else?

-lm

On Feb 5, 2007, at 3:27 AM, Zeh Fernando wrote:


I guess an algorithm could be conceived that would somehow infer
sub-pixel values, but this feels like it would be unnecessary faff,
and very slow.
Anyone know of a quick-and-dirty way of smoothing a bitmap? I  
guess I



could render at a higher resolution than needed and scale down, to
mimic calculating sub-pixels, but that also feels inefficient. There
must be a clever cheaty way of doing this?


From what I know, rendering at a higher size then scaling is the only
correct way; it's more or less what 3d cards do when rendering
antialias on games.

All antialiasing techniques that take an image into account and try
to create antialias out of thin air will just be different blurring
techniques and will fail under certain specific situations. If you
only have 'rounded' linear art as the example you linked to this  
might



be feasible as you won't have to worry abour corners, so blurring + a
few different threshold levels will create some nice antialias for
you... but I personally think rendering at a higher size then scaling
would be faster.


Zeh
___
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



___
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] Antialiasing BitmapData in AS2?

2007-02-04 Thread Alias™

Can you throw the example image onto a web server so we can see it?
The list strips out attachments :(

Alias

On 01/02/07, Henry Cooke [EMAIL PROTECTED] wrote:

Hey all,

I've been mucking about with a metablob-type thing, and have got it
rendering quite nicely. However, it only renders a black-or-white (1bit)
bitmap - does anyone know of a good technique to do fast antialiasing on
such a bitmap? I've tried blurring a bit (which is slow as hell, and looks
crap) and rendering at 1/2 res and scaling up with a draw() with smoothing
on, which also looks crap. Any better suggestions?

Example image attached.

h.


___
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