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

bool wxPdfDocument::Image ( const wxString &  name,
const wxImage &  image,
double  x,
double  y,
double  w = 0,
double  h = 0,
const wxPdfLink link = wxPdfLink(-1),
int  maskImage = 0 
) [virtual]

Puts an image in the page The image is given by an wxImage-Object

Parameters:
nameName of the image to be used as an identifier for this image object.
imagewxImage object which will be embedded as PNG
xAbscissa of the upper-left corner.
yOrdinate of the upper-left corner.
wWidth of the image in the page. If not specified or equal to zero, it is automatically calculated.
hHeight of the image in the page. If not specified or equal to zero, it is automatically calculated.
linkURL or identifier returned by AddLink().
maskImageId of an image mask created previously by ImageMask().

Definition at line 1483 of file pdfdoc.cpp.

References wxPdfImage::GetMaskImage(), ImageMask(), OutImage(), wxPdfImage::Parse(), and wxPdfImage::SetMaskImage().

{
  bool isValid = false;
  if (img.Ok())
  {
    wxImage tempImage = img.Copy();
    wxPdfImage* currentImage = NULL;
    // Put an image on the page
    wxPdfImageHashMap::iterator image = (*m_images).find(name);
    if (image == (*m_images).end())
    {
      if (tempImage.HasAlpha())
      {
        if (maskImage <= 0)
        {
          maskImage = ImageMask(name+wxString(_T(".mask")), tempImage);
        }
        if(!tempImage.ConvertAlphaToMask(0))
        {
          return false;
        }
      }
      // First use of image, get info
      tempImage.SetMask(false);
      int i = (*m_images).size() + 1;
      currentImage = new wxPdfImage(this, i, name, tempImage);
      if (!currentImage->Parse())
      {
        delete currentImage;
        return false;
      }
      if (maskImage > 0)
      {
        currentImage->SetMaskImage(maskImage);
      }
      (*m_images)[name] = currentImage;
    }
    else
    {
      currentImage = image->second;
      if (maskImage > 0 && currentImage->GetMaskImage() != maskImage)
      {
        currentImage->SetMaskImage(maskImage);
      }
    }
    OutImage(currentImage, x, y, w, h, link);
    isValid = true;
  }
  return isValid;
}

Here is the call graph for this function:


Generated by  Doxygen 1.6.0   Back to index