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

void PoDoFo::PdfPainter::SetColor ( const PdfColor rColor ) [inherited]

Set the color for all following non-stroking operations.

Parameters:
rColora PdfColor object

Definition at line 284 of file PdfPainter.cpp.

References PoDoFo::PdfCanvas::AddColorResource(), PoDoFo::PdfStream::Append(), PoDoFo::ePdfColorSpace_CieLab, PoDoFo::ePdfColorSpace_DeviceCMYK, PoDoFo::ePdfColorSpace_DeviceGray, PoDoFo::ePdfColorSpace_DeviceRGB, PoDoFo::ePdfColorSpace_Separation, PoDoFo::PdfColor::GetBlack(), PoDoFo::PdfColor::GetBlue(), PoDoFo::PdfColor::GetCieA(), PoDoFo::PdfColor::GetCieB(), PoDoFo::PdfColor::GetCieL(), PoDoFo::PdfColor::GetColorSpace(), PoDoFo::PdfColor::GetCyan(), PoDoFo::PdfColor::GetDensity(), PoDoFo::PdfColor::GetGrayScale(), PoDoFo::PdfColor::GetGreen(), PoDoFo::PdfColor::GetMagenta(), PoDoFo::PdfColor::GetName(), PoDoFo::PdfColor::GetRed(), PoDoFo::PdfColor::GetYellow(), PoDoFo::PdfPainter::m_curColor, PoDoFo::PdfPainter::m_oss, PoDoFo::PdfPainter::m_pCanvas, PoDoFo::PdfPainter::m_pPage, and PODOFO_RAISE_LOGIC_IF.

{
    PODOFO_RAISE_LOGIC_IF( !m_pCanvas, "Call SetPage() first before doing drawing operations." );    

    m_oss.str("");

    m_curColor = rColor;
    switch( rColor.GetColorSpace() ) 
    {
        default: 
        case ePdfColorSpace_DeviceRGB:
            m_oss << rColor.GetRed()   << " "
                  << rColor.GetGreen() << " "
                  << rColor.GetBlue() 
                  << " rg" << std::endl;
            break;
        case ePdfColorSpace_DeviceCMYK:
            m_oss << rColor.GetCyan()    << " " 
                  << rColor.GetMagenta() << " " 
                  << rColor.GetYellow()  << " " 
                  << rColor.GetBlack() 
                  << " k" << std::endl;
            break;
        case ePdfColorSpace_DeviceGray:
            m_oss << rColor.GetGrayScale() << " g" << std::endl;
            break;
        case ePdfColorSpace_Separation:
                  m_pPage->AddColorResource( rColor );
            m_oss << "/ColorSpace" << PdfName( rColor.GetName() ).GetEscapedName() << " cs " << rColor.GetDensity() << " scn" << std::endl;
            break;
        case ePdfColorSpace_CieLab:
                  m_pPage->AddColorResource( rColor );
                  m_oss << "/ColorSpaceCieLab" << " cs " 
                          << rColor.GetCieL() << " " 
                  << rColor.GetCieA() << " " 
                  << rColor.GetCieB() <<
                          " scn" << std::endl;
                  break;
    }

    m_pCanvas->Append( m_oss.str() );
}

Here is the call graph for this function:


Generated by  Doxygen 1.6.0   Back to index