src/demo/share/java2d/J2DBench/src/j2dbench/Destinations.java

Print this page

        

*** 1,7 **** /* ! * Copyright (c) 2002, 2011, Oracle and/or its affiliates. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * --- 1,7 ---- /* ! * Copyright (c) 2002, 2014, Oracle and/or its affiliates. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: *
*** 55,64 **** --- 55,65 ---- public abstract class Destinations extends Option.Enable { public static Group.EnableSet destroot; public static Group bufimgdestroot; public static Group compatimgdestroot; + public static Group volimgdestroot; public static void init() { destroot = new Group.EnableSet(TestEnvironment.globaloptroot, "dest", "Output Destination Options");
*** 77,98 **** --- 78,116 ---- new CompatImg(Transparency.BITMASK); new CompatImg(Transparency.TRANSLUCENT); } if (ImageTests.hasVolatileImage) { + if(ImageTests.hasTransparentVolatileImage) { + volimgdestroot = new Group.EnableSet(destroot, "volimg", + "Output to Volatile Image"); + + volimgdestroot.setHorizontal(); + new VolatileImg(); + new VolatileImg(Transparency.OPAQUE); + new VolatileImg(Transparency.BITMASK); + new VolatileImg(Transparency.TRANSLUCENT); + } else if (ImageTests.hasVolatileImage){ + volimgdestroot = new Group.EnableSet(destroot, "volimg", + "Output to Volatile Image"); + + volimgdestroot.setHorizontal(); new VolatileImg(); } + } bufimgdestroot = new Group.EnableSet(destroot, "bufimg", "BufferedImage Destinations"); new BufImg(BufferedImage.TYPE_INT_RGB); new BufImg(BufferedImage.TYPE_INT_ARGB); new BufImg(BufferedImage.TYPE_INT_ARGB_PRE); new BufImg(BufferedImage.TYPE_3BYTE_BGR); new BufImg(BufferedImage.TYPE_BYTE_INDEXED); new BufImg(BufferedImage.TYPE_BYTE_GRAY); + new BufImg(BufferedImage.TYPE_4BYTE_ABGR); + new BufImg(BufferedImage.TYPE_4BYTE_ABGR_PRE); new CustomImg(); } } public Destinations(Group parent,
*** 204,225 **** } } } public static class VolatileImg extends Destinations { public VolatileImg() { ! super(destroot, "volimg", "Output to Volatile Image", false); } ! public String getModifierValueName(Object val) { ! return "VolatileImg"; } ! public void setDestination(TestEnvironment env) { Component c = env.getCanvas(); ! env.setTestImage(c.createVolatileImage(env.getWidth(), ! env.getHeight())); } } public static class BufImg extends Destinations { --- 222,287 ---- } } } public static class VolatileImg extends Destinations { + private final int transparency; + + public static final String[] ShortNames = { + "volimg", + "opqvolimg", + "bmvolimg", + "transvolimg", + }; + + public static final String[] ShortDescriptions = { + "Default", + "Opaque", + "Bitmask", + "Translucent", + }; + + public static final String[] LongDescriptions = { + "Default VolatileImg Image", + "Opaque VolatileImg Image", + "Bitmask VolatileImg Image", + "Translucent VolatileImg Image", + }; + + public static final String[] ModifierNames = { + "VolatileImg()", + "VolatileImg(Opaque)", + "VolatileImg(Bitmask)", + "VolatileImg(Translucent)", + }; + public VolatileImg() { ! this(0); } ! public VolatileImg(final int transparency) { ! super(volimgdestroot, ! ShortNames[transparency], ! ShortDescriptions[transparency], ! false); ! this.transparency = transparency; } ! public String getModifierValueName(final Object val) { ! return ModifierNames[transparency]; ! } ! ! public void setDestination(final TestEnvironment env) { Component c = env.getCanvas(); ! GraphicsConfiguration gc = c.getGraphicsConfiguration(); ! int w = env.getWidth(); ! int h = env.getHeight(); ! if (transparency == 0) { ! env.setTestImage(gc.createCompatibleVolatileImage(w, h)); ! } else { ! env.setTestImage(gc.createCompatibleVolatileImage(w, h, transparency)); ! } } } public static class BufImg extends Destinations {