1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
#ifndef _ofxInteract_h_
#define _ofxInteract_h_
#include "ofxCore.h"
/*
Software License :
Copyright (c) 2007-2015, The Open Effects Association Ltd. All rights reserved.
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are met:
* Redistributions of source code must retain the above copyright notice,
this list of conditions and the following disclaimer.
* Redistributions in binary form must reproduce the above copyright notice,
this list of conditions and the following disclaimer in the documentation
and/or other materials provided with the distribution.
* Neither the name The Open Effects Association Ltd, nor the names of its
contributors may be used to endorse or promote products derived from this
software without specific prior written permission.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR
ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
#ifdef __cplusplus
extern "C" {
#endif
/** @file ofxInteract.h
Contains the API for ofx plugin defined GUIs and interaction.
*/
#define kOfxInteractSuite "OfxInteractSuite"
/** @brief Blind declaration of an OFX interactive gui
*/
typedef struct OfxInteract *OfxInteractHandle;
/**
\addtogroup PropertiesAll
*/
/*@{*/
/**
\defgroup PropertiesInteract Interact Property Definitions
These are the list of properties used by the Interact API documented in \ref CustomInteractionPage.
*/
/*@{*/
/** @brief The set of parameters on which a value change will trigger a redraw for an interact.
- Type - string X N
- Property Set - interact instance property (read/write)
- Default - no values set
- Valid Values - the name of any parameter associated with this interact.
If the interact is representing the state of some set of OFX parameters, then is will
need to be redrawn if any of those parameters' values change. This multi-dimensional property
links such parameters to the interact.
The interact can be slaved to multiple parameters (setting index 0, then index 1 etc...)
*/
#define kOfxInteractPropSlaveToParam "OfxInteractPropSlaveToParam"
/** @brief The size of a real screen pixel under the interact's canonical projection.
- Type - double X 2
- Property Set - interact instance and actions (read only)
*/
#define kOfxInteractPropPixelScale "OfxInteractPropPixelScale"
/** @brief The background colour of the application behind an interact instance
- Type - double X 3
- Property Set - read only on the interact instance and in argument to the ::kOfxInteractActionDraw action
- Valid Values - from 0 to 1
The components are in the order red, green then blue.
*/
#define kOfxInteractPropBackgroundColour "OfxInteractPropBackgroundColour"
/** @brief The suggested colour to draw a widget in an interact, typically for overlays.
- Type - double X 3
- Property Set - read only on the interact instance
- Default - 1.0
- Valid Values - greater than or equal to 0.0
Some applications allow the user to specify colours of any overlay via a colour picker, this
property represents the value of that colour. Plugins are at liberty to use this or not when
they draw an overlay.
If a host does not support such a colour, it should return kOfxStatReplyDefault
*/
#define kOfxInteractPropSuggestedColour "OfxInteractPropSuggestedColour"
/** @brief The position of the pen in an interact.
- Type - double X 2
- Property Set - read only in argument to the ::kOfxInteractActionPenMotion, ::kOfxInteractActionPenDown and ::kOfxInteractActionPenUp actions
This value passes the postion of the pen into an interact. This is in the interact's canonical coordinates.
*/
#define kOfxInteractPropPenPosition "OfxInteractPropPenPosition"
/** @brief The position of the pen in an interact in viewport coordinates.
- Type - int X 2
- Property Set - read only in argument to the ::kOfxInteractActionPenMotion, ::kOfxInteractActionPenDown and ::kOfxInteractActionPenUp actions
This value passes the postion of the pen into an interact. This is in the interact's openGL viewport coordinates, with 0,0 being at the bottom left.
*/
#define kOfxInteractPropPenViewportPosition "OfxInteractPropPenViewportPosition"
/** @brief The pressure of the pen in an interact.
- Type - double X 1
- Property Set - read only in argument to the ::kOfxInteractActionPenMotion, ::kOfxInteractActionPenDown and ::kOfxInteractActionPenUp actions
- Valid Values - from 0 (no pressure) to 1 (maximum pressure)
This is used to indicate the status of the 'pen' in an interact. If a pen has only two states (eg: a mouse button), these should map to 0.0 and 1.0.
*/
#define kOfxInteractPropPenPressure "OfxInteractPropPenPressure"
/** @brief Indicates whether the dits per component in the interact's openGL frame buffer
- Type - int X 1
- Property Set - interact instance and descriptor (read only)
*/
#define kOfxInteractPropBitDepth "OfxInteractPropBitDepth"
/** @brief Indicates whether the interact's frame buffer has an alpha component or not
- Type - int X 1
- Property Set - interact instance and descriptor (read only)
- Valid Values - This must be one of
- 0 indicates no alpha component
- 1 indicates an alpha component
*/
#define kOfxInteractPropHasAlpha "OfxInteractPropHasAlpha"
/*@}*/
/*@}*/
/**
\addtogroup ActionsAll
*/
/*@{*/
/**
\defgroup InteractActions Interact Actions
These are the list of actions passed to an interact's entry point function. For more details on how to deal with actions, see \ref InteractActions.
*/
/*@{*/
/** @brief
This action is the first action passed to an interact. It is
where an interact defines how it behaves and the resources it needs to
function.
If not trapped, the default action is for the host to carry on as normal
Note that the handle passed in acts as a descriptor for, rather than an
instance of the interact.
@param handle handle to the interact descriptor, cast to an \ref OfxInteractHandle
@param inArgs is redundant and is set to NULL
@param outArgs is redundant and is set to NULL
\pre
- The plugin has been loaded and the effect described.
@returns
- \ref kOfxStatOK the action was trapped and all was well
- \ref kOfxStatErrMemory in which case describe may be called again after a memory purge
- \ref kOfxStatFailed something was wrong, the host should ignore the interact
- \ref kOfxStatErrFatal
*/
#define kOfxActionDescribeInteract kOfxActionDescribe
/** @brief
This action is the first action passed to an interact instance after its creation.
It is there to allow a plugin to create any per-instance data structures it may need.
@param handle handle to the interact instance, cast to an \ref OfxInteractHandle
@param inArgs is redundant and is set to NULL
@param outArgs is redundant and is set to NULL
\pre
- \ref kOfxActionDescribe has been called on this interact
\post
- the instance pointer will be valid until the \ref kOfxActionDestroyInstance
action is passed to the plug-in with the same instance handle
@returns
- \ref kOfxStatOK the action was trapped and all was well
- \ref kOfxStatReplyDefault the action was ignored, but all was well anyway
- \ref kOfxStatErrFatal
- \ref kOfxStatErrMemory in which case this may be called again after a memory purge
- \ref kOfxStatFailed in which case the host should ignore this interact
*/
#define kOfxActionCreateInstanceInteract kOfxActionCreateInstance
/**@brief
This action is the last passed to an interact's instance before its
destruction. It is there to allow a plugin to destroy any per-instance
data structures it may have created.
@param handle handle to the interact instance, cast to an \ref OfxInteractHandle
@param inArgs is redundant and is set to NULL
@param outArgs is redundant and is set to NULL
\pre
- \ref kOfxActionCreateInstance
has been called on the handle,
- the instance has not had any of its members destroyed yet
\post
- the instance pointer is no longer valid and any operation on it will be undefined
@returns
To some extent, what is returned is moot, a bit like throwing an
exception in a C++ destructor, so the host should continue destruction
of the instance regardless
- \ref kOfxStatOK the action was trapped and all was well
- \ref kOfxStatReplyDefault the action was ignored as the effect had nothing to do
- \ref kOfxStatErrFatal
- \ref kOfxStatFailed something went wrong, but no error code appropriate.
*/
#define kOfxActionDestroyInstanceInteract kOfxActionDestroyInstance
/** @brief
This action is issued to an interact whenever the host needs the plugin
to redraw the given interact. The interact should issue any openGL calls
it needs at this point.
Note that the interact may (in the case of custom parameter GUIS) or may
not (in the case of image effect overlays) be required to swap buffers,
that is up to the kind of interact.
@param handle handle to an interact instance, cast to an \ref OfxInteractHandle
@param inArgs has the following properties on an image effect plugin
- \ref kOfxPropEffectInstance a handle to the effect for which the interact has been,
- \ref kOfxInteractPropPixelScale the scale factor to convert cannonical pixels to screen pixels
- \ref kOfxInteractPropBackgroundColour the background colour of the application behind the current view
- \ref kOfxPropTime the effect time at which changed occured
- \ref kOfxImageEffectPropRenderScale the render scale applied to any image fetched
@param outArgs is redundant and is set to NULL
\pre
- \ref kOfxActionCreateInstance has been called on the instance handle
- the openGL context for this interact has been set
- the projection matrix will correspond to the interact's cannonical view
@returns
- \ref kOfxStatOK the action was trapped and all was well
- \ref kOfxStatReplyDefault the action was ignored
- \ref kOfxStatErrFatal
- \ref kOfxStatFailed something went wrong, the host should ignore this interact in future
*/
#define kOfxInteractActionDraw "OfxInteractActionDraw"
/** @brief
This action is issued whenever the pen moves an the interact's has
focus. It should be issued whether the pen is currently up or down.
No openGL calls should be issued by the plug-in during this action.
@param handle handle to an interact instance, cast to an \ref OfxInteractHandle
@param inArgs has the following properties on an image effect plugin
- \ref kOfxPropEffectInstance a handle to the effect for which the interact has been,
- \ref kOfxInteractPropPixelScale the scale factor to convert cannonical pixels to screen pixels
- \ref kOfxInteractPropBackgroundColour the background colour of the application behind the current view
- \ref kOfxPropTime the effect time at which changed occured
- \ref kOfxImageEffectPropRenderScale the render scale applied to any image fetched
- \ref kOfxInteractPropPenPosition postion of the pen in,
- \ref kOfxInteractPropPenViewportPosition position of the pen in,
- \ref kOfxInteractPropPenPressure the pressure of the pen,
@param outArgs is redundant and is set to NULL
\pre
- \ref kOfxActionCreateInstance
has been called on the instance handle
- the current instance handle has had
\ref kOfxInteractActionGainFocus called on it
\post
- if the instance returns \ref kOfxStatOK the host should not
pass the pen motion to any other interactive object it may own that
shares the same view.
@returns
- \ref kOfxStatOK the action was trapped and the host should not pass the event to other objects it may own
- \ref kOfxStatReplyDefault the action was not trapped and the host can deal with it if it wants
*/
#define kOfxInteractActionPenMotion "OfxInteractActionPenMotion"
/**@brief
This action is issued when a pen transitions for the 'up' to the 'down'
state.
No openGL calls should be issued by the plug-in during this action.
@param handle handle to an interact instance, cast to an \ref OfxInteractHandle
@param inArgs has the following properties on an image effect plugin,
- \ref kOfxPropEffectInstance a handle to the effect for which the interact has been,
- \ref kOfxInteractPropPixelScale the scale factor to convert cannonical pixels to screen pixels
- \ref kOfxInteractPropBackgroundColour the background colour of the application behind the current view
- \ref kOfxPropTime the effect time at which changed occured
- \ref kOfxImageEffectPropRenderScale the render scale applied to any image fetched
- \ref kOfxInteractPropPenPosition position of the pen in
- \ref kOfxInteractPropPenViewportPosition position of the pen in
- \ref kOfxInteractPropPenPressure the pressure of the pen
@param outArgs is redundant and is set to NULL
\pre
- \ref kOfxActionCreateInstance
has been called on the instance handle,
- the current instance handle has had
\ref kOfxInteractActionGainFocus
called on it
\post
- if the instance returns \ref kOfxStatOK, the host should not
pass the pen motion to any other interactive object it may own that
shares the same view.
@returns
- \ref kOfxStatOK, the action was trapped and the host should not pass the event to other objects it may own
- \ref kOfxStatReplyDefault , the action was not trapped and the host can deal with it if it wants
*/
#define kOfxInteractActionPenDown "OfxInteractActionPenDown"
/**@brief
This action is issued when a pen transitions for the 'down' to the 'up'
state.
No openGL calls should be issued by the plug-in during this action.
@param handle handle to an interact instance, cast to an \ref OfxInteractHandle
@param inArgs has the following properties on an image effect plugin,
- \ref kOfxPropEffectInstance a handle to the effect for which the interact has been,
- \ref kOfxInteractPropPixelScale the scale factor to convert cannonical pixels to screen pixels
- \ref kOfxInteractPropBackgroundColour the background colour of the application behind the current view
- \ref kOfxPropTime the effect time at which changed occured
- \ref kOfxImageEffectPropRenderScale the render scale applied to any image fetched
- \ref kOfxInteractPropPenPosition position of the pen in
- \ref kOfxInteractPropPenViewportPosition position of the pen in
- \ref kOfxInteractPropPenPressure the pressure of the pen
@param outArgs is redundant and is set to NULL
\pre
- \ref kOfxActionCreateInstance
has been called on the instance handle,
- the current instance handle has had
\ref kOfxInteractActionGainFocus called on it
\post
- if the instance returns \ref kOfxStatOK, the host should not
pass the pen motion to any other interactive object it may own that
shares the same view.
@returns
- \ref kOfxStatOK, the action was trapped and the host should not pass the event to other objects it may own
- \ref kOfxStatReplyDefault , the action was not trapped and the host can deal with it if it wants
*/
#define kOfxInteractActionPenUp "OfxInteractActionPenUp"
/**@brief
This action is issued when a key on the keyboard is depressed.
No openGL calls should be issued by the plug-in during this action.
@param handle handle to an interact instance, cast to an \ref OfxInteractHandle
@param inArgs has the following properties on an image effect plugin
- \ref kOfxPropEffectInstance a handle to the effect for which the interact has been,
- \ref kOfxPropKeySym single integer value representing the key that was manipulated,
this may not have a UTF8 representation (eg: a return key)
- \ref kOfxPropKeyString UTF8 string representing a character key that was pressed, some
keys have no UTF8 encoding, in which case this is ""
- \ref kOfxPropTime the effect time at which changed occured
- \ref kOfxImageEffectPropRenderScale the render scale applied to any image fetched
@param outArgs is redundant and is set to NULL
\pre
- \ref kOfxActionCreateInstance
has been called on the instance handle,
- the current instance handle has had
\ref kOfxInteractActionGainFocus called on it
\post
- if the instance returns \ref kOfxStatOK, the host should not
pass the pen motion to any other interactive object it may own that
shares the same focus.
@returns
- \ref kOfxStatOK , the action was trapped and the host should not pass the event to other objects it may own
- \ref kOfxStatReplyDefault , the action was not trapped and the host can deal with it if it wants
*/
#define kOfxInteractActionKeyDown "OfxInteractActionKeyDown"
/**@brief
This action is issued when a key on the keyboard is released.
No openGL calls should be issued by the plug-in during this action.
@param handle handle to an interact instance, cast to an \ref OfxInteractHandle
@param inArgs has the following properties on an image effect plugin
- \ref kOfxPropEffectInstance a handle to the effect for which the interact has been,
- \ref kOfxPropKeySym single integer value representing the key that was manipulated,
this may not have a UTF8 representation (eg: a return key)
- \ref kOfxPropKeyString UTF8 string representing a character key that was pressed, some
keys have no UTF8 encoding, in which case this is ""
- \ref kOfxPropTime the effect time at which changed occured
- \ref kOfxImageEffectPropRenderScale the render scale applied to any image fetched
@param outArgs is redundant and is set to NULL
\pre
- \ref kOfxActionCreateInstance
has been called on the instance handle,
- the current instance handle has had
\ref kOfxInteractActionGainFocus called on it
\post
- if the instance returns \ref kOfxStatOK, the host should not
pass the pen motion to any other interactive object it may own that
shares the same focus.
@returns
- \ref kOfxStatOK , the action was trapped and the host should not pass the event to other objects it may own
- \ref kOfxStatReplyDefault , the action was not trapped and the host can deal with it if it wants
*/
#define kOfxInteractActionKeyUp "OfxInteractActionKeyUp"
/**@brief
This action is issued when a key on the keyboard is repeated.
No openGL calls should be issued by the plug-in during this action.
@param handle handle to an interact instance, cast to an \ref OfxInteractHandle
@param inArgs has the following properties on an image effect plugin
- \ref kOfxPropEffectInstance a handle to the effect for which the interact has been,
- \ref kOfxPropKeySym single integer value representing the key that was manipulated,
this may not have a UTF8 representation (eg: a return key)
- \ref kOfxPropKeyString UTF8 string representing a character key that was pressed, some
keys have no UTF8 encoding, in which case this is ""
- \ref kOfxPropTime the effect time at which changed occured
- \ref kOfxImageEffectPropRenderScale the render scale applied to any image fetched
@param outArgs is redundant and is set to NULL
\pre
- \ref kOfxActionCreateInstance
has been called on the instance handle,
- the current instance handle has had
\ref kOfxInteractActionGainFocus called on it
\post
- if the instance returns \ref kOfxStatOK, the host should not
pass the pen motion to any other interactive object it may own that
shares the same focus.
@returns
- \ref kOfxStatOK , the action was trapped and the host should not pass the event to other objects it may own
- \ref kOfxStatReplyDefault , the action was not trapped and the host can deal with it if it wants
*/
#define kOfxInteractActionKeyRepeat "OfxInteractActionKeyRepeat"
/**@brief
This action is issued when an interact gains input focus.
No openGL calls should be issued by the plug-in during this action.
@param handle handle to an interact instance, cast to an \ref OfxInteractHandle
@param inArgs has the following properties on an image effect plugin
- \ref kOfxPropEffectInstance a handle to the effect for which the interact is being used on,
- \ref kOfxInteractPropPixelScale the scale factor to convert cannonical pixels to screen pixels,
- \ref kOfxInteractPropBackgroundColour the background colour of the application behind the current view
- \ref kOfxPropTime the effect time at which changed occured
- \ref kOfxImageEffectPropRenderScale the render scale applied to any image fetched
@param outArgs is redundant and is set to NULL
\pre
- \ref kOfxActionCreateInstance
has been called on the instance handle,
@returns
- \ref kOfxStatOK the action was trapped
- \ref kOfxStatReplyDefault the action was not trapped
*/
#define kOfxInteractActionGainFocus "OfxInteractActionGainFocus"
/**@brief
This action is issued when an interact loses input focus.
No openGL calls should be issued by the plug-in during this action.
@param handle handle to an interact instance, cast to an \ref OfxInteractHandle
@param inArgs has the following properties on an image effect plugin
- \ref kOfxPropEffectInstance a handle to the effect for which the interact is being used on,
- \ref kOfxInteractPropPixelScale the scale factor to convert cannonical pixels to screen pixels,
- \ref kOfxInteractPropBackgroundColour the background colour of the application behind the current view
- \ref kOfxPropTime the effect time at which changed occured
- \ref kOfxImageEffectPropRenderScale the render scale applied to any image fetched
@param outArgs is redundant and is set to NULL
\pre
- \ref kOfxActionCreateInstance
has been called on the instance handle,
@returns
- \ref kOfxStatOK the action was trapped
- \ref kOfxStatReplyDefault the action was not trapped
*/
#define kOfxInteractActionLoseFocus "OfxInteractActionLoseFocus"
/*@}*/
/*@}*/
/** @brief OFX suite that allows an effect to interact with an openGL window so as to provide custom interfaces.
*/
typedef struct OfxInteractSuiteV1 {
/** @brief Requests an openGL buffer swap on the interact instance */
OfxStatus (*interactSwapBuffers)(OfxInteractHandle interactInstance);
/** @brief Requests a redraw of the interact instance */
OfxStatus (*interactRedraw)(OfxInteractHandle interactInstance);
/** @brief Gets the property set handle for this interact handle */
OfxStatus (*interactGetPropertySet)(OfxInteractHandle interactInstance,
OfxPropertySetHandle *property);
} OfxInteractSuiteV1;
#ifdef __cplusplus
}
#endif
#endif