本文整理了Java中org.mapsforge.core.graphics.Bitmap.getHeight()
方法的一些代码示例,展示了Bitmap.getHeight()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Bitmap.getHeight()
方法的具体详情如下:
包路径:org.mapsforge.core.graphics.Bitmap
类名称:Bitmap
方法名:getHeight
暂无
代码示例来源:origin: mapsforge/mapsforge
private float computeVerticalOffset(byte zoomLevel) {
float verticalOffset = this.dyScaled.get(zoomLevel);
if (Position.ABOVE == this.position
|| Position.ABOVE_LEFT == this.position
|| Position.ABOVE_RIGHT == this.position) {
verticalOffset -= this.bitmap.getHeight() / 2f + this.gap;
} else if (Position.BELOW == this.position
|| Position.BELOW_LEFT == this.position
|| Position.BELOW_RIGHT == this.position) {
verticalOffset += this.bitmap.getHeight() / 2f + this.gap;
}
return verticalOffset;
}
代码示例来源:origin: mapsforge/mapsforge
@Override
public void setBitmapShader(Bitmap bitmap) {
if (bitmap == null) {
return;
}
this.shaderWidth = bitmap.getWidth();
this.shaderHeight = bitmap.getHeight();
Rectangle rectangle = new Rectangle(0, 0, bitmap.getWidth(), bitmap.getHeight());
this.texturePaint = new TexturePaint(AwtGraphicFactory.getBitmap(bitmap), rectangle);
}
代码示例来源:origin: mapsforge/mapsforge
public SymbolContainer(Point point, Display display, int priority, Bitmap symbol, float theta, boolean alignCenter) {
super(point, display, priority);
this.symbol = symbol;
this.theta = theta;
this.alignCenter = alignCenter;
if (alignCenter) {
double halfWidth = this.symbol.getWidth() / 2d;
double halfHeight = this.symbol.getHeight() / 2d;
this.boundary = new Rectangle(-halfWidth, -halfHeight, halfWidth, halfHeight);
} else {
this.boundary = new Rectangle(0, 0, this.symbol.getWidth(), this.symbol.getHeight());
}
this.symbol.incrementRefCount();
}
代码示例来源:origin: mapsforge/mapsforge
public synchronized boolean contains(Point center, Point point) {
// Touch min 20x20 px at baseline mdpi (160dpi)
double width = Math.max(20 * this.displayModel.getScaleFactor(), this.bitmap.getWidth());
double height = Math.max(20 * this.displayModel.getScaleFactor(), this.bitmap.getHeight());
Rectangle r = new Rectangle(
center.x - width / 2 + this.horizontalOffset,
center.y - height / 2 + this.verticalOffset,
center.x + width / 2 + this.horizontalOffset,
center.y + height / 2 + this.verticalOffset);
return r.contains(point);
}
代码示例来源:origin: mapsforge/mapsforge
private static void verifyEquals(Bitmap bitmap1, Bitmap bitmap2) {
Assert.assertEquals(bitmap1.getWidth(), bitmap2.getWidth());
Assert.assertEquals(bitmap1.getHeight(), bitmap2.getHeight());
}
代码示例来源:origin: mapsforge/mapsforge
@Override
public synchronized void draw(BoundingBox boundingBox, byte zoomLevel, Canvas canvas, Point topLeftPoint) {
if (this.latLong == null || this.bitmap == null || this.bitmap.isDestroyed()) {
return;
}
long mapSize = MercatorProjection.getMapSize(zoomLevel, this.displayModel.getTileSize());
double pixelX = MercatorProjection.longitudeToPixelX(this.latLong.longitude, mapSize);
double pixelY = MercatorProjection.latitudeToPixelY(this.latLong.latitude, mapSize);
int halfBitmapWidth = this.bitmap.getWidth() / 2;
int halfBitmapHeight = this.bitmap.getHeight() / 2;
int left = (int) (pixelX - topLeftPoint.x - halfBitmapWidth + this.horizontalOffset);
int top = (int) (pixelY - topLeftPoint.y - halfBitmapHeight + this.verticalOffset);
int right = left + this.bitmap.getWidth();
int bottom = top + this.bitmap.getHeight();
Rectangle bitmapRectangle = new Rectangle(left, top, right, bottom);
Rectangle canvasRectangle = new Rectangle(0, 0, canvas.getWidth(), canvas.getHeight());
if (!canvasRectangle.intersects(bitmapRectangle)) {
return;
}
canvas.drawBitmap(this.bitmap, left, top);
}
代码示例来源:origin: mapsforge/mapsforge
/**
* Called from {@link MapView}
*
* @param graphicContext The graphicContext to use to draw the MapScaleBar
*/
public void draw(GraphicContext graphicContext) {
if (!this.visible) {
return;
}
if (this.mapViewDimension.getDimension() == null) {
return;
}
if (this.isRedrawNecessary()) {
redraw(this.mapScaleCanvas);
this.redrawNeeded = false;
}
int positionLeft = calculatePositionLeft(0, this.mapViewDimension.getDimension().width, this.mapScaleBitmap.getWidth());
int positionTop = calculatePositionTop(0, this.mapViewDimension.getDimension().height, this.mapScaleBitmap.getHeight());
graphicContext.drawBitmap(this.mapScaleBitmap, positionLeft, positionTop);
}
代码示例来源:origin: org.mapsforge/mapsforge-map
private float computeVerticalOffset(byte zoomLevel) {
float verticalOffset = this.dyScaled.get(zoomLevel);
if (Position.ABOVE == this.position
|| Position.ABOVE_LEFT == this.position
|| Position.ABOVE_RIGHT == this.position) {
verticalOffset -= this.bitmap.getHeight() / 2f + this.gap;
} else if (Position.BELOW == this.position
|| Position.BELOW_LEFT == this.position
|| Position.BELOW_RIGHT == this.position) {
verticalOffset += this.bitmap.getHeight() / 2f + this.gap;
}
return verticalOffset;
}
代码示例来源:origin: mapsforge/mapsforge
/**
* Set group marker parameter. To know index and calculate position on spiral.
*
* @param index the index of this child marker.
* @param bitmap the bitmap of the group marker.
* @param horizontalOffset the horizontal offset of the group marker.
* @param verticalOffset the vertical offset of the group marker.
*/
public void init(int index, Bitmap bitmap, int horizontalOffset, int verticalOffset) {
this.index = index;
this.groupBitmapHalfHeight = bitmap.getHeight() / 2;
this.groupBitmapHalfWidth = bitmap.getWidth() / 2;
this.groupHOffset = horizontalOffset;
this.groupVOffset = verticalOffset;
}
代码示例来源:origin: mapsforge/mapsforge
@SuppressWarnings("deprecation")
@TargetApi(Build.VERSION_CODES.LOLLIPOP)
static Marker createMarker(Context c, int resourceIdentifier,
LatLong latLong) {
Drawable drawable = Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP ? c.getDrawable(resourceIdentifier) : c.getResources().getDrawable(resourceIdentifier);
Bitmap bitmap = AndroidGraphicFactory.convertToBitmap(drawable);
return new Marker(latLong, bitmap, 0, -bitmap.getHeight() / 2);
}
代码示例来源:origin: org.mapsforge/mapsforge-map-awt
@Override
public void setBitmapShader(Bitmap bitmap) {
if (bitmap == null) {
return;
}
this.shaderWidth = bitmap.getWidth();
this.shaderHeight = bitmap.getHeight();
Rectangle rectangle = new Rectangle(0, 0, bitmap.getWidth(), bitmap.getHeight());
this.texturePaint = new TexturePaint(AwtGraphicFactory.getBitmap(bitmap), rectangle);
}
代码示例来源:origin: org.mapsforge/mapsforge-core
public SymbolContainer(Point point, Display display, int priority, Bitmap symbol, float theta, boolean alignCenter) {
super(point, display, priority);
this.symbol = symbol;
this.theta = theta;
this.alignCenter = alignCenter;
if (alignCenter) {
double halfWidth = this.symbol.getWidth() / 2d;
double halfHeight = this.symbol.getHeight() / 2d;
this.boundary = new Rectangle(-halfWidth, -halfHeight, halfWidth, halfHeight);
} else {
this.boundary = new Rectangle(0, 0, this.symbol.getWidth(), this.symbol.getHeight());
}
this.symbol.incrementRefCount();
}
代码示例来源:origin: org.mapsforge/mapsforge-map
public synchronized boolean contains(Point center, Point point) {
// Touch min 20x20 px at baseline mdpi (160dpi)
double width = Math.max(20 * this.displayModel.getScaleFactor(), this.bitmap.getWidth());
double height = Math.max(20 * this.displayModel.getScaleFactor(), this.bitmap.getHeight());
Rectangle r = new Rectangle(
center.x - width / 2 + this.horizontalOffset,
center.y - height / 2 + this.verticalOffset,
center.x + width / 2 + this.horizontalOffset,
center.y + height / 2 + this.verticalOffset);
return r.contains(point);
}
代码示例来源:origin: mapsforge/mapsforge
@SuppressWarnings("deprecation")
@TargetApi(Build.VERSION_CODES.LOLLIPOP)
@Override
public void onCreate(Bundle sis) {
Drawable drawableWhite = Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP ? getDrawable(R.drawable.marker_white) : getResources().getDrawable(R.drawable.marker_white);
Paint paint = new Paint();
paint.setAntiAlias(true);
paint.setColorFilter(new PorterDuffColorFilter(Color.GREEN, PorterDuff.Mode.MULTIPLY));
bitmapGreen = AndroidGraphicFactory.convertToBitmap(drawableWhite, paint);
paint.setColorFilter(new PorterDuffColorFilter(Color.RED, PorterDuff.Mode.MULTIPLY));
bitmapRed = AndroidGraphicFactory.convertToBitmap(drawableWhite, paint);
marker = new Marker(latLong, bitmapGreen, 0, -bitmapGreen.getHeight() / 2);
super.onCreate(sis);
}
代码示例来源:origin: mapsforge/mapsforge
@SuppressWarnings("deprecation")
@TargetApi(Build.VERSION_CODES.LOLLIPOP)
static Marker createTappableMarker(final Context c, int resourceIdentifier,
LatLong latLong) {
Drawable drawable = Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP ? c.getDrawable(resourceIdentifier) : c.getResources().getDrawable(resourceIdentifier);
Bitmap bitmap = AndroidGraphicFactory.convertToBitmap(drawable);
bitmap.incrementRefCount();
return new Marker(latLong, bitmap, 0, -bitmap.getHeight() / 2) {
@Override
public boolean onTap(LatLong geoPoint, Point viewPosition,
Point tapPoint) {
if (contains(viewPosition, tapPoint)) {
Toast.makeText(c,
"The Marker was tapped " + geoPoint.toString(),
Toast.LENGTH_SHORT).show();
return true;
}
return false;
}
};
}
代码示例来源:origin: mapsforge/mapsforge
@SuppressWarnings("deprecation")
@TargetApi(Build.VERSION_CODES.LOLLIPOP)
@Override
protected void createLayers() {
super.createLayers();
// Bubble overlays
for (DummyContent.DummyItem item : DummyContent.ITEMS) {
TextView bubbleView = new TextView(this);
Utils.setBackground(bubbleView, Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP ? getDrawable(R.drawable.balloon_overlay_unfocused) : getResources().getDrawable(R.drawable.balloon_overlay_unfocused));
bubbleView.setGravity(Gravity.CENTER);
bubbleView.setMaxEms(20);
bubbleView.setTextSize(15);
bubbleView.setTextColor(Color.BLACK);
bubbleView.setText(item.text);
bubble = Utils.viewToBitmap(this, bubbleView);
bubble.incrementRefCount();
this.mapView.getLayerManager().getLayers().add(new Marker(item.location, bubble, 0, -bubble.getHeight() / 2));
}
}
代码示例来源:origin: mapsforge/mapsforge
@Override
protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec) {
setMeasuredDimension(mapScaleBar.getMapScaleBitmap().getWidth(), mapScaleBar.getMapScaleBitmap().getHeight());
}
代码示例来源:origin: mapsforge/mapsforge
@SuppressWarnings("deprecation")
private void addGroupMarker() {
LatLong latLong = new LatLong(52.525582, 13.370061);
Bitmap bitmap = AndroidGraphicFactory.convertToBitmap(getResources().getDrawable(R.drawable.marker_green));
GroupMarker groupMarker = new GroupMarker(latLong, bitmap, 0, -bitmap.getHeight() / 2, mapView.getLayerManager().getLayers(), BLACK);
for (int i = 0; i < 10.; i++) {
groupMarker.getChildren().add(new ChildMarker(latLong, bitmap, 0, 0, BLACK));
}
mapView.addLayer(groupMarker);
}
}
代码示例来源:origin: mapsforge/mapsforge
private Rectangle getBitmapRectangle(Point center) {
Boolean isSelected = isSelected();
return new Rectangle(
center.x
- (float) cluster.getClusterManager().markerIconBmps.get(markerType)
.getBitmap(isSelected).getWidth()
+ cluster.getClusterManager().markerIconBmps.get(markerType).getIconOffset().x,
center.y
- (float) cluster.getClusterManager().markerIconBmps.get(markerType)
.getBitmap(isSelected).getHeight()
+ cluster.getClusterManager().markerIconBmps.get(markerType).getIconOffset().y,
center.x
+ (float) cluster.getClusterManager().markerIconBmps.get(markerType)
.getBitmap(isSelected).getWidth()
+ cluster.getClusterManager().markerIconBmps.get(markerType).getIconOffset().x,
center.y
+ (float) cluster.getClusterManager().markerIconBmps.get(markerType)
.getBitmap(isSelected).getHeight()
+ cluster.getClusterManager().markerIconBmps.get(markerType).getIconOffset().y);
}
代码示例来源:origin: org.mapsforge/mapsforge-map
/**
* Called from {@link MapView}
*
* @param graphicContext The graphicContext to use to draw the MapScaleBar
*/
public void draw(GraphicContext graphicContext) {
if (!this.visible) {
return;
}
if (this.mapViewDimension.getDimension() == null) {
return;
}
if (this.isRedrawNecessary()) {
redraw(this.mapScaleCanvas);
this.redrawNeeded = false;
}
int positionLeft = calculatePositionLeft(0, this.mapViewDimension.getDimension().width, this.mapScaleBitmap.getWidth());
int positionTop = calculatePositionTop(0, this.mapViewDimension.getDimension().height, this.mapScaleBitmap.getHeight());
graphicContext.drawBitmap(this.mapScaleBitmap, positionLeft, positionTop);
}
内容来源于网络,如有侵权,请联系作者删除!