Examples of PictureData


Examples of org.apache.poi.hslf.usermodel.PictureData

                System.arraycopy(pictstream, pos, imgdata, 0, imgdata.length);
              }
             
        // Build the PictureData object from the data
        try {
          PictureData pict = PictureData.create(type - 0xF018);
          pict.setRawData(imgdata);
          pict.setOffset(offset);
          p.add(pict);
        } catch(IllegalArgumentException e) {
          System.err.println("Problem reading picture: " + e + "\nYou document will probably become corrupted if you save it!");
        }
      }
View Full Code Here

Examples of org.apache.poi.hslf.usermodel.PictureData

     * Resize this picture to the default size.
     * For PNG and JPEG resizes the image to 100%,
     * for other types sets the default size of 200x200 pixels. 
     */
    public void setDefaultSize(){
        PictureData pict = getPictureData();
        if (pict  instanceof Bitmap){
            BufferedImage img = null;
            try {
                 img = ImageIO.read(new ByteArrayInputStream(pict.getData()));
            }
            catch (IOException e){}
          catch (NegativeArraySizeException ne) {}
         
            if(img != null) {
View Full Code Here

Examples of org.apache.poi.hslf.usermodel.PictureData

        SlideShow ppt = new SlideShow();
        Slide slide = ppt.createSlide();

        Picture pict = new Picture(-1); //index to non-existing picture data
        pict.setSheet(slide);
        PictureData data = pict.getPictureData();
        assertNull(data);

        BufferedImage img = new BufferedImage(100, 100, BufferedImage.TYPE_INT_RGB);
        Graphics2D graphics = img.createGraphics();
        pict.draw(graphics);
View Full Code Here

Examples of org.apache.poi.hslf.usermodel.PictureData

     * Resize this picture to the default size.
     * For PNG and JPEG resizes the image to 100%,
     * for other types sets the default size of 200x200 pixels.
     */
    public void setDefaultSize(){
        PictureData pict = getPictureData();
        if (pict  instanceof Bitmap){
            BufferedImage img = null;
            try {
                 img = ImageIO.read(new ByteArrayInputStream(pict.getData()));
            }
            catch (IOException e){}
          catch (NegativeArraySizeException ne) {}

            if(img != null) {
View Full Code Here

Examples of org.apache.poi.hslf.usermodel.PictureData

    public void draw(Graphics2D graphics){
        AffineTransform at = graphics.getTransform();
        ShapePainter.paint(this, graphics);

        PictureData data = getPictureData();
        if(data != null) data.draw(graphics, this);

        graphics.setTransform(at);
    }
View Full Code Here

Examples of org.apache.poi.hslf.usermodel.PictureData

        logger.log(POILogger.ERROR, "Problem reading picture: Invalid image type 0, on picture with length " + imgsize + ".\nYou document will probably become corrupted if you save it!");
        logger.log(POILogger.ERROR, "" + pos);
      } else {
        // Build the PictureData object from the data
        try {
          PictureData pict = PictureData.create(type - 0xF018);

                    // Copy the data, ready to pass to PictureData
                    byte[] imgdata = new byte[imgsize];
                    System.arraycopy(pictstream, pos, imgdata, 0, imgdata.length);
                    pict.setRawData(imgdata);

                    pict.setOffset(offset);
          _pictures.add(pict);
        } catch(IllegalArgumentException e) {
          logger.log(POILogger.ERROR, "Problem reading picture: " + e + "\nYou document will probably become corrupted if you save it!");
        }
      }
View Full Code Here

Examples of org.apache.poi.hslf.usermodel.PictureData

   */
  public int addPicture(PictureData img) {
    int offset = 0;

        if(_pictures.size() > 0){
            PictureData prev = _pictures.get(_pictures.size() - 1);
            offset = prev.getOffset() + prev.getRawData().length + 8;
        }
        img.setOffset(offset);
        _pictures.add(img);
        return offset;
   }
View Full Code Here

Examples of org.apache.poi.hslf.usermodel.PictureData

        logger.log(POILogger.ERROR, "Problem reading picture: Invalid image type 0, on picture with length " + imgsize + ".\nYou document will probably become corrupted if you save it!");
        logger.log(POILogger.ERROR, "" + pos);
      } else {
        // Build the PictureData object from the data
        try {
          PictureData pict = PictureData.create(type - 0xF018);

                    // Copy the data, ready to pass to PictureData
                    byte[] imgdata = new byte[imgsize];
                    System.arraycopy(pictstream, pos, imgdata, 0, imgdata.length);
                    pict.setRawData(imgdata);

                    pict.setOffset(offset);
          _pictures.add(pict);
        } catch(IllegalArgumentException e) {
          logger.log(POILogger.ERROR, "Problem reading picture: " + e + "\nYou document will probably become corrupted if you save it!");
        }
      }
View Full Code Here

Examples of org.apache.poi.hslf.usermodel.PictureData

     }
    
     // Add the new picture in
      int offset = 0;
     if(_pictures.size() > 0) {
        PictureData prev = _pictures.get(_pictures.size() - 1);
        offset = prev.getOffset() + prev.getRawData().length + 8;
     }
     img.setOffset(offset);
     _pictures.add(img);
     return offset;
   }
View Full Code Here

Examples of org.apache.poi.hslf.usermodel.PictureData

        logger.log(POILogger.ERROR, "Problem reading picture: Invalid image type 0, on picture with length " + imgsize + ".\nYou document will probably become corrupted if you save it!");
        logger.log(POILogger.ERROR, "" + pos);
      } else {
        // Build the PictureData object from the data
        try {
          PictureData pict = PictureData.create(type - 0xF018);

                    // Copy the data, ready to pass to PictureData
                    byte[] imgdata = new byte[imgsize];
                    System.arraycopy(pictstream, pos, imgdata, 0, imgdata.length);
                    pict.setRawData(imgdata);

                    pict.setOffset(offset);
          _pictures.add(pict);
        } catch(IllegalArgumentException e) {
          logger.log(POILogger.ERROR, "Problem reading picture: " + e + "\nYou document will probably become corrupted if you save it!");
        }
      }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.