Opaque Rendering?

The company which I am working for is interested in using 3D pdf’s to give presentations so I have been testing this. I am creating model files using Microstation and then using the "print to 3D pdf” utility to create the 3D pdf. All is fine when viewing this file at work but, when I send this pdf home to view on my Mac the file losses it’s shading. No matter what type of lighting or rendering I choose, it remains opaque. Can I fix this, Is this a Windows/Mac thing or is something getting lost when I mail the file?

Change the 3D preferences to software rendering, to see if it's a GPU driver issue.
No change
Ensure the 3D model isn't using "vertex colors" instead of real materials. See Reader XI and Vertex Colors 
I will look into this... Would this file appear different from one computer to the next? Even if I apply surface materials, I get no shading on the file I send home. I see the material just fine but no shading when sent home. Not sure if this is the same thing.
Disable any embedded 3D scripts just in case they're overriding the display modes.
No change
If you email the file back to your office computer, does it look OK again?
Will try this on Monday
If you're using Acrobat on your Mac, try opening the file in Adobe Reader instead (you can install both at the same time).
No change
If the files remain 'broken' when sent back to your office computer, you'll need to run a bit-for-bit comparison to see what's changed, with something like VBinDiff
Wow, I was looking for a more simple answer to this problem.  I just wanted to insure that wherever we sent these files that the one receiving these PDF's would be able to view them without much trouble and all they would need was the Adobe Reader.
However it seems much more complicated then that. I'm not sure we have the resources to look into this.
Thanks again for your time.

