Package ch.sahits.game.image

Examples of ch.sahits.game.image.ImageScaleState


  @Override
  public BufferedImage init(DisplayImageDIResolver resolver) {
    BufferedImage tmpImg = xmlLoader.getImage(SCENE_IMAGE_NAME); // portScene
    ImageData imgData = xmlLoader.getImageData(SCENE_IMAGE_NAME);
    ImageScaleState state = new ImageScaleState(new Dimension(tmpImg.getWidth(), tmpImg.getHeight()), getBounds().getSize(), imgData.getCrop(), imgData.getMaxCrop());
logger.debug("State of the port scene before: "+state);   
    BufferedImage img = imageUtils.cropAndScale(tmpImg, state);
    scaleMap.put(SCENE_IMAGE_NAME, state.getScaleFactor());
    Rectangle bounds = imageUtils.computeBounds(getBounds().getSize(),new Dimension(img.getWidth(),img.getHeight()));
    initPolygons(resolver, imgData, state, new Point(getBounds().x+bounds.x, getBounds().y+bounds.y));
   
logger.debug("State of the port scene after : "+state);   
    xmlLoader.replaceSingleImage(SCENE_IMAGE_NAME, img);
View Full Code Here


  @Override
  public BufferedImage init(DisplayImageDIResolver resolver) {
    BufferedImage tmpImg = xmlLoader.getImage(SCENE_IMAGE_NAME); // portScene
    ImageData imgData = xmlLoader.getImageData(SCENE_IMAGE_NAME);
    ImageScaleState state = new ImageScaleState(new Dimension(tmpImg.getWidth(), tmpImg.getHeight()), getBounds().getSize(), imgData.getCrop(), imgData.getMaxCrop());
logger.debug("State of the market place scene before: "+state);   
    BufferedImage img = imageUtils.cropAndScale(tmpImg, state);
    scaleMap.put(SCENE_IMAGE_NAME, state.getScaleFactor());
    Rectangle bounds = imageUtils.computeBounds(getBounds().getSize(),new Dimension(img.getWidth(),img.getHeight()));
    initPolygons(resolver, imgData, state, new Point(getBounds().x+bounds.x, getBounds().y+bounds.y));
   
logger.debug("State of the market place scene after : "+state);   
    xmlLoader.replaceSingleImage(SCENE_IMAGE_NAME, img);
View Full Code Here

   * Scale the dialog so it has the correct proportions
   */
  private void resetDialog() {
    Dimension targetDim = new Dimension(getBounds().width*2/3, 600);
    BufferedImage tmpImg = loader.getImage(imageNames[0]); // fringe
    ImageScaleState state = new ImageScaleState(new Dimension(tmpImg.getWidth(), tmpImg.getHeight()), targetDim);
    Scaling scaling = imageUtils.computeScaleFactor(targetDim, new Dimension(tmpImg.getWidth(), tmpImg.getHeight()), EScaling.DOWN);
    state.setScaleFactor(scaling.getScaleFactor());
    BufferedImage frame = imageUtils.scale(tmpImg, state);
    loader.replaceSingleImage(imageNames[0], frame);
   
    tmpImg = loader.getImage(imageNames[1]); // wax seal
    loader.replaceSingleImage(imageNames[1], imageUtils.scale(tmpImg, state));
View Full Code Here

   * @param imgName
   * @param targetDim
   */
  private void replaceImage(String imgName, Dimension targetDim){
    BufferedImage tmpImg = loader.getImage(imgName); // coin
    ImageScaleState state = new ImageScaleState(new Dimension(tmpImg.getWidth(), tmpImg.getHeight()), targetDim);
    Scaling scaling = imageUtils.computeScaleFactor(targetDim, new Dimension(tmpImg.getWidth(), tmpImg.getHeight()), EScaling.DOWN);
    state.setScaleFactor(scaling.getScaleFactor());
    tmpImg = imageUtils.scale(tmpImg, state);
    loader.replaceSingleImage(imgName, tmpImg);
  }
View Full Code Here

TOP

Related Classes of ch.sahits.game.image.ImageScaleState

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.