enikey | 00e0dbf | 2008-12-08 10:59:59 +0000 | [diff] [blame] | 1 | package com.tightvnc.decoder; |
| 2 | |
enikey | 2f811b8 | 2008-12-19 04:45:15 +0000 | [diff] [blame^] | 3 | import com.tightvnc.vncviewer.RecordInterface; |
| 4 | import com.tightvnc.vncviewer.RfbInputStream; |
| 5 | import java.awt.Graphics; |
| 6 | import java.awt.Image; |
| 7 | import java.awt.image.ColorModel; |
| 8 | import java.awt.image.DirectColorModel; |
| 9 | import java.awt.image.MemoryImageSource; |
| 10 | import java.awt.Color; |
| 11 | |
enikey | 00e0dbf | 2008-12-08 10:59:59 +0000 | [diff] [blame] | 12 | public class RawDecoder { |
| 13 | |
enikey | 2f811b8 | 2008-12-19 04:45:15 +0000 | [diff] [blame^] | 14 | public RawDecoder(Graphics g, RfbInputStream is) { |
| 15 | setGraphics(g); |
| 16 | setRfbInputStream(is); |
| 17 | cm24 = new DirectColorModel(24, 0xFF0000, 0x00FF00, 0x0000FF); |
| 18 | } |
| 19 | |
| 20 | public RawDecoder(Graphics g, RfbInputStream is, int frameBufferW, |
| 21 | int frameBufferH) { |
| 22 | setGraphics(g); |
| 23 | setRfbInputStream(is); |
| 24 | setFrameBufferSize(frameBufferW, frameBufferH); |
| 25 | cm24 = new DirectColorModel(24, 0xFF0000, 0x00FF00, 0x0000FF); |
| 26 | } |
| 27 | |
| 28 | public void setRfbInputStream(RfbInputStream is) { |
| 29 | rfbis = is; |
| 30 | } |
| 31 | |
| 32 | public void setGraphics(Graphics g) { |
| 33 | graphics = g; |
| 34 | } |
| 35 | |
| 36 | public void setBPP(int bpp) { |
| 37 | bytesPerPixel = bpp; |
| 38 | } |
| 39 | |
| 40 | public int getBPP() { |
| 41 | return bytesPerPixel; |
| 42 | } |
| 43 | |
| 44 | public void setFrameBufferSize(int w, int h) { |
| 45 | framebufferWidth = w; |
| 46 | framebufferHeight = h; |
| 47 | } |
| 48 | |
| 49 | protected int bytesPerPixel = 4; |
| 50 | protected int framebufferWidth = 0; |
| 51 | protected int framebufferHeight = 0; |
| 52 | protected RfbInputStream rfbis = null; |
| 53 | protected Graphics graphics = null; |
| 54 | protected RecordInterface rec = null; |
| 55 | |
| 56 | protected static byte []pixels8 = null; |
| 57 | protected static int []pixels24 = null; |
| 58 | protected static MemoryImageSource pixelsSource = null; |
| 59 | protected static Image rawPixelsImage = null; |
| 60 | |
| 61 | private static ColorModel cm8 = null; |
| 62 | private static ColorModel cm24 = null; |
| 63 | private static Color []color256 = null; |
enikey | 00e0dbf | 2008-12-08 10:59:59 +0000 | [diff] [blame] | 64 | } |