Package org.tuba.spatschorke.diploma.representation.image

Examples of org.tuba.spatschorke.diploma.representation.image.ImageRepresentation


      image = export(shape, document);
    } catch (Exception e) {
      return null;
    }
    image.deleteOnExit();
    return new ImageRepresentation(image, ImageType.PNG);
  }
View Full Code Here


    Configuration configuration = cP.serializeConfiguration();

    String curDir = System.getProperty("user.dir"); //$NON-NLS-1$
    String imageFile = curDir + TEST_IMAGE;

    ImageRepresentation image = new ImageRepresentation(
        new File(imageFile), ImageType.PNG);
    ImageScaler scaler = new ImageScaler();
    IArtefactRepresentation result = scaler.process(image, configuration);

    Assert.assertNotNull(result);
    String type = result.getType();
    Assert.assertEquals(ImageRepresentation.TYPE, type);

    ImageRepresentation resultImage = (ImageRepresentation) result;
    File f = image.getImageFile();
    Assert.assertTrue(f.exists());
    Assert.assertTrue(f.isFile());

    float heightScale = ((float) resultImage.getHeight())
        / ((float) image.getHeight());
    float widthScale = ((float) resultImage.getWidth())
        / ((float) image.getWidth());

    Assert.assertEquals(SCALE, heightScale, 0.05);
    Assert.assertEquals(SCALE, widthScale, 0.05);
  }
View Full Code Here

            ImageFileFormat.PNG);
      }
    });

    File imageFile = image_generateImage;
    ImageRepresentation imageRepresentation = new ImageRepresentation(
        imageFile, ImageType.PNG);
    imageFile.deleteOnExit();
    return imageRepresentation;
  }
View Full Code Here

      return null;
    String type = representation.getType();
    if (!ImageRepresentation.TYPE.equals(type))
      return null;

    ImageRepresentation image = (ImageRepresentation) representation;
    File imageFile = image.getImageFile();
    File scaledImage;

    ConfigurationProvider cP = new ConfigurationProvider();
    cP.extractContent(configuration);
    float scale = cP.getScaleValue();

    try {
      scaledImage = scale(imageFile, scale);
    } catch (IOException e) {
      return null;
    }

    scaledImage.deleteOnExit();
    return new ImageRepresentation(scaledImage, ImageType.PNG);
  }
View Full Code Here

      return null;
    String type = representation.getType();
    if (!ImageRepresentation.TYPE.equals(type))
      return null;

    ImageRepresentation image = (ImageRepresentation) representation;

    String imagePath = null;
    try {
      imagePath = image.getImageFile().getCanonicalPath();
    } catch (IOException e1) {
      // TODO Auto-generated catch block
      e1.printStackTrace();
    }

    if (imagePath == null)
      return null;

    GraphicInfo graphicInfo = new GraphicInfo(imagePath, image.getWidth(),
        true, image.getHeight(), true, VertOrientation.TOP,
        HoriOrientation.LEFT, TextContentAnchorType.AT_CHARACTER);

    String id = null;
    if (position.getType().equals(TextPosition.TYPE))
      id = integrateInText(graphicInfo, (TextPosition) position);
View Full Code Here

    File image = generateImage(file);
    if (file == null || !file.exists())
      return null;

    image.deleteOnExit();
    return new ImageRepresentation(image, ImageType.PNG);
  }
View Full Code Here

  public void test() {
    SDEditFile sdeditFile = new SDEditFile(new File(
        "test" + File.separator + "test.sdx")); //$NON-NLS-1$ //$NON-NLS-2$
    ImageGenerator generator = new ImageGenerator();

    ImageRepresentation image = generator.process(sdeditFile, null);
    Assert.assertNotNull(image);
    File f = image.getImageFile();
    Assert.assertNotNull(f);
    Assert.assertTrue(f.exists());
    Assert.assertTrue(f.isFile());
  }
View Full Code Here

TOP

Related Classes of org.tuba.spatschorke.diploma.representation.image.ImageRepresentation

Copyright © 2018 www.massapicom. 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.