4#include "../GDocument.h"
5#include "../GMultiSymbol.h"
7#include "../GPathText.h"
8#include "../GPlaceHolder.h"
11using namespace aur::ACPL;
12using namespace aur::PDF;
14static void SetPatternedTextStyle( Text* text, DeviceN* devn,
long percentage, uint16_t maxL )
16 StylePtr fs = text->GetFillStyle();
17 if( fs && fs->ResourceType() == Solid::eResourceType )
19 SolidPtr c = SolidPtr(fs);
22 col.space->ConvertColor( col.channel, GraySpace, col.channel );
23 if( col.channel[0] > maxL )
24 col.channel[0] = 8192;
26 col.channel[0] = uint16_t( percentage * 655.35 );
28 fs =
new Solid( text->GetDocument(), col );
29 text->SetFillStyle( fs );
34static void HandleObject( Object* obj, DeviceN* devn,
float minSize,
float maxSize, uint16_t maxL,
bool& changed )
36 switch( obj->GetType() )
40 for( ObjectPtr kid = GroupPtr( obj )->GetFirstChild(); kid ; kid = kid->GetNext() )
41 HandleObject( kid, devn, minSize, maxSize, maxL, changed );
46 Text* text = (Text*)obj;
48 text->GetProperties( props );
49 if( props.style.size <= maxSize )
52 if( props.style.size <= minSize )
55 percentage = long( 50 + 50 * ( props.style.size - minSize ) / ( maxSize - minSize ) );
56 SetPatternedTextStyle( text, devn, percentage, maxL );
61 case gMultiSymbolType :
63 case gPlaceHolderType:
65 Object* symObj = SymbolPtr(obj)->GetObject();
66 HandleObject( symObj, devn, minSize, maxSize, maxL, changed );
72extern AOIAPI
void ScodixPatternText(
AOI_Page* aoiP,
float minPtSize,
float maxPtSize, uint16_t maxL );
73AOIAPI
void ScodixPatternText(
AOI_Page* aoiP,
float minPtSize,
float maxPtSize, uint16_t maxL )
75 float minSize = minPtSize / 4;
76 float maxSize = maxPtSize / 4;
78 maxL = ( 255 - maxL ) * 257;
80 Page* page = (Page*)aoiP;
81 DeviceN* devn =
new DeviceN( page->GetDocument(), page->GetDocument()->GetDeviceGrayColorSpace() );
82 devn->AddChannel(
"Scodix", NULL );
83 devn->SetFunction(
new IdentityFunction() );
84 for( Object* l = page->GetFirstLayer(); l; l = l->GetNext() )
85 HandleObject( l, devn, minSize, maxSize, maxL, changed );