Codota Logo
GraphicUtils.imageSize
Code IndexAdd Codota to your IDE (free)

How to use
imageSize
method
in
org.mapsforge.core.graphics.GraphicUtils

Best Java code snippets using org.mapsforge.core.graphics.GraphicUtils.imageSize (Showing top 4 results out of 315)

  • Add the Codota plugin to your IDE and get smart completions
private void myMethod () {
LocalDateTime l =
  • Codota Iconnew LocalDateTime()
  • Codota IconLocalDateTime.now()
  • Codota IconDateTimeFormatter formatter;String text;formatter.parseLocalDateTime(text)
  • Smart code suggestions by Codota
}
origin: mapsforge/mapsforge

AwtResourceBitmap(InputStream inputStream, float scaleFactor, int width, int height, int percent) throws IOException {
  super(inputStream);
  float[] newSize = GraphicUtils.imageSize(getWidth(), getHeight(), scaleFactor, width, height, percent);
  scaleTo((int) newSize[0], (int) newSize[1]);
}
origin: mapsforge/mapsforge

public static BufferedImage getResourceBitmap(InputStream inputStream, String name, float scaleFactor, float defaultSize, int width, int height, int percent) throws IOException {
  try {
    URI uri = SVGCache.getSVGUniverse().loadSVG(inputStream, name);
    SVGDiagram diagram = SVGCache.getSVGUniverse().getDiagram(uri);
    double scale = scaleFactor / Math.sqrt((diagram.getHeight() * diagram.getWidth()) / defaultSize);
    float[] bmpSize = GraphicUtils.imageSize(diagram.getWidth(), diagram.getHeight(), (float) scale, width, height, percent);
    SVGIcon icon = new SVGIcon();
    icon.setAntiAlias(true);
    icon.setAutosize(SVGIcon.AUTOSIZE_STRETCH);
    icon.setPreferredSize(new Dimension((int) bmpSize[0], (int) bmpSize[1]));
    icon.setSvgURI(uri);
    BufferedImage bufferedImage = new BufferedImage(icon.getIconWidth(), icon.getIconHeight(), BufferedImage.TYPE_INT_ARGB);
    icon.paintIcon(null, bufferedImage.createGraphics(), 0, 0);
    return bufferedImage;
  } catch (Exception e) {
    throw new IOException(e);
  }
}
origin: mapsforge/mapsforge

  throw new IOException("BitmapFactory failed to decodeStream");
float[] newSize = GraphicUtils.imageSize(bitmap.getWidth(), bitmap.getHeight(), scaleFactor, width, height, percent);
if ((int) newSize[0] != bitmap.getWidth() || (int) newSize[1] != bitmap.getHeight())
  bitmap = Bitmap.createScaledBitmap(bitmap, (int) newSize[0], (int) newSize[1], true);
origin: mapsforge/mapsforge

public static android.graphics.Bitmap getResourceBitmap(InputStream inputStream, float scaleFactor, float defaultSize, int width, int height, int percent) throws IOException {
  try {
    // not in any cache, so need to render svg
    SVG svg = SVG.getFromInputStream(inputStream);
    Picture picture = svg.renderToPicture();
    double scale = scaleFactor / Math.sqrt((picture.getHeight() * picture.getWidth()) / defaultSize);
    float[] bmpSize = GraphicUtils.imageSize(picture.getWidth(), picture.getHeight(), (float) scale, width, height, percent);
    android.graphics.Bitmap bitmap = android.graphics.Bitmap.createBitmap((int) Math.ceil(bmpSize[0]),
        (int) Math.ceil(bmpSize[1]), AndroidGraphicFactory.TRANSPARENT_BITMAP);
    Canvas canvas = new Canvas(bitmap);
    canvas.drawPicture(picture, new RectF(0, 0, bmpSize[0], bmpSize[1]));
    return bitmap;
  } catch (Exception e) {
    throw new IOException(e);
  }
}
org.mapsforge.core.graphicsGraphicUtilsimageSize

Javadoc

Given the original image size, as well as width, height, percent parameters, can compute the final image size.

Popular methods of GraphicUtils

  • filterColor
    Color filtering.
  • getAlpha

Popular in Java

  • Start an intent from android
  • startActivity (Activity)
  • requestLocationUpdates (LocationManager)
  • compareTo (BigDecimal)
    Compares this BigDecimal with the specified BigDecimal. Two BigDecimal objects that are equal in val
  • GridLayout (java.awt)
    The GridLayout class is a layout manager that lays out a container's components in a rectangular gri
  • Window (java.awt)
    A Window object is a top-level window with no borders and no menubar. The default layout for a windo
  • FileInputStream (java.io)
    A FileInputStream obtains input bytes from a file in a file system. What files are available depends
  • InputStreamReader (java.io)
    An InputStreamReader is a bridge from byte streams to character streams: It reads bytes and decodes
  • URLEncoder (java.net)
    This class is used to encode a string using the format required by application/x-www-form-urlencoded
  • Date (java.sql)
    A class which can consume and produce dates in SQL Date format. Dates are represented in SQL as yyyy
Codota Logo
  • Products

    Search for Java codeSearch for JavaScript codeEnterprise
  • IDE Plugins

    IntelliJ IDEAWebStormAndroid StudioEclipseVisual Studio CodePyCharmSublime TextPhpStormVimAtomGoLandRubyMineEmacsJupyter
  • Company

    About UsContact UsCareers
  • Resources

    FAQBlogCodota Academy Plugin user guide Terms of usePrivacy policyJava Code IndexJavascript Code Index
Get Codota for your IDE now