2D Vector Graphics

Hi everyone…

I have a few questions and hopefully some of you can answer a couple.

I have been writing software for Windows using VB5/6 back in the 90’s and Visual C++ for the last 16 years and Xcode for the last 4. I am mostly familiar with the Windows OS and have mainly been writing Graphics software using GDI+, CoreGraphics and OpenGL.

I want to start a new project but would like to use Xojo, mainly because its style is much like VB6 and to be able to compile 3 platforms at once is neat.

Both GDI+ and CoreGraphics have more-or-less a Graphics interface that works on objects such as GraphicsPath/CGPathRef. A GraphicsPath is basically a vector of paths which contains a vector of nodes. These nodes represent Bezier curves and lines.

  1. Does Xojo contain any such interface for vector-based graphics such as GraphicsPath or CGPathRef. If not, is there an external library that contains such functionality.
  2. Does Xojo have a Matrix/CGAffineTransform type library built in. If not, is there an external library that contains such functionality.
  3. I have written many SVG parsing libraries. To parse an SVG and iterate it’s contents properly, both 1 and 2 (especially 2) must exist as SVG relies heavily on Matrix transforms. So, is there already an SVG parsing library available? I figured there isn’t and would have to port all my C++ code over to Xojo. Which won’t be terrible, as long as #1 and #2 are reasonably satisfied.

The reason I am asking is I am at a cross roads trying to find the best solution to write “Multi-Platform” code as quick as possible. I don’t want to do it the “old way” which means compiling a separate Xcode project and then compiling a Visual C++ project, writing code twice in 2 different languages for the most part.

Thanks for any insight any of you might have…
-andy.

In our MBS Plugins we have CGPath class and functions.
You could try them.
Maybe I can add more for you. Email me if interested.

I just talked to you in Email about your plugins :slight_smile:

Does the CGPath stuff work if I compile for Windows?

Depending on what you are trying to accomplish… look at OBJECT2D and its related functions

CGPath is Mac only.

Yeah – using a mac-only library kinda defeats the purpose of using something like Xojo. I am looking for solution that works where I don’t have to write code twice.

I’ll take a look at Object2D. Does Object2D have matrix transform functionality?

FigureShape looks promising. It’s a collection of lines, cubics and quads – and it looks as though you can iterate through the collection.

Now if there was a “Transform” method in FigureShape which took a matrix as a parameter, I think I would have everything I needed.

OBJECT2D (of which Figureshape is a member) has ROTATE and “move” (via X,Y) functions
you can group them into GROUP2D objects and have quite complex objects

Also look at opengl. Search the forums for “opengl” and “openglsurface”.

[quote=90852:@Dave S]OBJECT2D (of which Figureshape is a member) has ROTATE and “move” (via X,Y) functions
you can group them into GROUP2D objects and have quite complex objects[/quote]

Rotate, translate, scale are the 3 I see implemented. But, generic transforms are missing. So if i wanted to make my own transform up, such as:

Matrix MakeShear(float angleX, float angleY){ return Matrix(1.0f, tanf(angleY), tanf(angleX), 1.0f, 0.0f, 0.0f); }

Then take that Matrix and apply it to a Group2D object.

Maybe since Xojo already implements with Rotate, Translate and Scale, then could add a generic matrix transform. That would cover every base as far as transforms go.