Class JPanelMousePlotter.RecordMouse

  • All Implemented Interfaces:
    java.lang.Runnable
    Enclosing class:
    JPanelMousePlotter

    class JPanelMousePlotter.RecordMouse
    extends java.lang.Thread
    Thread that records screen capture. Must be a thread so that when taking screen captures at intervals, will know if it's an original image or not. The original flag is set by transformChanged, which listens for transform events from the canvas.
    • Nested Class Summary

      • Nested classes/interfaces inherited from class java.lang.Thread

        java.lang.Thread.State, java.lang.Thread.UncaughtExceptionHandler
    • Field Summary

      Fields 
      Modifier and Type Field Description
      (package private) FileAvi aviFile
      DOCUMENT ME!
      (package private) int blank
      DOCUMENT ME!
      (package private) short[] buffer
      DOCUMENT ME!
      (package private) boolean cancelPressed
      DOCUMENT ME!
      (package private) int compression
      DOCUMENT ME!
      (package private) int data
      DOCUMENT ME!
      (package private) int[] extents
      DOCUMENT ME!
      (package private) ModelImage image
      DOCUMENT ME!
      (package private) java.awt.Image imagePix
      DOCUMENT ME!
      (package private) int interval
      DOCUMENT ME!
      (package private) javax.media.j3d.ImageComponent2D javaImage
      DOCUMENT ME!
      (package private) int[] pixels
      DOCUMENT ME!
      (package private) ViewJProgressBar progress
      DOCUMENT ME!
      (package private) javax.media.j3d.Raster raster
      DOCUMENT ME!
      (package private) boolean set
      DOCUMENT ME!
      (package private) int xDim
      DOCUMENT ME!
      (package private) int xScale
      DOCUMENT ME!
      (package private) int yDim
      DOCUMENT ME!
      (package private) int yScale
      DOCUMENT ME!
      (package private) int zDim
      DOCUMENT ME!
      • Fields inherited from class java.lang.Thread

        MAX_PRIORITY, MIN_PRIORITY, NORM_PRIORITY
    • Constructor Summary

      Constructors 
      Constructor Description
      RecordMouse​(int subSample, double frameRate, FileAvi aviFile)
      Constructor that sets up the variables needed for the screen capture and allocates the buffers appropriately.
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      private void captureScreen()
      Captures the canvas.
      void disposeLocal()
      Dispose memory.
      void run()
      Runs the mouse recorder.
      • Methods inherited from class java.lang.Thread

        activeCount, checkAccess, clone, countStackFrames, currentThread, dumpStack, enumerate, getAllStackTraces, getContextClassLoader, getDefaultUncaughtExceptionHandler, getId, getName, getPriority, getStackTrace, getState, getThreadGroup, getUncaughtExceptionHandler, holdsLock, interrupt, interrupted, isAlive, isDaemon, isInterrupted, join, join, join, onSpinWait, resume, setContextClassLoader, setDaemon, setDefaultUncaughtExceptionHandler, setName, setPriority, setUncaughtExceptionHandler, sleep, sleep, start, stop, suspend, toString, yield
      • Methods inherited from class java.lang.Object

        equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
    • Field Detail

      • aviFile

        FileAvi aviFile
        DOCUMENT ME!
      • blank

        int blank
        DOCUMENT ME!
      • buffer

        short[] buffer
        DOCUMENT ME!
      • cancelPressed

        boolean cancelPressed
        DOCUMENT ME!
      • compression

        int compression
        DOCUMENT ME!
      • data

        int data
        DOCUMENT ME!
      • extents

        int[] extents
        DOCUMENT ME!
      • imagePix

        java.awt.Image imagePix
        DOCUMENT ME!
      • interval

        int interval
        DOCUMENT ME!
      • javaImage

        javax.media.j3d.ImageComponent2D javaImage
        DOCUMENT ME!
      • pixels

        int[] pixels
        DOCUMENT ME!
      • raster

        javax.media.j3d.Raster raster
        DOCUMENT ME!
      • set

        boolean set
        DOCUMENT ME!
      • xDim

        int xDim
        DOCUMENT ME!
      • xScale

        int xScale
        DOCUMENT ME!
      • yDim

        int yDim
        DOCUMENT ME!
      • yScale

        int yScale
        DOCUMENT ME!
      • zDim

        int zDim
        DOCUMENT ME!
    • Constructor Detail

      • RecordMouse

        public RecordMouse​(int subSample,
                           double frameRate,
                           FileAvi aviFile)
        Constructor that sets up the variables needed for the screen capture and allocates the buffers appropriately.
        Parameters:
        subSample - Subsample size; determines if we need to scale the image captured.
        frameRate - Frame rate. Determines how often we capture the images.
        aviFile - AVI file to write to.
    • Method Detail

      • disposeLocal

        public void disposeLocal()
        Dispose memory.
      • run

        public void run()
        Runs the mouse recorder. Waits for the determined interval (based on frame rate) and then checks to see if this is an original image. The original flag is set by the transformChanged function, which listens for changes in the transform from the canvas. If the transform has changed, then original is set to true, and this method knows about it because it's in a separate thread. Instead of capturing the screen on the play, this method keeps track of the transform. This is because capturing the screen would take too long and the frame rate would no longer be accurate. Then once the playing is done, this method goes through all the transforms and captures the screen or sends a blank frame.
        Specified by:
        run in interface java.lang.Runnable
        Overrides:
        run in class java.lang.Thread
      • captureScreen

        private void captureScreen()
                            throws java.io.IOException
        Captures the canvas. Saves it as an RGB image and sends it to the file avi writer.
        Throws:
        java.io.IOException - DOCUMENT ME!