ImageFlavor[] inlineFlavors = determineSupportedImageFlavors(renderingContext);
ImageManager manager = renderingContext.getUserAgent().getFactory().getImageManager();
ImageProviderPipeline[] inlineCandidates
= manager.getPipelineFactory().determineCandidatePipelines(
info, inlineFlavors);
ImageProviderPipeline inlineChoice = manager.choosePipeline(inlineCandidates);
ImageFlavor inlineFlavor = (inlineChoice != null
? inlineChoice.getTargetFlavor() : null);
//Create a rendering context for form creation
PSRenderingContext formContext = renderingContext.toFormContext();
//Investigate choice for form mode
ImageFlavor[] formFlavors = determineSupportedImageFlavors(formContext);
ImageProviderPipeline[] formCandidates
= manager.getPipelineFactory().determineCandidatePipelines(
info, formFlavors);
ImageProviderPipeline formChoice = manager.choosePipeline(formCandidates);
ImageFlavor formFlavor = (formChoice != null ? formChoice.getTargetFlavor() : null);
//Inline if form is not supported or if a better choice is available with inline mode
return formFlavor == null || !formFlavor.equals(inlineFlavor);
}