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

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

Initialize an axial shading pattern

dX0the starting x coordinate
dY0the starting y coordinate
dX1the ending x coordinate
dY1the ending y coordinate
rStartthe starting color
rEndthe ending color

Definition at line 183 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 PdfAxialShadingPattern().

    PdfArray coords;
    coords.push_back( dX0 );
    coords.push_back( dY0 );
    coords.push_back( dX1 );
    coords.push_back( dY1 );
    if( rStart.GetColorSpace() != rEnd.GetColorSpace() )
        PODOFO_RAISE_ERROR_INFO( ePdfError_InvalidDataType, "Colorspace of start and end color in PdfAxialShadingPattern 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") );

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

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

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

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

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

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

              PODOFO_RAISE_ERROR_INFO( ePdfError_InvalidDataType, "Colorspace not supported in PdfAxialShadingPattern." );

    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