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

原文地址:https://www.cnblogs.com/borter/p/9575637.html

时间: 2024-10-12 01:32:43

e577. Enabling Antialiasing的相关文章

Morphological Antialiasing

mlaa有着和ssao很像的特点,比较简单的技术,很棒的效果. 而且mlaa显然要比ssao有冲击力的多,个人觉得要把msaa干翻了. 先看对比图: mlaa的产生发展也很有意思,本来是intel的人发明的,估计是要配合larabee的,是一种适合在cpu上做的aa技术. 但是马上被cpu端计算能力过剩的ps3看上了,被实现出来,在战神等游戏里大展宏图. 在后面gpu上也开始改进,sig10上有个文章讲gpu mlaa,但是效率很一般,720p的在gtx295上依旧要3.4ms. http://

OpenFlow:Enabling Innovation in Campus Networks

SDN领域,OpenFLow现在已经成为了广泛使用的南向接口协议.若想好好学习SDN,在这个领域有所进步,需要熟悉OpenFlow协议.我最近找了篇有关OpenFLow的论文,发现最早该协议是在Sigcomm2008中的一篇论文<OpenFlow:Enabling innovation in Campus Networks>,作者之一是SDN领域创始人之一的Nick McKeown.现在我写下一些学习笔)记: 1. 最早该协议是作用于校园网建设,现在已经成为较为通用的SDN南向协议.至于网络的

outdated: 21.Lines, Antialiasing, Timing, Ortho View And Simple Sounds

这是一个简单的小游戏,类型相当于amidar,不过也有1000行,手困眼花......UP\DOWN\LEFT\RIGHT控制,SPACE重新开始. 在TimerInit()函数中,QueryPerformanceFrequency()函数查询性能计数器的频率.QueryPerformanceCounter()函数查询性能计数器的当前值.两个函数的参数都用到了LARGE_INTEGER的强制转换.以前写过一篇介绍的文章. 在glPrint()函数里,新添了glScalef()函数(用缩放矩阵乘以

Enabling Active Directory Authentication for VMWare Server running on Linux《转载》

Enabling Active Directory Authentication for VMWare Server running on Linux Version 0.2 - Adam Breidenbaugh - 2007-06-29 Purpose The purpose of this guide is as follows: Document the steps necessary to enable Active Directory Authentication on a Linu

tomcat Enabling JMX Remote

wiki 利用JMX做存活监控 cat /opt/wiki/work/bin/setenv.sh | grep jmxremoteCATALINA_OPTS="-Dcom.sun.management.jmxremote -Dcom.sun.management.jmxremote.port=8410 -Dcom.sun.management.jmxremote.ssl=false -Dcom.sun.management.jmxremote.authenticate=false -Duser.

Unity3d 超级采样抗锯齿 Super Sampling Anti-Aliasing

Super Sampling Anti-Aliasing SSAA算是在众多抗锯齿算法中比较昂贵的一种了,年代也比较久远,但是方法比较简单, 主要概括为两步 1.    查找边缘 2.    模糊边缘 这是一种post processing的处理方法, 接下来我们就看看怎么实现 查找边缘 查找边缘的原因也是因为减少消耗,这样就可以只在边缘处进行超级采样,不必为全图进行采样了. 之前的文章详细说过三种查找边缘的方法Roberts,Sobel,Canny ,其中sobel最优,所以我们就是用sobe

抗锯齿(后期效果) Antialiasing (PostEffect)

The Antialiasing (PostEffect) offers   a set of algorithms designed to give a smoother appearance to graphics.   When two areas of different colour adjoin in an image, the shape of the   pixels can form a very distinctive "staircase" along the b

System and method for controlling switching between VMM and VM using enabling value of VMM timer indicator and VMM timer value having a specified time

In one embodiment, a method includes transitioning control to a virtual machine (VM) from a virtual machine monitor (VMM), determining that a?VMM?timer indicator is set to an enabling value, and identifying a?VMM?timer?value configured by the?VMM. Th

SQL Server 2012安装错误案例:Error while enabling Windows feature: NetFx3, Error Code: -2146498298

案例环境: 服务器环境 :    Windows Server 2012 R2 Standard 数据库版本 :    SQL Server 2012 SP1 案例介绍:   在Windows Server 2012 R2 Standard版本上安装SQL SERVER 2012时,安装过程弹出如下错误提示: Error while enabling Windows feature: NetFx3, Error Code: -2146498298, Please try enabling Win