% Copyright (c)1992-2005 Corel Corporation
% All rights reserved.     v13 r0.0
/CorelShfillMapColor{SepMode_5 0 eq{bShfillDeviceN not{[exch aload pop pop
@tc_5]}if}{bShfillDeviceN{[exch aload pop tint_params aload pop sNamesDeviceN
aload pop]}if[exch separate_color aload pop pop @tc_5 SepsColor not{4 1 roll
pop pop pop 1 exch sub}if]}ifelse}bd/CorelShfillGetColorSpace{SepMode_5 0 eq
bShfillDeviceN and{[/DeviceN sNamesDeviceN/DeviceCMYK{tint_params
CorelTintTransformFunction}]}{SepMode_5 0 eq{/DeviceCMYK}{SepsColor{
/DeviceCMYK}{/DeviceGray}ifelse}ifelse}ifelse}bd/CorelShfillDoLinearParams{
flattenpath pathbbox 2 index add 2 div/$y1 xd/$x1 xd $y1/$y0 xd pop/$x0 xd $x1
$x0 sub $pad mul/$pdw xd $x1 $pdw sub/$x1 xd $x0 $pdw add/$x0 xd $x0 $x1 add 2
div/$xmid xd $y0/$ymid xd $xmid $x1 sub/$x1 xd $x1 neg/$x0 xd 0/$y0 xd 0/$y1 xd
$xmid $ymid translate/Coords[$x1 $y1 $x0 $y0]}def
/CorelShfillDoRadialSquareParams{flattenpath pathbbox/$y1 xd/$x1 xd/$y0 xd/$x0
xd $x1 $x0 sub/$width xd $y1 $y0 sub/$height xd $rox $width mul/$row xd $roy
$height mul/$roh xd $x0 $width 2 div add/$x0 xd $y0 $height 2 div add/$y0 xd
$x0 $row add/$x0 xd $y0 $roh add/$y0 xd $x0/$x1 xd $y0/$y1 xd $width dup mul
$height dup mul add sqrt 2 div $row dup mul $roh dup mul add sqrt add 1 $pad 2
mul sub mul/$rad0 xd 0/$rad1 xd}def/CorelShfillDoRadialParams{
CorelShfillDoRadialSquareParams/Coords[$x0 $y0 $rad0 $x1 $y1 $rad1]}def
/CorelShfillDoSquareParams{CorelShfillDoRadialSquareParams $x0 $y0 translate
$rad0/$x1 xd $x1 neg/$x0 xd $rad0/$y1 xd $y1 neg/$y0 xd/DataSource[0 0 0 1 0
$x1 $y1 0 0 $x0 $y1 0 2 $x0 $y0 0 2 $x1 $y0 0 2 $x1 $y1 0]}def
/CorelShfillFunction{<< $fty 0 eq{/ShadingType 2}{$fty 1 eq{/ShadingType 3}{
$fty 3 eq{/ShadingType 4}if}ifelse}ifelse/ColorSpace CorelShfillGetColorSpace
/Domain[0 1]$fty 0 eq{CorelShfillDoLinearParams}{$fty 1 eq{
CorelShfillDoRadialParams}{$fty 3 eq{CorelShfillDoSquareParams}if}ifelse
}ifelse/Function <</FunctionType 3/Domain[0 1]/Functions[/dMidPointPS 0.5 log
$fmp 100 div log div def 1 1 $fsc 1 sub{/nColor exch def <</FunctionType 2
/Domain[0 1]/N dMidPointPS/C0 $fsa nColor 1 sub 2 mul get CorelShfillMapColor
/C1 $fsa nColor 2 mul get CorelShfillMapColor >>}for]/Encode[$fsc 1 sub{0 1}
repeat]/Bounds[$fsc 2 gt{1 1 $fsc 2 sub{/nColor exch def/nBandPos 0 def 0 1
nColor{dup nColor le{$fsa exch 2 mul 1 add get nBandPos add/nBandPos exch def
}if}for nBandPos $fst div}for}if]>> $pad 0 gt{/Extend[true true]}{/Extend
[false false]}ifelse >> shfill}bd/CorelShfillDoFill{$ctm setmatrix wclip @gs
$fty 3 eq $pad 0 gt and{bGradDeviceN{$fsa 0 get tint_params sNamesDeviceN
create_colorarray_from_devicen_params set_fill_color}{$fsa 0 get set_fill_color
}ifelse F}if @gr Bbllx Bblly Bburx Bbury 1 index 3 index m 2 copy l 3 index 1
index l 3 index 3 index l @cp pop pop pop pop $fan rotate $o 1 eq setoverprint
/bShfillDeviceN bGradDeviceN def CorelShfillFunction}bd/CorelShfillDoMesh{$o 1
eq setoverprint shfill}bd
