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

bool wxPdfDocument::Image ( const wxString &  name,
wxInputStream &  stream,
const wxString &  mimeType,
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 wxInputStream-Object containing the raw image data.

Parameters:
nameName of the image to be used as an identifier for this image object.
streamwxInputStream object containing the raw image data
mimeTypeImage format. Possible values are: image/jpeg, image/png, image/gif, image/wmf.
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 1536 of file pdfdoc.cpp.

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

{
  bool isValid = false;
  wxPdfImage* currentImage = NULL;
  // Put an image on the page
  wxPdfImageHashMap::iterator image = (*m_images).find(name);
  if (image == (*m_images).end())
  {
    // First use of image, get info
    int i = (*m_images).size() + 1;
    currentImage = new wxPdfImage(this, i, name, stream, mimeType);
    if (!currentImage->Parse())
    {
      delete currentImage;
      if (wxImage::FindHandler(wxBITMAP_TYPE_PNG) == NULL)
      {
        wxImage::AddHandler(new wxPNGHandler());
      }
      wxImage tempImage;
      tempImage.LoadFile(stream, mimeType);
      if (tempImage.Ok())
      {
        isValid = Image(name, tempImage, x, y, w, h, link, maskImage);
      }
      return isValid;

    }
    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