Similar Messages

  • Avoiding PrinterJob to print two or more times a page...

    Hi all,
    I'm using jdk 1.4 and I have noticed that the PrinterJob prints a page two times, then I have also discovered the reason:
    taken from http://java.sun.com/products/java-media/2D/reference/faqs/index.html#Q_What_are_the_causes_of_large_s:
    Q: When printing using java.awt.PrinterJob, why does it print each page at least twice (and sometimes much more than that)?
    A: The root of this is that Java 2D printing needs to be able to print everything that Java 2D can render to the screen, and that includes translucent colours, images etc which cannot always be printed directly in Postscript or GDI except when printing everything as one big image, so the implementation tries to avoid this by calling first to discover the rendering that needs to be done for the page. If its simple opaque rendering then only one more call is needed to render the page. If there are translucent colours then multiple calls are done for "bands" down the page to limit the size of the image being generated and hence constrain peak memory usage.
    My question is: is there an alternative way to print a page avoiding calling the print method two or more times?
    Thank you very much, best regards.
    Raffaele

    Hi all,
    I'm the same person as gamby1980 and I'm yet (from 2006 :-) ) waiting for an answer...
    Does someone know a mechanism to force the printing system to call print method two times? I'm pretty sure that I haven't "translucent color" in the pages I want to print, and so I don't need the second step in printing...
    Thanks again!
    Regards
    Raffaele

  • How do I fix extremely slow rendering with buffered images?

    I've found random examples of people with this problem, but I can't seem to find any solutions in my googling. So I figured I'd go to the source. Basically, I am working on a simple platform game in java (an applet) as a surprise present for my girlfriend. The mechanics work fine, and are actually really fast, but the graphics are AWFUL. I wanted to capture some oldschool flavor, so I want to render several backgrounds scrolling in paralax (the closest background scrolls faster than far backgrounds). All I did was take a buffered image and create a graphics context for it. I pass that graphics context through several functions, drawing the background, the distant paralax, the player/entities, particles, and finally close paralax.
    Only problem is it runs at like 5 fps (estimated, I havn't actually counted).
    I KNOW this is a graphics thing, because I can make it run quite smoothly by commenting out the code to draw the background/paralax backgrounds... and that code is nothing more complicated than a graphics2d.drawImage
    So obviously I am doing something wrong here... how do I speed this up?
    Code for main class follows:
    import javax.swing.JApplet;
    import java.awt.*;
    import java.awt.image.BufferedImage;
    import java.awt.event.*;
    import Entities.*;
    import Worlds.*;
    // run this applet in 640x480
    public class Orkz extends JApplet implements Runnable, KeyListener
         double x_pos = 10;
         double y_pos = 400;
         int xRes=640;
         int yRes=480;
         boolean up_held;
         boolean down_held;
         boolean left_held;
         boolean right_held;
         boolean jump_held;
         Player player;
         World world;
         BufferedImage buffer;
         Graphics2D bufferG2D;
         int radius = 20;
         public void init()
              //xRes=(int) this.getSize().getWidth();
              //yRes=(int) this.getSize().getHeight();
            buffer=new BufferedImage(xRes, yRes, BufferedImage.TYPE_INT_RGB);
            bufferG2D=buffer.createGraphics();
              addKeyListener(this);
         public void start ()
                player=new Player(320, 240, xRes,yRes);
                world=new WorldOne(player, getCodeBase(), xRes, yRes);
                player.setWorld(world);
               // define a new thread
               Thread th = new Thread (this);
               // start this thread
               th.start ();
         public void keyPressed(KeyEvent e)
              //works fine
         }//end public void keypressed
         public void keyReleased(KeyEvent e)
              //this works fine
         public void keyTyped(KeyEvent e)
         public void paint( Graphics g )
               update( g );
        public void update(Graphics g)
             Graphics2D g2 = (Graphics2D)g;              
             world.render(bufferG2D);                
             g2.drawImage(buffer, null, null);
         public void run()
              // lower ThreadPriority
              Thread.currentThread().setPriority(Thread.MIN_PRIORITY);
              long tm;
              long tm2;
              long tm3;
              long tmAhead=0;
              // run a long while (true) this means in our case "always"
              while (true)
                   tm = System.currentTimeMillis();
                   player.moveEntity();
                  x_pos=player.getXPos();
                  y_pos=player.getYPos();
                  tm2 = System.currentTimeMillis();
                    if ((tm2-tm)<20)
                     // repaint the applet
                     repaint();
                    else
                         System.out.println("Skipped draw");
                    tm3= System.currentTimeMillis();
                    tmAhead=25-(tm3-tm);
                    try
                        if (tmAhead>0) 
                         // Stop thread for 20 milliseconds
                          Thread.sleep (tmAhead);
                          tmAhead=0;
                        else
                             System.out.println("Behind");
                    catch (InterruptedException ex)
                          System.out.println("Exception");
                    // set ThreadPriority to maximum value
                    Thread.currentThread().setPriority(Thread.MAX_PRIORITY);
         public void stop() { }
         public void destroy() { }
    }Here's the code for the first level
    package Worlds;
    import java.awt.Color;
    import java.awt.Graphics2D;
    import java.awt.image.BufferedImage;
    import java.util.*;
    import javax.swing.*;
    import javax.imageio.*;
    import java.awt.event.*;
    import java.awt.*;
    import java.awt.image.*;
    import java.io.File;
    import java.net.URL;
    import java.awt.geom.AffineTransform;
    import Entities.Player;
    public class WorldOne implements World
         Player player;
         //Location of Applet
         URL codeBase;
         // Image Resources
         BufferedImage paralax1Image;
         BufferedImage paralax2Image;
         BufferedImage backgroundImage;
         // Graphics Elements     
         int xRes;
         int yRes;
         double paralaxScale1,paralaxScale2;
         double worldSize;
         int frameX=1;
         int frameY=1;
         public WorldOne(Player player, URL codeBase, int xRes, int yRes)
              this.player=player;
              this.codeBase=codeBase;
              this.xRes=xRes;
              this.yRes=yRes;
              worldSize=4000;
            String backgroundImagePath="worlds\\world1Graphics\\WorldOneBack.png";
            String paralax1ImagePath="worlds\\world1Graphics\\WorldOnePara1.png";
            String paralax2ImagePath="worlds\\world1Graphics\\WorldOnePara2.png";
            try
            URL url1 = new URL(codeBase, backgroundImagePath);
             URL url2 = new URL(codeBase, paralax1ImagePath);
             URL url3 = new URL(codeBase, paralax2ImagePath);
            backgroundImage = ImageIO.read(url1);
            paralax1Image  = ImageIO.read(url2);
            paralax2Image = ImageIO.read(url3);
            paralaxScale1=(paralax1Image.getWidth()-xRes)/worldSize;
            paralaxScale2=(paralax2Image.getWidth()-xRes)/worldSize;
            catch (Exception e)
                 System.out.println("Failed to load Background Images in Scene");
                 System.out.println("Background Image Path:"+backgroundImagePath);
                 System.out.println("Background Image Path:"+paralax1ImagePath);
                 System.out.println("Background Image Path:"+paralax2ImagePath);
         }//end constructor
         public double getWorldSize()
              double xPos=player.getXPos();
              return worldSize;
         public void setFramePos(int frameX, int frameY)
              this.frameX=frameX;
              this.frameY=frameY;
         public int getFrameXPos()
              return frameX;
         public int getFrameYPos()
              return frameY;
         public void paralax1Render(Graphics2D renderSpace)
              int scaledFrame=(int)(paralaxScale1*frameX);
              renderSpace.drawImage(paralax1Image,-scaledFrame,0,null); //Comment this to increase performance Massively
         public void paralax2Render(Graphics2D renderSpace)
              int scaledFrame=(int)(paralaxScale2*frameX);
              renderSpace.drawImage(paralax2Image,-scaledFrame,0,null); //Comment this to increase performance Massively
         public void backgroundRender(Graphics2D renderSpace)
              renderSpace.drawImage(backgroundImage,null,null); //Comment this to increase performance Massively
         public void entityRender(Graphics2D renderSpace)
              //System.out.println(frameX);
              double xPos=player.getXPos()-frameX+xRes/2;
             double yPos=player.getYPos();
             int radius=15;
             renderSpace.setColor (Color.blue);
            // paint a filled colored circle
             renderSpace.fillOval ((int)xPos - radius, (int)yPos - radius, 2 * radius, 2 * radius);
              renderSpace.setColor(Color.blue);
         public void particleRender(Graphics2D renderSpace)
              //NYI
         public void render(Graphics2D renderSpace)
              backgroundRender(renderSpace);
              paralax2Render(renderSpace);
              entityRender(renderSpace);
              paralax1Render(renderSpace);
    }//end class WorldOneI can post more of the code if people need clarification. And to emphasize, if I take off the calls to display the background images (the 3 lines where you do this are noted), it works just fine, so this is purely a graphical slowdown, not anything else.
    Edited by: CthulhuChild on Oct 27, 2008 10:04 PM

    are the parallax images translucent by any chance? The most efficient way to draw images with transparent areas is to do something like this:
         public static BufferedImage optimizeImage(BufferedImage img)
              GraphicsDevice gd = GraphicsEnvironment.getLocalGraphicsEnvironment().getDefaultScreenDevice();                    
              GraphicsConfiguration gc = gd.getDefaultConfiguration();
              boolean istransparent = img.getColorModel().hasAlpha();
              BufferedImage img2 = gc.createCompatibleImage(img.getWidth(), img.getHeight(), istransparent ? Transparency.BITMASK : Transparency.OPAQUE);
              Graphics2D g = img2.createGraphics();
              g.drawImage(img, 0, 0, null);
              g.dispose();
              return img2;
         }I copied this from a util class I have and I had to modify it a little, I hope I didn't break anything.
    This piece of code does a number of things:
    - it allows the images to be hardware accelerated
    - the returned image is 100% compatible with the display, regardless of what the input image is
    - BITMASK transparent images are an incredible amount faster than translucent images
    BITMASK means that a pixel is either fully transparent or it is fully opaque; there is no alpha blending being performed. Alpha blending in software rendering mode is very slow, so this may be the bottleneck that is bothering you.
    If you require your parallax images to be translucent then I wouldn't know how to get it to draw quicker in an applet, other than trying out java 6 update 10 to see if it fixes things.

  • Non-opaque colours

    Greetings,
    This question is a bit of a sequel to this other thread. The last couple of days
    I've been trying to find visual 'pleasing' way to show an 'alert' or 'alarm'
    status for some real time processes. With the help of Camickr I started
    off using a glass pane that simply draws a non-opaque red colour in
    front of an entire JInternalFrame. I noticed a terrible, unacceptable
    slowdown w.r.t. the drawing of those real time processes.
    I experimented a bit more and I came to the conclusion that everything
    done using non-opaque colours is unusable if you want to have anything
    drawn fast (~100 times per second). It simply isn't fast enough. All I do
    is redraw a couple of JPanels with those glass panes in front of them.
    Using opaque colours or other tricks to show an 'alarm' status are fast
    enough.More than fast enough, i.e. I've got plenty of time to show an
    abundance of other information. It's just those non-opaque colours that
    are a show stopper.
    Has anyone else noticed this behaviour (MS Windows and Linux)?
    Has anyone else found a workaround to speed things up considerably?
    kind regards,
    Jos

    I don't use the javax.swing.Timer but I do usequite a few threads:
    I've tried to compare the difference between using a
    Swing Timer and and Thread for animation and I didn't
    notice any difference in animation speed. (I just
    prefered a Timer because I think its easier to
    understand and control the timing of events.Yes I do use TImers, the java.util.Timer class and I schedule them with
    the tasks that need to be run. Quite a lot of those tasks have nothing to
    do with Swing, just the display stuff which can be en/disabled by the user.
    I use quite a lot of those java.util.Timer objects because the device I'm
    monitoring is quite a complex device with up to eight "sub devices".
    The device itself can be monitored quite slowly: a thermometer, three
    A/D colour components, a voltage value, eight bits of digital input and
    a digital counter value. Those "sub devices" produce digital colour values:
    either sRGB or Lab values as well as an "alarm status" values. Those
    sub devices must be sampled quite often. My old view handled everything
    quite well but I want the view to be more appealing to the users. Hence
    this topic.
    However, I have compared using a single Timer to animate 6
    components at once, vs 6 Timers to animate a single component
    each. A single Timer is almost twice as fast at repainting the
    components animation as measured by the time it takes the
    components to travel its vertical distance.I keep your remark in mind. Maybe I can "bundle" some of those "monitoring"
    tasks using a single timer. The problem is that I monitor that device using
    a serial line where everything has to be sequenced. I don't want any
    congestion on that part (which has nothing to do with Swing so it renders
    this thread (sic) totally off topic ;-)
    [ snipped some code ]
    So I guess I'm suggesting that you try to merge your multiple Threads
    into a single Thread.I read you; the trouble is (see above) that those 'pulling from the device',
    'pushing into the controller' thingies are totally independent events/tasks.
    As the new view runs now, it is slowing down the entire machinery.
    I never realized (I'm not a Swing guru) that all those visuals take up so
    much time.
    thanks a bunch for your reply and
    kind regards,
    Jos
    ps. I'll play with your code and see what I can learn from it.

  • [Solved] After watching several youtube html5 720p videos, Firefox (version 33) display or screen turns black and aero transparency in windows 7 turns opaque.

    Hello ! I just want to share something familiar with that black display or screen occurs for some people. When I watch youtube videos, I used to watch them in html5 720p videos (not flash videos, https://www.youtube.com/html5 ). I upgraded firefox to version 33. No black display when I used it. Randomly and after watching several html5 videos on youtube, aero transparency in my windows 7 turns opaque and firefox display goes all black. Firefox doesn't respond at any command. I need to kill his process in task manager in order to close it. When I open firefox again, normal display goes. To relaunch aero transparency in windows 7, I need to restart the service whose name is, I think, "Desktop Window Manager Session Manager". I use windows 7 in french and the service name is "Gestionnaire de sessions de Gestionnaire de fenetrage".
    To solve this, I upgraded my graphic driver but this didn't work. I tried to put "layers.offmainthreadcomposition.enabled" to false in "about:config" menu. No random black display but some html elements turned black for some seconds or definitely when firefox rendered web pages. I tried to uncheck "Use hardware acceleration when available" in options menu. No random black display but html5 720p videos didn't play smoothly.
    Then, I chose to watch youtube 720p videos again with flash player and no random black display and html5 720p videos played normally.
    Here are my graphic acceleration infos :
    Date du pilote 7-2-2014
    Description de la carte NVIDIA GeForce GTS 360M
    DirectWrite activé false (6.2.9200.16492)
    Fenêtres avec accélération graphique 1/1 Direct3D 11 (OMTC)
    GPU #2 active false
    ID du périphérique 0x0cb1
    ID du vendeur 0x10de
    Pilotes de la carte nvd3dumx,nvwgf2umx,nvwgf2umx nvd3dum,nvwgf2um,nvwgf2um
    RAM de la carte 1024
    Rendu WebGL Google Inc. -- ANGLE (NVIDIA GeForce GTS 360M Direct3D9Ex vs_3_0 ps_3_0)
    Version du pilote 9.18.13.4052
    windowLayerManagerRemote true
    AzureCanvasBackend skia
    AzureContentBackend cairo
    AzureFallbackCanvasBackend cairo
    AzureSkiaAccelerated 0
    I hope this will be useful to solve this problem in future versions or to someone.

    This is happening to me too, I don't know if this is an Adobe Flash Player 11.5's bug or it's just my computer. All my browsers, chrome, IE9, Fox, doesn't even load anime videos. I tried reinstalling 11.5 many times, it have no effect but I use IE9 64-bit to run the videos that couldn't run. I waited 25 min for a JW player to load an episode of anime and I'm sick of it.

  • Rendering diagnostics not working in AIR 2.6

    I'm trying to move my pfi application over to AIR 2.6 and am experiencing a huge drop in frame rate.  I worked quite hard to make sure everything was cached with the GPU when working with pfi and found the rendering diagnostics to be invaluable in helping me nail down areas where the graphics weren't being cached properly.  I thought I would check to make sure that the graphics are still being cached in AIR 2.6 but when I built the application with the flag enabled, the rendering diagnostics didn't turn on.  The flag is CTTextureUploadTracking and is part of the application xml:
    <InfoAdditions>
    <![CDATA[
    <key>UIStatusBarStyle</key>
    <string>UIStatusBarStyleBlackOpaque</string>
    <key>UIRequiresPersistentWiFi</key>
    <string>NO</string>
    <key>UIDeviceFamily</key>
    <array>
    <string>1</string>
    <string>2</string>
    </array>
    <key>CTTextureUploadTracking</key>
    <true/>
    ]]>
    </InfoAdditions>
    I also tried adding the -renderingdiagnostics flag to the command line as indicated in http://download.macromedia.com/pub/labs/packagerforiphone/packagerforiphone_devguide.pdf but I get an error telling me that "The -renderingdiagnostics flag is no longer supported".  Does anyone know how to enable this now?

    If Adobe ever wants developers to properly utilize the GPU then a tool like rendering diagnostics needs to exist.  Flash has a terrible stigma of being a processor hog, slow and glitchy.  Flash doesn't need to be like this but lots and lots of sloppy coding have helped this become what people perceive as reality.  Even if 2.7 is leaps and bounds above 2.6, if no one can properly figure out how to keep data cached with the gpu then Flash apps will still be slow, battery hogs.  A visual troubleshooting tool for gpu caching problems is really essential.  If it hadn't been for that I would never have been able to figure out some of the bizarre quirks in caching.  For instance, if you have an opaque background in a Sprite and you add something to it as a child, the gpu will never be able to cache either of them correctly.  Why? I don't know, it doesn't make sense but the rendering diagnostics helped me find the problem quickly.  Please add this tool or something like it back in.  You're doing your devs a serious disservice and, consequently, helping push the idea that Flash is a technology that is no longer relevant.

  • Swf colors rendered diffrent in IE, FF, Opera

    Hi folks,
    Just changed a header from png image to swf, needed a red
    blinking "beacon" But strangely the color of the swf renders
    diffrently in all browsers except safari? Does anyone have a clue?
    Colorprofile issue in the PSD file maybe? Have tried a few options
    but no luck so far...
    http://www.swedenpicture.se/prelook/gallerilofoten/index.html
    Link is here:
    Cheers!

    FYI. Looks pretty in Firefox on my Mac (same as Safari).
    There have been some issues with Color Management in Flash:
    http://blogs.adobe.com/jnack/2008/10/get_better_color_through_fp10.html
    ...but usually you see them in the Flash authoring
    environment.
    Even more likely for this case, though, is that you're using
    wmode in your html, which is notorious for causing display
    problems:
    <param name="wmode" value="opaque" />
    Get rid of this parameter entirely. You shouldn't need it for
    this piece.

  • Flash wmode opaque/transparent cause UI messup

    Hi,
      We are using Flex to develope flash tool, we have issues when embedded in iframe, if we are using default window wmode, everything is working fine, but unfortunately we can't use this mode because the iframe has a dropdown list and has to be above our flash layer, so we use opaque mode, we find that there are following two major issues:
    1. UI rendering is messed up when user scrolls up and down using the scroll bar
    2. user can't type in non-ascii characters
      The first issue is a killer for us, if anyone can shed some lights on it, that would be super, I really googled for a many hours without a good solution yet.

    I have definitely experienced the same issue(s). I was able to overcome these issues by upgrading to a later version of the Flex SDK and wrapping all of my content in the appropriate control for scrolling, eg when scrolling spark components, wrap them in a Group.
    There are a lot of weird bugs with Flash Player when using wmode:opaque. I can't scroll using my mouse wheel when using wmode:opaque, and weird things happen with text inputs. This is a major bug in Flash Player that really needs to be addressed.

  • JSlider renderer in JTable

    Hi,
    I insert JSlider in a column of a JTable, redefining renderer and editor. The problem is that when I resized the size of the JTable (or the column with the sliders), the sliders are not resized. They are only resized if I move another window over them. Is is a repaint I have to apply ? The problem is that I do not know where to apply it.
    This is my code: I put only the JTable and the renderer, not the editor and the other components.
    This is the JTable (with a main to launch it)
    import GUI.TimeView.CategoryTimeDimensionView;
    import javax.swing.JComponent;
    import javax.swing.JFrame;
    import javax.swing.JPanel;
    import javax.swing.JScrollPane;
    import javax.swing.JTable;
    import javax.swing.table.AbstractTableModel;
    import java.awt.Color;
    import java.awt.Dimension;
    import java.awt.GridLayout;
    public class TableDialogEditDemo extends JPanel {
        private boolean DEBUG = false;
        JTable table;
        public TableDialogEditDemo() {
            super(new GridLayout(1,0));
            table = new JTable(new MyTableModel());
            table.setPreferredScrollableViewportSize(new Dimension(200, 48));
            //Create the scroll pane and add the table to it.
            JScrollPane scrollPane = new JScrollPane(table);
            table.setAutoResizeMode(javax.swing.JTable.AUTO_RESIZE_LAST_COLUMN);
            table.getColumnModel().getColumn(0).setResizable(false);
            table.getColumnModel().getColumn(0).setPreferredWidth(80);
            table.getColumnModel().getColumn(1).setResizable(false);
            table.getColumnModel().getColumn(1).setPreferredWidth(80);
            table.getColumnModel().getColumn(2).setCellRenderer(new SliderRenderer());
            table.getTableHeader().setReorderingAllowed(false);
            //Add the scroll pane to this panel.
            add(scrollPane);
        class MyTableModel extends AbstractTableModel {
            private String[] columnNames = {"Curve", "Color", "Transparency", "Displayed"};
            private Object[][] data = {
                {"Average", Color.black, 70, new Boolean(false)},
                {"Minimum", Color.black, 70, new Boolean(false)},
                {"Maximum", Color.black, 70, new Boolean(false)}
            public int getColumnCount() {
                return columnNames.length;
            public int getRowCount() {
                return data.length;
            public String getColumnName(int col) {
                return columnNames[col];
            public Object getValueAt(int row, int col) {
                return data[row][col];
            public Class getColumnClass(int c) {
                return getValueAt(0, c).getClass();
            public boolean isCellEditable(int row, int col) {
                //Note that the data/cell address is constant,
                //no matter where the cell appears onscreen.
                if (col < 1) {
                    return false;
                } else {
                    return true;
            public void setValueAt(Object value, int row, int col) {
                if (DEBUG) {
                    System.out.println("Setting value at " + row + "," + col
                            + " to " + value
                            + " (an instance of "
                            + value.getClass() + ")");
                data[row][col] = value;
                fireTableCellUpdated(row, col);
                if (DEBUG) {
                    System.out.println("New value of data:");
                    printDebugData();
            private void printDebugData() {
                int numRows = getRowCount();
                int numCols = getColumnCount();
                for (int i=0; i < numRows; i++) {
                    System.out.print("    row " + i + ":");
                    for (int j=0; j < numCols; j++) {
                        System.out.print("  " + data[i][j]);
                    System.out.println();
                System.out.println("--------------------------");
            private Object[] longValues;
        private static void createAndShowGUI() {
            JFrame frame = new JFrame("TableDialogEditDemo");
            frame.setDefaultCloseOperation(JFra
            JComponent newContentPane = new TableDialogEditDemo();
            newContentPane.setOpaque(true); //content panes must be opaque
            frame.setContentPane(newContentPane);
            frame.pack();
            frame.setVisible(true);
        public static void main(String[] args) {
            //Schedule a job for the event-dispatching thread:
            //creating and showing this application's GUI.
            javax.swing.SwingUtilities.invokeLater(new Runnable() {
                public void run() {
                    createAndShowGUI();
    }and the renderer:
    mport java.awt.Color;
    import javax.swing.JTable;
    import javax.swing.table.TableCellRenderer;
    import java.awt.Component;
    import javax.swing.BorderFactory;
    import javax.swing.JSlider;
    import javax.swing.border.Border;
    public class SliderRenderer extends JSlider implements TableCellRenderer {
        Border unselectedBorder = null;
        Border selectedBorder = null;
        public SliderRenderer() {
            setMinimum(0);
            setMaximum(100);
            setBackground(Color.white);
            setBounds(0, 0, 100, 10);
            setOpaque(true);
        public Component getTableCellRendererComponent(JTable table, Object val, boolean isSelected, boolean hasFocus, int row, int column) {
                if (isSelected) {
                    if (selectedBorder == null) {
                        selectedBorder = BorderFactory.createMatteBorder(1,3,1,3, table.getSelectionBackground());
                    setBorder(selectedBorder);
                } else {
                    if (unselectedBorder == null) {
                        unselectedBorder = BorderFactory.createMatteBorder(1,3,1,3, table.getBackground());
                    setBorder(unselectedBorder);
            int value = (Integer) val;
            setValue(value);
            return this;
    }Thank you for your answers.

    Thank you for your answers,
    blackbug wrote:
    why did you assign a default position and size for your slider.
    try to remove the default size. or the setBounds property.It was something I forgot. I removed it, but it does not change anything.
    Olek wrote:
    Try to use revalidate() or validate() with the sliders after resizing the panel.I had to the table the listener:
    addComponentListener(new java.awt.event.ComponentAdapter() {
                public void componentResized(java.awt.event.ComponentEvent evt) {
                 //table.getColumnModel().getColumn(2).getCellRenderer().getTableCellRendererComponent(table, 70, false, false, 0, 2).validate();
            });but I do not know how to apply the validate() methode: how can I find the slider?
    With table.getColumnModel().getColumn(2).getCellRenderer().getTableCellRendererComponent(table, 70, false, false, 0, 2) ?

  • White Gauze-like Opaque Layer Over Image in CS4

    Hello all,
    I recently switched to a Canon Vixia HF G10 camera.  I have recorded some clips using FXP and pf30 settings (although the manual says that pf30 is actually recorded as 60i).  When the clips are ingested into PP I view them in a sequence using the AVCHD 1080p30 preset.  When I drag a clip to the timeline and play it, it has a white semi-opaque gauze-like mask over the image.  It's like looking at the frame through a white screen door.  When I play the clip it looks perfect but as soon as I stop or frame advance the mask appears.  I have tried using NeoScene to convert the .mts files to .avi and then importing the .avi clips to PP but the same thing happens.  Can anyone tell me what's going on and, more importantly, how to stop it.
    Thanks in advance,
    Bill

    John.  I'm not sure which setting you are referring to -- camera or PP sequence.  In the camera I selected PF30, which says, "shooting at 30 frames per second progressive." But with at footnote that says "recorded at 60i."  I am not sure what the difference between shooting and recording is.  The only thing I can gues from some other technical comments I've seen elsewhere is that the .mts file contains a 30p image wrapped in  a 60i container.  On the PP side, as I said I chose the 1080p30 preset.  I went back and created a new sequence and chose 1080i30(60i) and the results are much the same as with Ann's suggestion to set Interpret Footage -- the white mask is gone but there is a jagged edge in playback.
    Ann, This will uinitially be rendered to a DVD but it is possible that i might also need to render it as BD.  I haven't rendered it yet because it takes a long time and the quality hasn't been good enough to warrant rendering and burning.  I have another option at the camera level but it doesn't help me with the existing footage.  I can record at true 24p.  That will produce 24p wrapped in a 60i container.  I can use Neoscene to unwrap it and either preserve the 24p or convert it to 30p. I don't know if that would make a difference or not.  I'll definitely check out those links.
    Life was a lot simpler with the old HDV cameras from which you could import directly into PP and I'm still trying to learn what works and what doesn't with these .mts files so I appreciate the help!

  • How to make JTree cell renderer respect layout?

    Hi,
    In the JTree tutorial, the first example TreeDemo shows a simple tree.
    http://java.sun.com/docs/books/tutorial/uiswing/components/tree.html
    If you grab the frame and make it really thin, you get a horizontal scroll bar in the top pane.
    How can I make it so that the tree cells just draw "..." at the end of the string if there is not enough space?
    I know the tree cell renderer uses JLabel, but they never seem to show "...", which is one of the best features of a JLabel. Any help is greatly appreciated!

    Hi,
    I got it working, but I also discovered a Java bug that ruins all this effort!
    Calculating the node's position & width:
    - When child nodes are indented, there is an "L" shaped line drawn... the space to the left of the line's vertical bar is the "leftChildIndent", and the space to the right is the "rightChildIndent". So you add both to get the whole indent.
    - I use label.getPreferredSize().width to figure out the node width, since that includes the icon width, the icon-text gap, and the font metrics.
    Example program:
    - This program models how I want it to look... Always expanded and automatic "..." when the scroll pane is not big enough.
    Bug found:
    - There is a runnable example below. Just run it and after a couple seconds, move the split pane to the right.
    - I use a timer to add a new node every 1 second. The new nodes get stuck being too small, and the original nodes don't have this problem.
    // =====================================================
    * Adaptation of TreeDemo to allow for tree nodes that show "..."
    * when there is not enough space to display the whole label.
    import java.awt.Component;
    import java.awt.Dimension;
    import java.awt.GridLayout;
    import java.awt.event.ActionEvent;
    import java.awt.event.ActionListener;
    import javax.swing.JFrame;
    import javax.swing.JLabel;
    import javax.swing.JPanel;
    import javax.swing.JScrollPane;
    import javax.swing.JSplitPane;
    import javax.swing.JTree;
    import javax.swing.Timer;
    import javax.swing.UIManager;
    import javax.swing.event.TreeExpansionEvent;
    import javax.swing.event.TreeWillExpandListener;
    import javax.swing.tree.DefaultMutableTreeNode;
    import javax.swing.tree.DefaultTreeCellRenderer;
    import javax.swing.tree.DefaultTreeModel;
    import javax.swing.tree.ExpandVetoException;
    import javax.swing.tree.TreeCellRenderer;
    import javax.swing.tree.TreeSelectionModel;
    public class TreeDemo extends JPanel {
        private JTree tree;
        protected class EllipsesTreeCellRenderer implements TreeCellRenderer {
            Integer leftIndent = (Integer) UIManager.get("Tree.leftChildIndent");
            Integer rightIndent = (Integer) UIManager.get("Tree.rightChildIndent");
            int indent = leftIndent.intValue() + rightIndent.intValue();
            JLabel label = new JLabel();
            DefaultTreeCellRenderer r = new DefaultTreeCellRenderer();
            public Component getTreeCellRendererComponent(JTree tree, Object value,
                    boolean selected, boolean expanded, boolean leaf, int row,
                    boolean hasFocus) {
                label.setText("why hello there why hello there why hello there");
                if (selected) {
                    label.setForeground(r.getTextSelectionColor());
                    label.setBackground(r.getBackgroundSelectionColor());
                } else {
                    label.setForeground(r.getTextNonSelectionColor());
                    label.setBackground(r.getBackgroundNonSelectionColor());
                if (leaf) {
                    label.setIcon(r.getLeafIcon());
                } else if (expanded) {
                    label.setIcon(r.getOpenIcon());
                } else {
                    label.setIcon(r.getClosedIcon());
                label.setComponentOrientation(tree.getComponentOrientation());
                int labelWidth = label.getPreferredSize().width;
                DefaultMutableTreeNode node = (DefaultMutableTreeNode) value;
                int level = node.getLevel();
                if (!tree.isRootVisible()) {
                    --level;
                int indentWidth = indent * level;
                int rendererWidth = labelWidth + indentWidth;
                // This is zero the first few times getTreeCellRenderer is called
                // because the tree is not yet visible.
                int maxWidth = (int) tree.getVisibleRect().getWidth();
                if (maxWidth > 0) {
                    if (rendererWidth > maxWidth) {
                        // figure out how much space "..." will consume.
                        label.setText(label.getText() + "...");
                        maxWidth = maxWidth
                                - (label.getPreferredSize().width - labelWidth);
                        label.setText(label.getText());
                        // chop off characters until "..." fits in the visible
                        // portion.
                        if (maxWidth > 0) {
                            while (rendererWidth > maxWidth
                                    && label.getText().length() > 1) {
                                label.setText(label.getText().substring(0,
                                        label.getText().length() - 2));
                                rendererWidth = indentWidth
                                        + label.getPreferredSize().width;
                            label.setText(label.getText() + "...");
                return label;
        public TreeDemo() {
            super(new GridLayout(1, 0));
            //Create the nodes.
            final DefaultMutableTreeNode top = new DefaultMutableTreeNode("");
            createNodes(top);
            //Create a tree that allows one selection at a time.
            tree = new JTree(top);
            tree.getSelectionModel().setSelectionMode(
                    TreeSelectionModel.SINGLE_TREE_SELECTION);
            tree.setCellRenderer(new EllipsesTreeCellRenderer());
            tree.addTreeWillExpandListener(new TreeWillExpandListener() {
                public void treeWillExpand(TreeExpansionEvent event) {
                public void treeWillCollapse(TreeExpansionEvent event)
                        throws ExpandVetoException {
                    throw new ExpandVetoException(event);
            for (int i = tree.getRowCount(); i >= 0; i--) {
                tree.expandRow(i);
            //Create the scroll pane and add the tree to it.
            JScrollPane treeView = new JScrollPane(tree);
            //Add the scroll panes to a split pane.
            JSplitPane splitPane = new JSplitPane(JSplitPane.HORIZONTAL_SPLIT);
            splitPane.setTopComponent(treeView);
            splitPane.setBottomComponent(new JLabel(""));
            Dimension minimumSize = new Dimension(0, 0);
            treeView.setMinimumSize(minimumSize);
            splitPane.setDividerLocation(200); //XXX: ignored in some releases
            //of Swing. bug 4101306
            //workaround for bug 4101306:
            //treeView.setPreferredSize(new Dimension(100, 100));
            // Makes tree nodes appear cut-off initially.
            splitPane.setPreferredSize(new Dimension(500, 300));
            //Add the split pane to this panel.
            add(splitPane);
            // Adds a new node every 1 second
            Timer timer = new Timer(1000, new ActionListener() {
                public void actionPerformed(ActionEvent e) {
                    DefaultTreeModel model = (DefaultTreeModel) tree.getModel();
                    DefaultMutableTreeNode child = new DefaultMutableTreeNode("");
                    model.insertNodeInto(child, top, 0);
                    for (int i = tree.getRowCount(); i >= 0; i--) {
                        tree.expandRow(i);
            timer.start();
        private void createNodes(DefaultMutableTreeNode top) {
            DefaultMutableTreeNode category = null;
            DefaultMutableTreeNode book = null;
            category = new DefaultMutableTreeNode("");
            top.add(category);
            category.add(new DefaultMutableTreeNode(""));
            category.add(new DefaultMutableTreeNode(""));
            category.add(new DefaultMutableTreeNode(""));
            category.add(new DefaultMutableTreeNode(""));
            category.add(new DefaultMutableTreeNode(""));
            category.add(new DefaultMutableTreeNode(""));
            category.add(new DefaultMutableTreeNode(""));
            category.add(new DefaultMutableTreeNode(""));
            category.add(new DefaultMutableTreeNode(""));
         * Create the GUI and show it. For thread safety, this method should be
         * invoked from the event-dispatching thread.
        private static void createAndShowGUI() {
            try {
                UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName());
            } catch (Exception e) {
                System.err.println("Couldn't use system look and feel.");
            //Make sure we have nice window decorations.
            JFrame.setDefaultLookAndFeelDecorated(true);
            //Create and set up the window.
            JFrame frame = new JFrame("TreeDemo");
            frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
            //Create and set up the content pane.
            TreeDemo newContentPane = new TreeDemo();
            newContentPane.setOpaque(true); //content panes must be opaque
            frame.setContentPane(newContentPane);
            //Display the window.
            frame.pack();
            frame.setVisible(true);
        public static void main(String[] args) {
            //Schedule a job for the event-dispatching thread:
            //creating and showing this application's GUI.
            javax.swing.SwingUtilities.invokeLater(new Runnable() {
                public void run() {
                    createAndShowGUI();
    }

  • Rendering issues with imported Motion project in FCP

    I have various titles for a DVD prepared in Motion that are imported as project files into Final Cut Pro.
    When playing back the rendered timeline in FCP to a TV, the animation on these titles (scaling and moving of text and untextured, 100% opaque rectangles) looks fine. When I render the timeline to a QuickTime (DV PAL) they still look fine on a monitor, though obviously not a great test on a progressive display.
    After using Compressor (and a suitable preset for PAL content) and burning to a disc from DVD Studio Pro, the animation is jumpy. Some elements in the project with a Fade In/Fade Out behaviour with Fade Out duration set to 0 suddenly disappear for a short period (looks like one frame) - these objects end on the timeline in the same frame that their Fade In/Fade Out behaviour also ends.
    If I render the Motion project to a QuickTime file with transparency and overlay that in FCP then follow the same route through Compressor and DVD Studio Pro everything looks as I expected... smooth motion and no disappearing elements.
    Any ideas? Should I just keep rendering Motion projects out to separate files to overlay in FCP? That seems a bit of a waste of the integration between FCP and Motion.

    This gives me pause: AEManager::scanForPluginsInDirectory(PCString) + 1011
    I'd check for any third party plugins...
    Patrick

  • JTable cell rendering lag

    I've got a JTable for which I wrote a custom CellRenderer that extends JLabel. For each cell, I set the icon for the JLabel that is going to be rendered in the cell. The icon is a gif with some transparent elements. So I set the JLabel to opaque and set the background color so it will show through in the transparent areas. Works like I intended it to, but there's a lag. The table I have has enough rows to scroll well beyond the JScrollPane that it's in. When I scroll down the table, all the cells show up briefly as only the background color, then change quickly to the icon that is in the JLabel. So when I scroll, the entire table seems to be the background color without any icons. When I stop scrolling, the icons fill in pretty quick. But it's disconcerting when scrolling. Once a certain region (set of rows) has been scrolled to once, the problem doesn't happen if you scroll away and then back to that same region.
    Thanks.
    ab.

    I had considered that and eliminated that route through some testing.
    I did sort of figure out what the problem is, but don't yet have a solution. The table I'm rendering has variable height rows. Even rows are one height, odd rows another height. In my custom renderer, I modify the row heights as:
              if (getTable() != null)
                   if (row % 2 == 0)
                        if(CommonStyle.SUMMARY_ROW_HEIGHT != getTable().getRowHeight(row))
                             getTable().setRowHeight(row, CommonStyle.SUMMARY_ROW_HEIGHT);
                   else
                        if(CommonStyle.ARROW_ROW_HEIGHT != getTable().getRowHeight(row))
                             getTable().setRowHeight(row, CommonStyle.ARROW_ROW_HEIGHT);
              }Turns out changing the row heights during the rendering process is what's causing the lag, perhaps there is some table structure changing event that I need to catch and suppress. I've got some optimization code in the cell renderer to no-op the repaint and property change events. I'll let you know what I find.
    Thanks.
    ab.

  • Customizing JList Rendering

    I have an JList and MyCustomCellRenderer extends JCheckBox implements ListCellRenderer.
    When I click on the cell, JCheckBox is not work. I think because the cell is opaque.
    What can we do?

    A renderer just updates the look of the cell. You need an editor. I don't think JList supports editors. It might me easier to change from a JList to a single column JTable and use [url http://developer.java.sun.com/developer/onlineTraining/Programming/JDCBook/swing2.html#edit]this.

  • Opaque Form Region w/o WPF

    Hello,
    I sincerely hope somebody might be able to help me. I've been wracking my meager programming skills on this problem for several weeks now, and I'm quite honestly at the end of my rope.
    Quite simply, I require a portion of a form to be partially opaque. My intent is to layer a RichTextBox that is extended to have a transparent background, over this region of the form. Please see this screenshot:
    I have attempted many different techniques to find the desired effect (the above was rendered using a technique not suitable for production). These attempts have included:
    TransparencyKey - Can only be 100% transparent, and forwards mouse events to the window below. Also, text rendered with anything but DrawString looks terrible due to anti-aliasing against the transparencykey instead of the bit data below. I am not prepared
    to "roll my own" RichTextBox to expose its paint event in order to override font smoothing and hinting.
    WPF - For reasons I won't bore you with, WPF is not an option though I am fully aware that it is my -best- option. I need to find a way to do this in WinForms.
    "Fake" Translucency Using Screenshots - This was the method I used for the screenshot above, taking a screenshot of the desktop, calculating the portion of the screen that corresponds to my RichTextBox dimensions and rendering it in a panel behind.
    Unfortunately, I can not find a way to take a screenshot of the desktop without my form being included in the screenshot, and am forced to hide the form momentarily while the screenshot is generated. This produces a flicker every time the background needs
    to be updated, and I am unwilling to release anything so ugly. The bitblt API will ignore layered windows in a SourceCopy, which was a great way to accomplish this in XP. Unfortunately, desktop composition "fixes" this limitation/feature (however
    you want to look at it). I do not wish to force my users to downgrade their UI in order to make my application look pretty.
    DWM - So many options here, yet none of them work. I've tried using the Glass effect via both DWMExtendFrameIntoClientArea and DWMEnableBlurBehindWindow. I would be happy with settling for the Glass effect. Unfortunately both of these techniques end up relying
    on TransparencyKey again, and the text atop the effected area looks horrendous.
    I've come to the belief that I may be out of luck in terms of "accurate" translucency for this project. As a fallback, I considered simply using a "transparency to wallpaper" effect, which would not include any other windows, just the
    portion of the desktop wallpaper that lies behind my RichTextBox. Again, this came with several frustrating setbacks.
    Wallpaper from File defined in Registry - This works okay, but the disk I/O is a little bothersome. Also, I haven't gotten this to work with anything except a stretched wallpaper image. Centered or Tiled Wallpapers have proven difficult to accurately replicate
    in a way that the borders or seams are accurate.
    DWM Thumbnail of Desktop - I've seen this one suggested a few times, but I can't figure out how to accomplish it. The handle pointed to by GetDesktopWindow doesn't seem to include a graphics context that DWMRegisterThumbnail is able to reference, and I end
    up with a blank screenshot of the correct dimensions. I was able to accomplish it by using an API Spy to grab the Program Manager handle for a quick test, but reliably returning the handle via FindWindow has proven difficult. AFAIK I am only able to reference
    it via the Class Name, and who knows when there might be some random window named "Progman" floating around (spyware especially will pretend to be Progman).
    I know this has been a lengthy post, but I wanted to be very clear about my desired intentions and previous attempts at solving this, just to avoid confusion or regurgitation of ideas.
    If anybody could help me with this, I'll email you a beer.
    Thanks,
    Chris

    Mr Monkeyboy has come up with this possible solution (add a timer and RTB to the form).
    It uses a PictureBox with a RichTextBox, both of which are custom.
    When the Form loads it gets a screenshot of the desktop but the taskbar is not
    included in the image I don't believe. Then it displays the area of the image in
    the PictureBox that the app is currently over on the desktop. And if the app
    moves the image moves making it look like you are seeing through the RichTextBox
    (a control of the PictureBox) and through the PictureBox to the
    desktop.
    Also the PictureBox draws the image then fills a semi
    transparent rectangle over the drawn image for a color offset affect from the
    original desktop image.
    The app then does screen copies constantly and
    gets 5 pixels for comparisons to determine if the desktops image is different.
    Although it probably needs more pixel checking than just 5. Currently pixels at
    10, 10 and screenwidth - 10, 10 and middle screen and 10, screenheight - 10 and
    screenwidth - 10, screenheight - 10 are retrieved to be checked for color
    against previously retrieved colors at those locations. If < 4 colors match
    the form goes opacity zero, screenshots, opacity one and displays the new
    desktop image in the PictureBox.
    So the Form will blink but not often.
    The bad part is on my system the timer interval has to be 5 seconds or
    "checkcolors" trying to be altered are in use and the app crashes. I only tried
    from 50ms to 3000ms before moving to 5000ms where the issue quit. Therefore if
    the desktop alters, like the wallpaper changing, there is a 5 second delay
    before the app blinks and changes the image.
    Option Strict On
    Public Class Form1
    WithEvents RTB1 As New CustomRichTextBox
    Dim Bmp1 As Bitmap
    Dim Bmp2 As Bitmap
    Dim BorderWidth As Integer = 0
    Dim TitleBarHeight As Integer = 0
    Dim LeftToUse As Integer = 0
    Dim TopToUse As Integer = 0
    Dim Bmp1InUse As Boolean = True
    Dim ColorCheck1a As Color
    Dim ColorCheck2a As Color
    Dim ColorCheck3a As Color
    Dim ColorCheck4a As Color
    Dim ColorCheck5a As Color
    Dim ColorCheck1b As Color
    Dim ColorCheck2b As Color
    Dim ColorCheck3b As Color
    Dim ColorCheck4b As Color
    Dim ColorCheck5b As Color
    Dim ColorCheckCounter As Integer = 0
    Private Sub Form1_Load(sender As Object, e As EventArgs) Handles MyBase.Load
    Me.Location = New Point(CInt((Screen.PrimaryScreen.WorkingArea.Width / 2) - (Me.Width / 2)), CInt((Screen.PrimaryScreen.WorkingArea.Height / 2) - (Me.Height / 2)))
    Me.DoubleBuffered = True
    BorderWidth = CInt((Me.Width - Me.ClientRectangle.Width) / 2)
    TitleBarHeight = CInt((Me.Height - Me.ClientRectangle.Height) - BorderWidth)
    Using Bmp As New Bitmap(Screen.PrimaryScreen.Bounds.Width, Screen.PrimaryScreen.Bounds.Height)
    Using g As Graphics = Graphics.FromImage(Bmp)
    g.CopyFromScreen(0, 0, 0, 0, Bmp.Size)
    End Using
    Bmp1 = CType(Bmp.Clone, Bitmap)
    End Using
    ColorCheck1a = Bmp1.GetPixel(10, 10)
    ColorCheck2a = Bmp1.GetPixel(Screen.PrimaryScreen.Bounds.Width - 10, 10)
    ColorCheck3a = Bmp1.GetPixel(CInt(Screen.PrimaryScreen.Bounds.Width / 2), CInt(Screen.PrimaryScreen.Bounds.Height / 2))
    ColorCheck4a = Bmp1.GetPixel(10, Screen.PrimaryScreen.Bounds.Height - 10)
    ColorCheck5a = Bmp1.GetPixel(Screen.PrimaryScreen.Bounds.Width - 10, Screen.PrimaryScreen.Bounds.Height - 10)
    With RTB1
    .Font = New Font("Book Antiqua", 16, FontStyle.Bold)
    .ForeColor = Color.White
    .Left = 0
    .Top = 0
    .Width = PictureBox1.Width
    .Height = PictureBox1.Height
    .ScrollBars = RichTextBoxScrollBars.ForcedVertical
    End With
    PictureBox1.Controls.Add(RTB1)
    LeftToUse = -(Me.Left + PictureBox1.Left + BorderWidth)
    TopToUse = -(Me.Top + PictureBox1.Top + TitleBarHeight)
    PictureBox1.Invalidate()
    Timer1.Interval = 5000
    Timer1.Start()
    End Sub
    Private Sub Form1_Move(sender As Object, e As EventArgs) Handles Me.Move
    LeftToUse = -(Me.Left + PictureBox1.Left + BorderWidth)
    TopToUse = -(Me.Top + PictureBox1.Top + TitleBarHeight)
    PictureBox1.Invalidate()
    RTB1.Invalidate()
    End Sub
    Private Sub PictureBox1_Paint(sender As Object, e As PaintEventArgs) Handles PictureBox1.Paint
    e.Graphics.SmoothingMode = Drawing2D.SmoothingMode.AntiAlias
    If Bmp1InUse Then
    e.Graphics.DrawImage(Bmp1, LeftToUse, TopToUse)
    Using sb As New SolidBrush(Color.FromArgb(100, 0, 0, 0))
    e.Graphics.FillRectangle(sb, 0, 0, PictureBox1.Width, PictureBox1.Height)
    End Using
    Else
    e.Graphics.DrawImage(Bmp2, LeftToUse, TopToUse)
    Using sb As New SolidBrush(Color.FromArgb(100, 0, 0, 0))
    e.Graphics.FillRectangle(sb, 0, 0, PictureBox1.Width, PictureBox1.Height)
    End Using
    End If
    End Sub
    Public Class CustomRichTextBox
    Inherits RichTextBox
    Public Sub New()
    Me.SetStyle(ControlStyles.OptimizedDoubleBuffer, True)
    End Sub
    Protected Overrides ReadOnly Property CreateParams() As CreateParams
    Get
    Dim cp As CreateParams = MyBase.CreateParams
    cp.ExStyle = cp.ExStyle Or &H20
    Return cp
    End Get
    End Property
    End Class
    Dim MyLeft As Integer = 0
    Private Sub Timer1_Tick(sender As Object, e As EventArgs) Handles Timer1.Tick
    ColorCheckCounter = 0
    If Bmp1InUse Then
    Using Bmp As New Bitmap(Screen.PrimaryScreen.Bounds.Width, Screen.PrimaryScreen.Bounds.Height)
    Using g As Graphics = Graphics.FromImage(Bmp)
    g.CopyFromScreen(0, 0, 0, 0, Bmp.Size)
    End Using
    Bmp2 = CType(Bmp.Clone, Bitmap)
    ColorCheck1b = Bmp2.GetPixel(10, 10)
    ColorCheck2b = Bmp2.GetPixel(Screen.PrimaryScreen.Bounds.Width - 10, 10)
    ColorCheck3b = Bmp2.GetPixel(CInt(Screen.PrimaryScreen.Bounds.Width / 2), CInt(Screen.PrimaryScreen.Bounds.Height / 2))
    ColorCheck4b = Bmp2.GetPixel(10, Screen.PrimaryScreen.Bounds.Height - 10)
    ColorCheck5b = Bmp2.GetPixel(Screen.PrimaryScreen.Bounds.Width - 10, Screen.PrimaryScreen.Bounds.Height - 10)
    End Using
    Else
    Using Bmp As New Bitmap(Screen.PrimaryScreen.Bounds.Width, Screen.PrimaryScreen.Bounds.Height)
    Using g As Graphics = Graphics.FromImage(Bmp)
    g.CopyFromScreen(0, 0, 0, 0, Bmp.Size)
    End Using
    Bmp1 = CType(Bmp.Clone, Bitmap)
    ColorCheck1b = Bmp1.GetPixel(10, 10)
    ColorCheck2b = Bmp1.GetPixel(Screen.PrimaryScreen.Bounds.Width - 10, 10)
    ColorCheck3b = Bmp1.GetPixel(CInt(Screen.PrimaryScreen.Bounds.Width / 2), CInt(Screen.PrimaryScreen.Bounds.Height / 2))
    ColorCheck4b = Bmp1.GetPixel(10, Screen.PrimaryScreen.Bounds.Height - 10)
    ColorCheck5b = Bmp1.GetPixel(Screen.PrimaryScreen.Bounds.Width - 10, Screen.PrimaryScreen.Bounds.Height - 10)
    End Using
    End If
    If ColorCheck1a = ColorCheck1b Then ColorCheckCounter += 1
    If ColorCheck2a = ColorCheck2b Then ColorCheckCounter += 1
    If ColorCheck3a = ColorCheck3b Then ColorCheckCounter += 1
    If ColorCheck4a = ColorCheck4b Then ColorCheckCounter += 1
    If ColorCheck5a = ColorCheck5b Then ColorCheckCounter += 1
    If ColorCheckCounter < 4 Then
    ColorCheck1a = ColorCheck1b
    ColorCheck2a = ColorCheck2b
    ColorCheck3a = ColorCheck3b
    ColorCheck4a = ColorCheck4b
    ColorCheck5a = ColorCheck5b
    If Bmp1InUse Then
    Using Bmp As New Bitmap(Screen.PrimaryScreen.Bounds.Width, Screen.PrimaryScreen.Bounds.Height)
    Using g As Graphics = Graphics.FromImage(Bmp)
    Me.Opacity = 0
    g.CopyFromScreen(0, 0, 0, 0, Bmp.Size)
    Me.Opacity = 1
    End Using
    Bmp2 = CType(Bmp.Clone, Bitmap)
    End Using
    Bmp1InUse = False
    PictureBox1.Invalidate()
    RTB1.Invalidate()
    Else
    Using Bmp As New Bitmap(Screen.PrimaryScreen.Bounds.Width, Screen.PrimaryScreen.Bounds.Height)
    Using g As Graphics = Graphics.FromImage(Bmp)
    Me.Opacity = 0
    g.CopyFromScreen(0, 0, 0, 0, Bmp.Size)
    Me.Opacity = 1
    End Using
    Bmp1 = CType(Bmp.Clone, Bitmap)
    End Using
    Bmp1InUse = True
    PictureBox1.Invalidate()
    RTB1.Invalidate()
    End If
    End If
    End Sub
    End Class

Maybe you are looking for

  • Connecting two macs to run programs

    Hello, I've posted elsewhere but was redirected here. This is a very open ended question about connecting my Mac (Main) to another one (White). I use open source software such as R, currently on my Macbook. However, my programs are time consuming, so

  • Suggest podcast to a friend

    I want to be able to suggest a podcast to a friend (email). This should be a feature on the iTunes store.

  • Query/Report to list collections in a Folder

    does anyone have a query / report that lists the collections contained in a folder? I've found powershell scripts for this but they're not translating over with the same logic as a query. Thanks. Jason

  • Source distribution with FPGA support

    I am trying to deploy a series of VIs which interact with FPGAs (PXIe-7966 based).  When I run my RT vi's in development mode, the automatic deployment includes many vis such as: Deploying niLvFpgaWhatHappensToTopLevelVI.ctl(already deployed) Deployi

  • MaIl DoEs NoT GeT IMAGES

    since the update, my gmail messages I receive to the native mail account are not displaying the embedded images even after I press "get images". I work in communications and send/receive a lot of these emarketing type of messages so I'd like to know