From: enikey Date: Fri, 19 Dec 2008 07:54:40 +0000 (+0000) Subject: [Layout] Added base Tight data decoder class (TightDecoder). X-Git-Tag: v0.0.90~253 X-Git-Url: https://source.dussan.org/?a=commitdiff_plain;h=f7160bdb39a385925564bb7862e92698eb7059bc;p=tigervnc.git [Layout] Added base Tight data decoder class (TightDecoder). git-svn-id: svn://svn.code.sf.net/p/tigervnc/code/trunk@3431 3789f03b-4d11-0410-bbf8-ca57d06f2519 --- diff --git a/java/src/com/tightvnc/decoder/TightDecoder.java b/java/src/com/tightvnc/decoder/TightDecoder.java new file mode 100644 index 00000000..94a82d38 --- /dev/null +++ b/java/src/com/tightvnc/decoder/TightDecoder.java @@ -0,0 +1,79 @@ +package com.tightvnc.decoder; + +import com.tightvnc.decoder.common.Repaintable; +import com.tightvnc.vncviewer.RfbInputStream; +import java.awt.Graphics; +import java.awt.Color; +import java.awt.Image; +import java.awt.Rectangle; +import java.awt.Toolkit; +import java.awt.image.ImageObserver; +import java.util.zip.Inflater; + +// +// Class that used for decoding Tight encoded data. +// + +public class TightDecoder extends RawDecoder { + + // + // Tight decoder constants + // + + final static int TightExplicitFilter = 0x04; + final static int TightFill = 0x08; + final static int TightJpeg = 0x09; + final static int TightMaxSubencoding = 0x09; + final static int TightFilterCopy = 0x00; + final static int TightFilterPalette = 0x01; + final static int TightFilterGradient = 0x02; + final static int TightMinToCompress = 12; + + // Tight encoder's data. + final static int tightZlibBufferSize = 512; + + public TightDecoder(Graphics g, RfbInputStream is) { + super(g, is); + tightInflaters = new Inflater[4]; + } + + public TightDecoder(Graphics g, RfbInputStream is, int frameBufferW, + int frameBufferH) { + super(g, is, frameBufferW, frameBufferH); + tightInflaters = new Inflater[4]; + } + + // + // Set and get methods for private TightDecoder + // + + public void setRepainableControl(Repaintable r) { + repainatableControl = r; + } + + // + // JPEG processing statistic methods + // + + public int getNumJPEGRects() { + return statNumRectsTightJPEG; + } + + public void setNumJPEGRects(int v) { + statNumRectsTightJPEG = v; + } + + // + // Private members + // + + private Inflater[] tightInflaters; + // Since JPEG images are loaded asynchronously, we have to remember + // their position in the framebuffer. Also, this jpegRect object is + // used for synchronization between the rfbThread and a JVM's thread + // which decodes and loads JPEG images. + private Rectangle jpegRect; + private Repaintable repainatableControl = null; + // Jpeg decoding statistics + private int statNumRectsTightJPEG = 0; +}