Click to See Complete Forum and Search --> : [Resolved] [Resolved] [Resolved] DevQ: Writing java.awt.shape to Flash / Quad Curves

08-23-2000, 09:33 PM
I am writing a java framework for writing flash files on the fly. The first release will have support for shapes and fonts and will contain a hierarchical animation system supporting fades and motion along bezier paths.

The versatility of the framework relies on implementing interfaces for writing interesting java.awt classes to a flash stream (java.awt.Color,java.awt.geom.AffineTransform etc.) in addition to supporting classes for managing the data.

The project is about half way. All the basic datatypes are in and I have a working ShapeBag class that handles groups non curved styled paths with fill and outline. So far so good.

The trouble started when I tried to add quadratic parametric curves to the shape (java.awt.Shape); whatever data I put into the curve I only get garbage out (read: horribly mangled shapes). It may seem that for some reason the data that Java returns does not map to Flash.

Has anyone had any similar problems? Are the quadratic parametric curves of Java not the same as Flash's Quadratic Bezier curves (even though they both have 3 coordinates and that, as far as I can see, are described to be exactly the same thing in the documentation)?

Sorry about the verbosity. I've been debugging during evenings for the past week and I'm getting .nowhere.

Grateful for any help,


08-24-2000, 10:48 AM
I don't know exactly what could be the problem, but here are a few things you could check:
Are the ordering of the points correct? I don't know about Java, but according to the doc in SWF, You first have the control point delta Control(dx, dy), then the anchor point's Anchor(dx,dy).

Notice in SWF the coordinates are deltas and not actual position coordinates. So the first anchor point is where the current position is. The control point's position is the current position (X, Y) + Control(dx, dy). And the last anchor point's position is (X, Y) + Control(dx, dy) + Anchor(dx, dy).

Oh, and make sure the data is written out in the correct order in the SDK. There are numerous bugs in the SDK, and I wouldn't be suppresed if the CurvedEdgeRecord's writeToSWFStream function is wrong.

Hope this helps a bit.