blob: 46d22f7f89cdeddda03bb66e7d2bddc86c03e4d7 [file] [log] [blame]
enikey00e0dbf2008-12-08 10:59:59 +00001package com.tightvnc.decoder;
2
enikey2f811b82008-12-19 04:45:15 +00003import com.tightvnc.vncviewer.RecordInterface;
4import com.tightvnc.vncviewer.RfbInputStream;
5import java.awt.Graphics;
6import java.awt.Image;
7import java.awt.image.ColorModel;
8import java.awt.image.DirectColorModel;
9import java.awt.image.MemoryImageSource;
10import java.awt.Color;
11
enikey00e0dbf2008-12-08 10:59:59 +000012public class RawDecoder {
13
enikey2f811b82008-12-19 04:45:15 +000014 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;
enikey00e0dbf2008-12-08 10:59:59 +000064}