SuperGraphics

SuperGraphics is a vector graphics code framework for Real Studio that supports multiple output options (CoreGraphics, SVG, PDF, etc.) through a single, unified, easy-to-use API. Supported effects include Bezier curves, gradient fills, transparency, and more.

Using SVG templates, SuperGraphics created hundreds of PDF graphics for the Associated Press for the 2006 and 2008 elections.

Background

SuperGraphics came about because of two problems with graphics support in Real Studio (RS).

The first is that Real Studio’s graphics support is out-dated: it’s stuck in the QuickDraw model while the rest of the world has moved on to advanced models like display PostScript, CoreGraphics, & GDI+. Sure, “RS supports CoreGraphics through the Graphics class on OS X” you say. Unfortunately, RS’s implementation of CoreGraphics is nothing to write home about: drawing commands are still limited to integer coordinates and the only practical difference in quality between “.UseOldRenderer” being TRUE or FALSE is the anti-aliasing. In addition, line and primitive rendering exhibit pixel-level inaccuracies because the CoreGraphics drawing commands used by Real Studio still need to support OS X back to version 10.1. Object2D doesn’t make things much better, because it’s routed to the screen through the built-in Graphics class, which, for example, ends up leaving FigureShape objects lumpy due to polygonization and integer placement of segment endpoints. Saving vector data to disk is limited to the obsolete PICT format on Macintosh or EMF on Windows, and don’t even think about printing text from Object2D.

The second problem revolves around code flexibility. Say you’ve just written some code that produces fancy graphics output on screen. How do you take that same source code and produce a higher-resolution version? A PDF version? An SVG version? An EPSF version? Or how about recording the drawing commands for playback at a future time or even on a remote computer? The short answer: It’s not easy. The reality is a lot of effort duplication to produce one version of a graph for screen viewing and a second for high-resolution printing.

As a development company that relies on Real Studio, I found this a tough boat to be in, so I wrote SuperGraphics.

How It Works

SuperGraphics is a graphics abstraction framework for generating multi-target output from a single API. The framework consists of a core, abstract class, SuperGraphics, that abstracts all drawing functionality. Subclasses of SuperGraphics implement their own particular output, whether that is CoreGraphics, SVG, etc. A developer draws graphics through the SuperGraphics API while the subclasses take care of the implementation details for their own API or format. Example: When your code needs to draw a graphic to screen, simply instantiate a SuperGraphicsCoreGraphicsBitmap object and pass it to your drawing code. When you need to export a PDF, instantiate a SuperGraphicsPDF object and pass it to the exact same drawing code.

Implementations

The SuperGraphics API abstracts functionality well enough to implement many different and modern drawing APIs and graphics formats. Currently, SuperGraphics supports the following formats:

  • CoreGraphics bitmaps
    • Output format
  • CoreGraphics PDF
    • Output format
  • SVG (including Adobe Illustrator variants)
    • Input and Output (including full parsing of PostScript-style string paths!)
  • An internal DOM structure

The framework is flexible enough so that the abstract SuperGraphics class could be subclassed to produce output from these other graphics formats and APIs:

  • PDF (any platform)
  • EPSF (any platform)
  • GDI+ (Windows)
  • RS Graphics/Object 2D (any platform)
  • OpenGL (any platform)
License

Open Source (GNU Lesser General Public License).

Requirements

SuperGraphics CoreGraphics implementation requires MBS plug-ins.

Download

(Download link coming soon)