this is almost the bare minimum code to use with smart render.
it actually doesn't use any of the smart render.
it would just allow you to render 16 and 32 bit, with the minimal hassle.
just don't froget to set the correct flags in the global setup.
//////////////////////////////////////////////////////////////////////////////////////////////////////
static PF_Err
PreRender(
PF_InData *in_data,
PF_OutData *out_data,
PF_PreRenderExtra *extra)
{
PF_Err err = PF_Err_NONE;
PF_RenderRequest req = extra->input->output_request;
PF_CheckoutResult in_result;
req.channel_mask = PF_ChannelMask_ARGB;
ERR(extra->cb->checkout_layer( in_data->effect_ref,
EFFECT_INPUT,
EFFECT_INPUT,
&req,
in_data->current_time,
in_data->time_step,
in_data->time_scale,
&in_result));
UnionLRect(&in_result.result_rect, &extra->output->result_rect);
UnionLRect(&in_result.max_result_rect, &extra->output->max_result_rect);
return err;
}
static PF_Err
SmartRender(
PF_InData *in_data,
PF_OutData *out_data,
PF_SmartRenderExtra *extra)
{
PF_Err err = PF_Err_NONE,
err2 = PF_Err_NONE;
AEGP_SuiteHandler suites(in_data->pica_basicP);
PF_EffectWorld *input_worldP = NULL,
*output_worldP = NULL;
// checkout input & output buffers.
ERR(extra->cb->checkout_layer_pixels( in_data->effect_ref, SHIFT_INPUT, &input_worldP));
ERR(extra->cb->checkout_output( in_data->effect_ref, &output_worldP));
if(input_worldP && output_worldP)
{
// checkout the required params
PF_ParamDef paramWhatever;
AEFX_CLR_STRUCT(paramWhatever);
ERR(PF_CHECKOUT_PARAM( in_data,
EFFECT_PARAM,
in_data->current_time,
in_data->time_step,
in_data->time_scale,
¶mWhatever));
//process the image according to the correct bit depth
switch (extra->input->bitdepth)
{
case 8:
...process 8 bit...
break;
case 16:
...process 16 bit...
break;
case 32:
...process 32 bit...
break;
}
// Always check in, no matter what the error condition!
ERR2(PF_CHECKIN_PARAM(in_data, ¶mWhatever));
}
return err;
}
//////////////////////////////////////////////////////////////////////////////////////////////////////
p.s.
this code might (and probably does) contain errors.
but with a few tweaks you should be up and running in no time.
:-)