Aurelon Open API 8.1.1
Loading...
Searching...
No Matches
AOI_Renderer.cpp
1#include "./AOI_Renderer.h"
2#include "./AOI_TIFFRenderer.h"
3#include "../GRenderer.h"
4#include "../GDocument.h"
5#include "../GInstance.h"
6
7using namespace aur;
8using namespace aur::PDF;
9using namespace aur::ACPL;
10
127 mDocument( &doc ),
128 mRenderer( NULL ),
129 mSimpleRenderer( NULL )
130{
131}
132
133AOI_Renderer::~AOI_Renderer()
134{
135 mDocument->mDocument->SetRenderer( NULL );
136 delete mRenderer;
137 delete mSimpleRenderer;
138}
139
149{
150 if( mRenderer )
151 mRenderer->SetColorConvertCallBack( cb, ref );
152 if( mSimpleRenderer )
153 mSimpleRenderer->SetColorConvertCallBack( cb, ref );
154}
155
164{
165 if( mRenderer )
166 mRenderer->SetAntiAliasGlyph( on );
167}
168
187::ExceptionCode AOI_Renderer::Setup( const aur::ACPL::FileSpec& profilePath, const aur::ACPL::StringList& extraChannels, int32_t bytesPerComponent, void* banddata, int32_t w, int32_t h, bool alpha, bool shape )
188{
189 if( mDocument->mUseSimpleRenderer )
190 {
191 delete mSimpleRenderer;
192 mSimpleRenderer = NULL;
193
194 mSimpleRenderer = new AOI_TIFFRenderer( *mDocument );
195 }
196 else
197 {
198 if( mRenderer && mRenderer->mBytesPerComponent != bytesPerComponent )
199 {
200 delete mRenderer;
201 mRenderer = NULL;
202 }
203 if( mRenderer == NULL )
204 {
205 mRenderer = new Renderer( bytesPerComponent );
206 mDocument->mDocument->SetRenderer( mRenderer );
207 }
208 }
209
210 try
211 {
212 if( mRenderer )
213 {
214 mRenderer->Setup( profilePath, extraChannels, w, h, alpha, shape, false );
215 mRenderer->RenderPartPrepare( (uint8_t*)banddata, w, h );
216 }
217 else
218 {
219 mSimpleRenderer->Setup( profilePath, extraChannels, banddata, w, h, alpha );
220 }
221 }
222 catch( aur::ExceptionCode err )
223 {
224 delete mRenderer;
225 mRenderer = NULL;
226
227 delete mSimpleRenderer;
228 mSimpleRenderer = NULL;
229
230 return err;
231 }
232 return NoError;
233}
234
243void AOI_Renderer::SetMapping( const AOI_Mapping& docToBandMap )
244{
245 if( mRenderer )
246 mRenderer->SetMapping( (const Mapping&)docToBandMap );
247 else if( mSimpleRenderer )
248 mSimpleRenderer->SetMapping( docToBandMap );
249}
250
265void AOI_Renderer::Render( const AOI_Rectangle& docRect, AOI_ObjectPtr toRenderObj )
266{
267 if( mRenderer )
268 {
269 mDocument->mDocument->Invalidate( (const FRectangle&)docRect );
270 if( toRenderObj )
271 mRenderer->RenderObject( mDocument->mDocument, reinterpret_cast<PDF::ObjectPtr>( toRenderObj ), true, NULL );
272 mRenderer->RenderDocument( mDocument->mDocument, true, false, NULL, mDocument->mDocument->GetCurrentPage() );
273 }
274 else if( mSimpleRenderer )
275 mSimpleRenderer->Render();
276}
PDF Document.
3x3 matrix
Definition AOI_Types.h:113
Base class for all graphic objects.
Definition AOI_Object.h:13
Rectangle.
Definition AOI_Types.h:148
ExceptionCode Setup(const aur::ACPL::FileSpec &profilePath, const aur::ACPL::StringList &extraChannels, int32_t bytesPerComponent, void *banddata, int32_t w, int32_t h, bool alpha, bool shape=false)
void SetColorConvertCallBack(ColorConvertCB cb, void *ref)
void SetAntiAlias(bool)
void SetMapping(const AOI_Mapping &docToBandMap)
void Render(const AOI_Rectangle &docRect, AOI_ObjectPtr toRenderObj=NULL)
AOI_Renderer(AOI_Document &doc)
bool(* ColorConvertCB)(ColorConvert_Data &, void *)
CMM callback routine.