【问题标题】:How to set Anti Aliasing in Blackberry Storm?如何在黑莓风暴中设置抗锯齿?
【发布时间】:2009-08-29 04:15:02
【问题描述】:

我正在画一个位图,比如..

bitmap[i] = new Bitmap(60, 60);  
Graphics g = new Graphics(bitmap[i]);
g.setColor(Color.BLACK);
g.drawLine(....);

现在如何在 g.drawLine() 之前设置 Anti-Aliasing?

【问题讨论】:

    标签: user-interface graphics blackberry blackberry-storm rim-4.7


    【解决方案1】:

    抗锯齿模式使用public void setDrawingStyle(int drawStyle, boolean on)

    对于线条使用

    graphics.setDrawingStyle(Graphics.DRAWSTYLE_AALINES, true);
    graphics.drawLine(x1, y1, x2, y2);
    graphics.setDrawingStyle(Graphics.DRAWSTYLE_AALINES, false);
    

    对于poligons使用

    graphics.setDrawingStyle(Graphics.DRAWSTYLE_AAPOLYGONS, true);
    graphics.drawRect(x, y, width, height);
    graphics.setDrawingStyle(Graphics.DRAWSTYLE_AAPOLYGONS, false);
    

    【讨论】:

    • 谢谢.. 我在模拟器中看不到它的效果。我将在 Storm 上进行测试。
    • 标志DRAWSTYLE_AAPOLYGONS 也适用于圆形和椭圆形。它的效果在模拟器中很明显,但您可能需要将缩放增加到 4 倍。
    猜你喜欢
    • 2014-02-18
    • 2012-10-20
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多