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) {
          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

            for (int j = 0; j < sh.length; j++) {
                Shape shape = sh[j];
                if (shape instanceof Picture){
                    Picture picture = (Picture)shape;

                    PictureData pictdata = picture.getPictureData();
                    assertEquals(Picture.PNG, pictdata.getType());

                    //raw data.
                    byte[] data = pictdata.getData();
                    BufferedImage img = ImageIO.read(new ByteArrayInputStream(data));
                    assertNotNull(img);
                }
            }
View Full Code Here

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

    }

    ArrayList p = new ArrayList();
    int pos = 0;
    while (pos < (pictstream.length - PictureData.HEADER_SIZE)) {
      PictureData pict = new PictureData(pictstream, pos);
      p.add(pict);
      pos += PictureData.HEADER_SIZE + pict.getSize();
    }

    _pictures = (PictureData[])p.toArray(new PictureData[p.size()]);
  }
View Full Code Here

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

    /**
     * Resize this picture to the default size.
     */
    public void setDefaultSize(){
        PictureData pict = getPictureData();
        try {
            BufferedImage img = ImageIO.read(new ByteArrayInputStream(pict.getData()));
            setAnchor(new java.awt.Rectangle(0, 0, img.getWidth(), img.getHeight()));
        } catch (IOException e){
            throw new RuntimeException(e);
        }
    }
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

     }
    
     // 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

     * 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
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.