Last modified 5 years ago Last modified on 2013-07-29 11:43:26

Native drawing in v14

Plugin SDK v14 implements the support for native drawing.
Native Drawing mode allows you to draw directly in CGContext/HDC using the system API.
Important: In native mode you are only allowed to draw during the eAE_Update and eAE_DesignUpdate

eAE_Update:

fMessage is a HDC on windows and a CGContextRef on OSX.

The CGContext use reverted axis (quickdraw).

eAE_DesignUpdate:

Windows:

Plugin props . fWinHDC is HDC
Plugin props . fWinHWND is NULL
Plugin props . fMacWindow is NULL
Plugin props . fMacPort is NULL

OS X:

Plugin props . fMacPort is a CGContextRef
Plugin props . fMacWindow is NULL
Plugin props . fWinHDC is NULL
Plugin props . fWinHWND is NULL

Helpers

PA_RedrawArea

Because the graphic context is only valid during update eAE_Update, PA_RedrawArea is provided to allow to invalidate your external area.

Your can only call PA_RedrawArea from the plugin event loop, upon the reception of the events eAE_Update and eAE_DesignUpdate:

void PA_RedrawArea ( PA_PluginParameters params, char inNow,PA_Rect* inRect)

inNow

If true invalidate the plugin area and then force update event. If false invalidate the plugin area and wait system update event

inRect

if NULL invalidate the whole area

PA_GetAreaPortBounds

PA_Rect PA_GetAreaPortBounds( PA_PluginParameters params)

returns the bounds of the graphic context hosting the plugin area. This is required to change CGContext axis.

PA_UseQuartzAxis

void PA_UseQuartzAxis( PA_PluginParameters params, short *outAreaX, short *outAreaY, short* outAreaWidth, short *outAreaHeight);

MAC Only: Changes the CGContext coordinate system to Quartz, and returns the plugin area bounds in Quartz coordinate system.
By default 4D works in Quickdraw coordinate system, you will need to switch to Quartz to draw text/picture, otherwise text/picture will be flipped
.

PA_UseQuickdrawAxis

void PA_UseQuickdrawAxis( PA_PluginParameters params, short *outAreaX, short *outAreaY, short* outAreaWidth, short *outAreaHeight);

MAC Only: Changes the CGContext coordinate system to QuickDraw?, and returns the plugin area bounds in QuickDraw? coordinate system