Core Graphic (cg XFcn / Quartzify bundle)

Having trouble using an XCmd or XFcn? Post your questions here.

Core Graphic (cg XFcn / Quartzify bundle)

Postby LorenzT » Mon Jan 03, 2011 5:59 am

When I was trying to answer a question about anti-aliased graphics I rediscovered the Quartzify or CoreGraphic External. Is anybody using this external and to which extent?
Im asking this because I think that this powerful external isn't used because the learning curve is too steep.

In the last few days I was playing with this external and came up with a solution to use it to convert SC grcs to CG grcs. Thus the SC scripter doesn't need to learn the whole CG language. My final goal is to build a function that converts SC grcs and applies additional cg properties. E.g. calling the function grc2coreGrc (cd grc myPolygon, shadow:yes, alphaFill:0.6)) would render a SC Grc to a coreGrc with shadow and transparency of 0.6 (see examples in attachment).

Does this make sense? Is there interest for such a function?
Or are Core Graphics already in the pipeline for the next upgrade?
Attachments
grc2coreGrc.jpg
grc2coreGrc.jpg (44.85 KiB) Viewed 4130 times
LorenzT
 
Posts: 176
Joined: Thu Dec 02, 2010 2:32 am
Location: Switzerland

Re: Core Graphic (cg XFcn / Quartzify bundle)

Postby gonetriadrr » Mon Jan 03, 2011 9:48 am

Lorenz,
I have a project that converts most graphic types into into bezier moveto, lineto, and curveto coordinates.
I used python to render, and that code needs modification to run on intel boxes.
However, the object coordinate conversion functions can be easily modified to work with the xternal.
I'll be happy to post if you like.

DCS
gonetriadrr
 
Posts: 170
Joined: Fri Jan 08, 2010 6:50 pm

Re: Core Graphic (cg XFcn / Quartzify bundle)

Postby LorenzT » Mon Jan 03, 2011 11:55 am

Dave,
I guess it isn't the BezierPenToolLauncher project you just updated and that I downloaded yesterday? I tried to convert polygons I created with your project but the graphs are to jittery when converted to coreGrcs, I think because there are too many points.
But I'm interested to check out your project that converts graphic types, I could get some more insight into this complex matter.
BTW, as the BezierPenToolLauncher did not start on my Mac I took the bezierPenTool-3e.sc45 file out of the paket and only then I could run it in SC. And why is the fileSize of this project so large (6.5 MB)? Part of it might be the beautiful splash screen ;-)

Lorenz
LorenzT
 
Posts: 176
Joined: Thu Dec 02, 2010 2:32 am
Location: Switzerland

Re: Core Graphic (cg XFcn / Quartzify bundle)

Postby gonetriadrr » Mon Jan 03, 2011 12:19 pm

Just posted to samples.
You'll have to parse the 'render selected graphics' button script to determine the relevant chunks & functions for each object type.
Conversion to cubic beziers may be a little complex but not extremely difficult... angles, distances, and a ratio (the magic number).
Heads-up, in these projects coordinates are built in non-standard order, a converter function in the render palette (vecs2Quartz() ??) translates.
If it matters, angles are also non-standard... 0 degrees at 12:00 incrementing clockwise.

DCS
gonetriadrr
 
Posts: 170
Joined: Fri Jan 08, 2010 6:50 pm

Re: Core Graphic (cg XFcn / Quartzify bundle)

Postby LorenzT » Mon Jan 03, 2011 2:21 pm

I have two problems with this project:
- getSelected doesn't work with kind and style in SC 4.7 (I have reported this bug)
- I get the error msg below from Python; I guess it doesn't wor on Intel. I also tried to call python2.5 to run in 32-bit mode as was suggested in the python man.

Traceback (most recent call last):
File "/private/tmp/myPy/py.tmp", line 6, in <module>
from CoreGraphics import *
File "/BinaryCache/CoreGraphicsBindings/CoreGraphicsBindings-26~139/Root/System/Library/Frameworks/Python.framework/Versions/2.6/Extras/lib/python/CoreGraphics/__init__.py", line 7, in <module>
ImportError: /System/Library/Frameworks/Python.framework/Versions/2.6/Extras/lib/python/CoreGraphics/_CoreGraphics.so: no appropriate 64-bit architecture (see "man python" for running in 32-bit mode)
LorenzT
 
Posts: 176
Joined: Thu Dec 02, 2010 2:32 am
Location: Switzerland

Re: Core Graphic (cg XFcn / Quartzify bundle)

Postby 1nperson0z » Mon Jan 03, 2011 4:18 pm

Hi Lorenz

This was my goal when I first did the external. For most SC graphics the mapping is not too hard - I store the CG parameters in userprops, and apply the CG functions when the graphic is changed ie resized, or a drag or pointerdown event. The idea is/was to have the process transparent - a function to set CG for an object, and after that have it look after itself.

See the pics...

Ian B
Attachments
Screen shot 2011-01-04 at 11.15.18 AM.jpg
In browse mode
Screen shot 2011-01-04 at 11.15.18 AM.jpg (54.49 KiB) Viewed 4099 times
Screen shot 2011-01-04 at 11.02.42 AM.jpg
In pointer mode
Screen shot 2011-01-04 at 11.02.42 AM.jpg (59.34 KiB) Viewed 4099 times
MacBook Pro 2.4Ghz i7 8Gb 10.11.3
1nperson0z
 
Posts: 78
Joined: Wed Jul 09, 2008 3:31 pm
Location: Blue Mountains Australia

Re: Core Graphic (cg XFcn / Quartzify bundle)

Postby LorenzT » Tue Jan 04, 2011 1:00 pm

Hi Ian
Thanks to the many examples in your Quartz Explorer project I can slowly understand the whole concept. So far I can send lines, rectangles, polygons and ovals to my function and it will produce the CG equivalent graphs. Next on the list are arcs. And how does one create rounded rectangles? I guess with arcToPoint and moveToPoint commands. Anyway, there is still a lot to explore...

Lorenz
LorenzT
 
Posts: 176
Joined: Thu Dec 02, 2010 2:32 am
Location: Switzerland


Return to Using Externals

Who is online

Users browsing this forum: No registered users and 2 guests

cron