2017-09-15 3 views
1

Ich versuche, ein Bild wie diese, um die Größe:Wie skaliere ich das Bild effizient mit Antialias?

aPaint.setAntiAlias(true); // Enabling this flag will cause all draw operations that support antialiasing to use it. 
aPaint.setFilterBitmap(True); // enable bilinear sampling on scaled bitmaps. If cleared, scaled bitmaps will be drawn with nearest neighbor sampling, likely resulting in artifacts. 
apaint.setDither(true); // Enabling this flag applies a dither to any blit operation where the target's colour space is more constrained than the source. 
aCanvas.drawBitmap(aBitmap, aJSrcRect, aJDestRectf, apaint); 

Aber ich habe nicht ein sehr gutes antialised Bild (es ist Anti-Aliasing, aber nicht sehr gut). Hier ist ein Bild, das mein Problem

enter image description here

Was kann ich tun, um die Qualität des Anti-Aliasing unter Android zu erhöhen?

Antwort

1

Für Anti-Aliasing-Effekt, können Sie versuchen, eine Farbe wie diese zu erstellen:

Paint paint= new Paint(); 
paint.setFlags(Paint.ANTI_ALIAS_FLAG); 
paint.setAntiAlias(true); 
paint.setFilterBitmap(true); 

Schließlich gelten Farbe auf Leinwand mit:

canvas.drawBitmap(mBitmap, 0.f, 0.f, paint) 
+0

paint.setAntiAlias ​​(true); ist nur ein Helfer für paint.setFlags (Paint.ANTI_ALIAS_FLAG); :(Wie Sie im Beispielcode sehen, gab ich es bereits, was ich tat :( –

Verwandte Themen