Logo Search packages:      
Sourcecode: libpodofo version File versions  Download package

void PoDoFo::PdfRadialShadingPattern::Init ( double  dX0,
double  dY0,
double  dR0,
double  dX1,
double  dY1,
double  dR1,
const PdfColor rStart,
const PdfColor rEnd 
) [private]

Initialize an radial shading pattern

Parameters:
dX0the inner circles x coordinate
dY0the inner circles y coordinate
dR0the inner circles radius
dX1the outer circles x coordinate
dY1the outer circles y coordinate
dR1the outer circles radius
rStartthe starting color
rEndthe ending color

Definition at line 436 of file PdfShadingPattern.cpp.

References PoDoFo::PdfDictionary::AddKey(), PoDoFo::PdfColor::BuildColorSpace(), PoDoFo::ePdfColorSpace_CieLab, PoDoFo::ePdfColorSpace_DeviceCMYK, PoDoFo::ePdfColorSpace_DeviceGray, PoDoFo::ePdfColorSpace_DeviceRGB, PoDoFo::ePdfColorSpace_Separation, PoDoFo::ePdfError_InvalidDataType, PoDoFo::PdfColor::GetColorSpace(), PoDoFo::PdfVariant::GetDictionary(), PoDoFo::PdfDictionary::GetKey(), PoDoFo::PdfElement::GetObject(), PODOFO_RAISE_ERROR_INFO, PoDoFo::PdfArray::push_back(), PoDoFo::PdfObject::Reference(), and PoDoFo::PdfColor::ToArray().

Referenced by PdfRadialShadingPattern().

{
    PdfArray coords;
    coords.push_back( dX0 );
    coords.push_back( dY0 );
    coords.push_back( dR0 );
    coords.push_back( dX1 );
    coords.push_back( dY1 );
    coords.push_back( dR1 );
            
    if( rStart.GetColorSpace() != rEnd.GetColorSpace() )
    {
        PODOFO_RAISE_ERROR_INFO( ePdfError_InvalidDataType, "Colorspace of start and end color in PdfRadialShadingPattern does not match." );
    }

    PdfArray c0 = rStart.ToArray();
    PdfArray c1 = rEnd.ToArray();
    PdfArray extend; 
    
    extend.push_back( true );
    extend.push_back( true );

    PdfArray domain;
    domain.push_back( 0.0 );
    domain.push_back( 1.0 );

    PdfExponentialFunction function( domain, c0, c1, 1.0, this->GetObject()->GetOwner() );

    PdfDictionary & shading = this->GetObject()->GetDictionary().GetKey( PdfName("Shading") )->GetDictionary();

      switch( rStart.GetColorSpace() )
      {
            case ePdfColorSpace_DeviceRGB:
              shading.AddKey( PdfName("ColorSpace"), PdfName("DeviceRGB") );
            break;

            case ePdfColorSpace_DeviceCMYK:
                shading.AddKey( PdfName("ColorSpace"), PdfName("DeviceCMYK") );
            break;

            case ePdfColorSpace_DeviceGray:
              shading.AddKey( PdfName("ColorSpace"), PdfName("DeviceGray") );
            break;

            case ePdfColorSpace_CieLab:
            {     
                  PdfObject * csp = rStart.BuildColorSpace( this->GetObject()->GetOwner() );

                  shading.AddKey( PdfName("ColorSpace"), csp->Reference() );
            }
            break;

            case ePdfColorSpace_Separation:
            {
                  PdfObject * csp = rStart.BuildColorSpace( this->GetObject()->GetOwner() );

                  shading.AddKey( PdfName("ColorSpace"), csp->Reference() );
            }
            break;

            default:
              PODOFO_RAISE_ERROR_INFO( ePdfError_InvalidDataType, "Colorspace not supported in PdfRadialShadingPattern." );
            break;
      }

    shading.AddKey( PdfName("Coords"), coords );
    shading.AddKey( PdfName("Function"), function.GetObject()->Reference() );
    shading.AddKey( PdfName("Extend"), extend );
}

Here is the call graph for this function:

Here is the caller graph for this function:


Generated by  Doxygen 1.6.0   Back to index