Skip to content

Commit

Permalink
AwtCanvas fill color with alpha (#891)
Browse files Browse the repository at this point in the history
  • Loading branch information
devemux86 authored Dec 29, 2021
1 parent 044c8ce commit 8e0d467
Showing 1 changed file with 3 additions and 8 deletions.
11 changes: 3 additions & 8 deletions vtm-desktop/src/org/oscim/awt/AwtCanvas.java
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
/*
* Copyright 2010, 2011, 2012, 2013 mapsforge.org
* Copyright 2013 Hannes Janetzek
* Copyright 2016-2017 devemux86
* Copyright 2016-2021 devemux86
* Copyright 2017 nebular
* Copyright 2017 Longri
*
Expand All @@ -25,12 +25,7 @@
import org.oscim.backend.canvas.Color;
import org.oscim.backend.canvas.Paint;

import java.awt.AlphaComposite;
import java.awt.Composite;
import java.awt.Graphics2D;
import java.awt.Image;
import java.awt.RenderingHints;
import java.awt.Shape;
import java.awt.*;
import java.awt.font.TextLayout;
import java.awt.geom.AffineTransform;
import java.awt.image.BufferedImage;
Expand Down Expand Up @@ -188,7 +183,7 @@ public void fillColor(int color) {

@Override
public void fillRectangle(float x, float y, float width, float height, int color) {
java.awt.Color awtColor = color == Color.TRANSPARENT ? TRANSPARENT : new java.awt.Color(color);
java.awt.Color awtColor = color == Color.TRANSPARENT ? TRANSPARENT : new java.awt.Color(color, true);
Composite originalComposite = this.canvas.getComposite();
this.canvas.setComposite(AlphaComposite.getInstance(color == Color.TRANSPARENT ? AlphaComposite.CLEAR : AlphaComposite.SRC_OVER));
this.canvas.setColor(awtColor);
Expand Down

0 comments on commit 8e0d467

Please sign in to comment.