Examples of Picture


Examples of org.apache.myfaces.tobago.example.addressbook.Picture

    return OUTCOME_LIST;
  }

  public String okFileUpload() {
    setRenderFileUploadPopup(false);
    Picture picture = new Picture(uploadedFile.getContentType(), uploadedFile.get());
    currentAddress.setPicture(picture);
    return null;
  }
View Full Code Here

Examples of org.apache.pivot.wtk.media.Picture

    private static void updateFrameTitleBar(Window rootOwner) {
        windowedHostFrame.setTitle(rootOwner.getTitle());

        Image icon = rootOwner.getIcon();
        if (icon instanceof Picture) {
            Picture rootPicture = (Picture)icon;
            windowedHostFrame.setIconImage(rootPicture.getBufferedImage());
        }
    }
View Full Code Here

Examples of org.apache.poi.hslf.model.Picture

        SlideShow ppt = new SlideShow();

        Slide slide = ppt.createSlide();
        byte[] src_bytes = slTests.readFile("cow.pict");
        int idx = ppt.addPicture(src_bytes, Picture.PICT);
        Picture pict = new Picture(idx);
        assertEquals(idx, pict.getPictureIndex());
        slide.addShape(pict);

        //serialize and read again
        ByteArrayOutputStream out = new ByteArrayOutputStream();
        ppt.write(out);
        out.close();

        ppt = new SlideShow(new HSLFSlideShow(new ByteArrayInputStream(out.toByteArray())));

        //make sure we can read this picture shape and it refers to the correct picture data
        Shape[] sh = ppt.getSlides()[0].getShapes();
        assertEquals(1, sh.length);
        pict = (Picture)sh[0];
        assertEquals(idx, pict.getPictureIndex());

        //check picture data
        PictureData[] pictures = ppt.getPictureData();
        //the Picture shape refers to the PictureData object in the Presentation
        assertEquals(pict.getPictureData(), pictures[0]);

        assertEquals(1, pictures.length);
        assertEquals(Picture.PICT, pictures[0].getType());
        assertTrue(pictures[0] instanceof PICT);
        //compare the content of the initial file with what is stored in the PictureData
View Full Code Here

Examples of org.apache.poi.hslf.model.Picture

        SlideShow ppt = new SlideShow();

        Slide slide = ppt.createSlide();
        byte[] src_bytes = slTests.readFile("santa.wmf");
        int idx = ppt.addPicture(src_bytes, Picture.WMF);
        Picture pict = new Picture(idx);
        assertEquals(idx, pict.getPictureIndex());
        slide.addShape(pict);

        //serialize and read again
        ByteArrayOutputStream out = new ByteArrayOutputStream();
        ppt.write(out);
        out.close();

        ppt = new SlideShow(new HSLFSlideShow(new ByteArrayInputStream(out.toByteArray())));

        //make sure we can read this picture shape and it refers to the correct picture data
        Shape[] sh = ppt.getSlides()[0].getShapes();
        assertEquals(1, sh.length);
        pict = (Picture)sh[0];
        assertEquals(idx, pict.getPictureIndex());

        //check picture data
        PictureData[] pictures = ppt.getPictureData();
        //the Picture shape refers to the PictureData object in the Presentation
        assertEquals(pict.getPictureData(), pictures[0]);

        assertEquals(1, pictures.length);
        assertEquals(Picture.WMF, pictures[0].getType());
        assertTrue(pictures[0] instanceof WMF);
        //compare the content of the initial file with what is stored in the PictureData
View Full Code Here

Examples of org.apache.poi.hslf.model.Picture

        Slide slide = ppt.createSlide();
        byte[] src_bytes = slTests.readFile("wrench.emf");
        int idx = ppt.addPicture(src_bytes, Picture.EMF);

        Picture pict = new Picture(idx);
        assertEquals(idx, pict.getPictureIndex());
        slide.addShape(pict);

        //serialize and read again
        ByteArrayOutputStream out = new ByteArrayOutputStream();
        ppt.write(out);
        out.close();

        ppt = new SlideShow(new HSLFSlideShow(new ByteArrayInputStream(out.toByteArray())));

        //make sure we can get this picture shape and it refers to the correct picture data
        Shape[] sh = ppt.getSlides()[0].getShapes();
        assertEquals(1, sh.length);
        pict = (Picture)sh[0];
        assertEquals(idx, pict.getPictureIndex());

        //check picture data
        PictureData[] pictures = ppt.getPictureData();
        //the Picture shape refers to the PictureData object in the Presentation
        assertEquals(pict.getPictureData(), pictures[0]);

        assertEquals(1, pictures.length);
        assertEquals(Picture.EMF, pictures[0].getType());
        assertTrue(pictures[0] instanceof EMF);
        //compare the content of the initial file with what is stored in the PictureData
