Ask a Question related to Macromedia Flex General Discussion, Design and Development.
-
jarav #1
antialiasing problems with custom geometric transform
:confused;
Should not setting the transform of a component to a custom geometric
transform, say customTransformMatrix, like this:
component.transform.matrix = customTransformMatrix
and then drawing some vector graphics be [h]equivalent[/h] to manually
calculating the pixel coordinates using,
customTransformMatrix.transformPoint and then drawing the vector graphics(
without changing the transform of the component from its default transform)?
Unfortunately, if I follow the first method I don't get antialiasing. If I
follow the second method I get antialiasing.
The simple application below draws two arcs side by side. The arc on the left
is drawn after changing the transform of the component on which I am drawing to
the custom transform. The output looks aliased and bad. The arc on the right is
drawn with the pixel coordinates calculated using matrix.transformPoint. In
this case the drawing looks antialiased and good.
The custom transform involves mapping the width or height, whichever is
smaller, to 10 units, -5 to 5, with the origin at the center.
Since I do see the drawing in both cases, I know that the transform is getting
applied. I don't understand why I don't get antialiasing in one case
<?xml version="1.0" encoding="utf-8"?>
<!-- Custom scaling-->
<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml"
backgroundGradientColors="[0xCCCCCC, 0x66CCFF]"
backgroundColor="0xCCCCCC"<br>
layout="vertical"<mx:Panel id="panel" title="Test Drawing" backgroundColor="0x9CB0BA">
layout="horizontal" width="100%" height="100%" >
<mx:Script>
<![CDATA[
import flash.geom.*;
import flash.display.Graphics;
var arcangle:Number = 120.0;
//arc is drawn in steps of 1 degree
var steps:int = Math.ceil(arcangle/1.0);
var anglestep:Number = arcangle/steps*Math.PI/180.0;
var rad:Number = 3.0;// radius is 3 units
//This gives aliased, bad output.
private function updateCompletel():void
{
var cg:Graphics = canvasl.graphics;
cg.clear();
var w:int = canvasl.width;
var h:int = canvasl.height;
var cscale:Number = (w < h)?w/10.0:h/10.0;
var boxMat:Matrix = new Matrix();
boxMat.createBox(cscale,-cscale,0,w*0.5,h*0.5);
canvasl.transform.matrix = boxMat;
cg.lineStyle(2.5,0xFFFF00,1.0,false,"none");
cg. moveTo(rad,0.0);
for (var i:int=1; i<=steps;++i)
{
var angle:Number = i*anglestep;
var endptx:Number = rad*Math.cos(angle);
var endpty:Number = rad*Math.sin(angle);
cg.lineTo(endptx,endpty);
}
}
//The function below gives smooth, antialiased output, though I am using //the
same scale and transform. The difference between this function and //the one
above is that here I am manually calculating the pixel coordinates //using
transformpoint
private function updateCompleter():void
{
var cg:Graphics = canvasr.graphics;
cg.clear();
var w:int = canvasr.width;
var h:int = canvasr.height;
var cscale:Number = (w < h)?w/10.0:h/10.0;
var boxMat:Matrix = new Matrix();
boxMat.createBox(cscale,-cscale,0,w*0.5,h*0.5);
cg.lineStyle(2.5,0xFFFF00,1.0,false,"none");
var curpt:Point = boxMat.transformPoint(new Point(rad,0.0));
cg. moveTo(curpt.x,curpt.y);
for (var i:int=1; i<=steps;++i)
{
var angle:Number = i*anglestep;
var endptx:Number = rad*Math.cos(angle);
var endpty:Number = rad*Math.sin(angle);
curpt = boxMat.transformPoint(new Point(endptx,endpty));
cg.lineTo(curpt.x,curpt.y);
}
}
]]>
</mx:Script>
<mx:Canvas id="canvasl" left="0" width="50%" height="100%"
updateComplete="updateCompletel()"/>
<mx:Canvas id="canvasr" right="0" width="50%" height="100%"
updateComplete="updateCompleter()"/>
</mx:Panel>
</mx:Application>
jarav Guest
-
Antialiasing
Is there any way to antialias models exported from 3dmax? Can you set up hardare antialiasing AFTER you have completed a project in director? ... -
postgress gnuplot and Geometric
Postgress seems to include all this support for geometric types, lseg,box, etc. Is there any software for actual printing or displaying database... -
Antialiasing in MX 2004 !!!
Hello back from testing the new antialiasing-features of Director MX 2004. Yes there is an increase of the framerate by using the new feature... -
Few general Q's (RAM, reflections, antialiasing)
This is kind of a comparison of what renders better via director (OpenGL or DirectX) Do they both support reflection/environment mapping in... -
3D antialiasing
Anyone know if antialiasing is supported in the 3D enviroment? I have some nicely antialiased png's that I'm using as textures and they aren't so...



Reply With Quote

