e577. Enabling Antialiasing

Posted borter

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了e577. Enabling Antialiasing相关的知识,希望对你有一定的参考价值。

// See e575 The Quintessential Drawing Program
    public void paint(Graphics g) {
        // Retrieve the graphics context; this object is used to paint shapes
        Graphics2D g2d = (Graphics2D)g;
    
        // Determine if antialiasing is enabled
        RenderingHints rhints = g2d.getRenderingHints();
        boolean antialiasOn = rhints.containsValue(RenderingHints.VALUE_ANTIALIAS_ON);
    
        // Enable antialiasing for shapes
        g2d.setRenderingHint(RenderingHints.KEY_ANTIALIASING,
                             RenderingHints.VALUE_ANTIALIAS_ON);
    
        // Disable antialiasing for shapes
        g2d.setRenderingHint(RenderingHints.KEY_ANTIALIASING,
                             RenderingHints.VALUE_ANTIALIAS_OFF);
    
        // Draw shapes...; see e586 Drawing Simple Shapes
    
        // Enable antialiasing for text
        g2d.setRenderingHint(RenderingHints.KEY_TEXT_ANTIALIASING,
                             RenderingHints.VALUE_TEXT_ANTIALIAS_ON);
    
        // Draw text...; see e591 Drawing Simple Text
    
        // Disable antialiasing for text
        g2d.setRenderingHint(RenderingHints.KEY_TEXT_ANTIALIASING,
                             RenderingHints.VALUE_TEXT_ANTIALIAS_OFF);
    }

 

Related Examples

以上是关于e577. Enabling Antialiasing的主要内容,如果未能解决你的问题,请参考以下文章

sh 源自https://gist.github.com/ninjapanzer/aa81db16bae54431c41010e622d577b6

053-577

Enabling Chrome Developer Tools inside Postman

tomcat Enabling JMX Remote

Enabling remote administration on windows server 2022

Enabling Session Persistence