Update of /cvsroot/metamorphosis/krysalis-jplugin/src/java/org/krysalis/swingx/concerns
In directory sc8-pr-cvs1:/tmp/cvs-serv32451/java/org/krysalis/swingx/concerns
Modified Files:
AntiAliasing.java
Log Message:
New Antialiasing system, that uses cglib.net interceptors.
Index: AntiAliasing.java
===================================================================
RCS file: /cvsroot/metamorphosis/krysalis-jplugin/src/java/org/krysalis/swingx/concerns/AntiAliasing.java,v
retrieving revision 1.1.1.1
retrieving revision 1.2
diff -C2 -d -r1.1.1.1 -r1.2
*** AntiAliasing.java 15 Apr 2003 21:10:49 -0000 1.1.1.1
--- AntiAliasing.java 1 Oct 2003 06:39:41 -0000 1.2
***************
*** 8,14 ****
--- 8,21 ----
package org.krysalis.swingx.concerns;
+ import java.awt.Component;
import java.awt.Graphics;
import java.awt.Graphics2D;
import java.awt.RenderingHints;
+ import java.lang.reflect.Method;
+ import java.util.List;
+ import java.util.Vector;
+
+ import net.sf.cglib.BeforeAfterInterceptor;
+ import net.sf.cglib.Enhancer;
/**
***************
*** 17,24 ****
*@version 1.0
*/
! public class AntiAliasing {
! public static boolean antialias = false;
public static void setAntialiasing(boolean doAntialias) {
antialias = doAntialias;
--- 24,37 ----
*@version 1.0
*/
! public class AntiAliasing extends BeforeAfterInterceptor {
! static AntiAliasing callback = new AntiAliasing();
!
! public static boolean antialias = true;
+ /** Creates a new instance of Trace */
+ private AntiAliasing() {
+ }
+
public static void setAntialiasing(boolean doAntialias) {
antialias = doAntialias;
***************
*** 39,41 ****
}
! }
--- 52,130 ----
}
! public static void alias(Graphics g1) {
! if (antialias) {
! Graphics2D g = (Graphics2D) g1;
! g.setRenderingHint(RenderingHints.KEY_ANTIALIASING,
! RenderingHints.VALUE_ANTIALIAS_OFF);
! g.setRenderingHint(RenderingHints.KEY_RENDERING,
! RenderingHints.VALUE_RENDER_DEFAULT);
! g.setRenderingHint(RenderingHints.KEY_TEXT_ANTIALIASING,
! RenderingHints.VALUE_TEXT_ANTIALIAS_OFF);
! g.setRenderingHint(RenderingHints.KEY_FRACTIONALMETRICS,
! RenderingHints.VALUE_FRACTIONALMETRICS_OFF);
! }
! }
!
! public static Object newInstance( Class clazz ){
! try{
! return Enhancer.enhance(clazz, null, callback);
! }catch( Throwable e ){
! e.printStackTrace();
! throw new Error(e.getMessage());
! }
!
! }
!
!
! /** this method is invoked after execution
! * @param obj this
! * @param method Method
! * @param args Arg array
! * @param retValFromBefore value returned from beforeInvoke
! * @param invokedSuper value returned from invoke super
! * @param retValFromSuper value returner from super
! * @param e Exception thrown by super
! * @throws Throwable any exeption
! * @return value to return from generated method
! */
! public Object afterReturn(Object obj,
! Method method,
! Object[] args,
! boolean invokedSuper,
! Object retValFromSuper,
! Throwable e) throws java.lang.Throwable {
!
! if(e != null){
! throw e.fillInStackTrace();
! }
!
! if(method.getName().equals("paint")){
! Graphics g1 = (Graphics) args[0];
! alias( g1) ;
! }
!
! return retValFromSuper;
! }
!
! /** Generated code calls this method before invoking super
! * @param obj this
! * @param method Method
! * @param args Arg array
! * @param retValFromBefore value returned from beforeInvoke
! * @throws Throwable any exeption to stop execution
! * @return true if need to invoke super
! */
! public boolean invokeSuper(Object obj, java.lang.reflect.Method method, Object[] args) throws java.lang.Throwable {
!
! if(method.getName().equals("paint")){
! Graphics g1 = (Graphics) args[0];
! antialias( g1) ;
! }
!
! return true;
! }
!
! }
!
!
!
-------------------------------------------------------
This sf.net email is sponsored by:ThinkGeek
Welcome to geek heaven.
http://thinkgeek.com/sf
lmpx.com only provides a reader for public news (NNTP) servers. It is not
affiliated with the servers or forums shown here and is not responsible for
the content of articles, which is written by their respective authors.