View Full Code Here

Examples of org.apache.poi.hslf.model.Picture

        SlideShow ppt = new SlideShow();

        Slide slide = ppt.createSlide();
        byte[] src_bytes = slTests.readFile("tomcat.png");
        int idx = ppt.addPicture(src_bytes, Picture.PNG);
        Picture pict = new Picture(idx);
        assertEquals(idx, pict.getPictureIndex());
        slide.addShape(pict);

        //serialize and read again
        ByteArrayOutputStream out = new ByteArrayOutputStream();
        ppt.write(out);
        out.close();

        ppt = new SlideShow(new HSLFSlideShow(new ByteArrayInputStream(out.toByteArray())));

        //make sure we can read this picture shape and it refers to the correct picture data
        Shape[] sh = ppt.getSlides()[0].getShapes();
        assertEquals(1, sh.length);
        pict = (Picture)sh[0];
        assertEquals(idx, pict.getPictureIndex());

        //check picture data
        PictureData[] pictures = ppt.getPictureData();
        //the Picture shape refers to the PictureData object in the Presentation
        assertEquals(pict.getPictureData(), pictures[0]);

        assertEquals(1, pictures.length);
        assertEquals(Picture.PNG, pictures[0].getType());
        assertTrue(pictures[0] instanceof PNG);
        //compare the content of the initial file with what is stored in the PictureData
View Full Code Here

Examples of org.apache.poi.hwpf.usermodel.Picture

    PicturesTable picB = docB.getPicturesTable();
    List picturesB = picB.getAllPictures();
   
    assertEquals(2, picturesB.size());
   
    Picture pic1 = (Picture)picturesB.get(0);
    Picture pic2 = (Picture)picturesB.get(1);
   
    assertNotNull(pic1);
    assertNotNull(pic2);
   
    // Check the same
    byte[] pic1B = readFile(imgAFile);
    byte[] pic2B = readFile(imgBFile);
   
    assertEquals(pic1B.length, pic1.getContent().length);
    assertEquals(pic2B.length, pic2.getContent().length);

    assertBytesSame(pic1B, pic1.getContent());
    assertBytesSame(pic2B, pic2.getContent());
  }
View Full Code Here

Examples of org.apache.poi.hwpf.usermodel.Picture

    PicturesTable picC = docC.getPicturesTable();
    List picturesC = picC.getAllPictures();
   
    assertEquals(1, picturesC.size());
   
    Picture pic = (Picture)picturesC.get(0);
    assertNotNull(pic);
   
    // Check the same
    byte[] picBytes = readFile(imgCFile);
   
    assertEquals(picBytes.length, pic.getContent().length);
    assertBytesSame(picBytes, pic.getContent());
  }
View Full Code Here

Examples of org.apache.poi.hwpf.usermodel.Picture

   * @return a Picture object if picture exists for specified CharacterRun, null otherwise. PicturesTable.hasPicture is used to determine this.
   * @see #hasPicture(org.apache.poi.hwpf.usermodel.CharacterRun)
   */
  public Picture extractPicture(CharacterRun run, boolean fillBytes) {
    if (hasPicture(run)) {
      return new Picture(run.getPicOffset(), _dataStream, fillBytes);
    }
    return null;
  }
View Full Code Here

Examples of org.apache.poi.hwpf.usermodel.Picture

    int pos = 0;
    boolean atEnd = false;
   
    while(pos<_dataStream.length && !atEnd) {
      if (isBlockContainsImage(pos)) {
        pictures.add(new Picture(pos, _dataStream, false));
      }
     
      int skipOn = LittleEndian.getInt(_dataStream, pos);
      if(skipOn <= 0) { atEnd = true; }
      pos += skipOn;
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.