source: other-projects/trunk/gs3-release-maker/tasks/sshtaskdef/src/mindbright/vnc/animatedMemoryImageSource.java@ 14627

Last change on this file since 14627 was 14627, checked in by oranfry, 17 years ago

initial import of the gs3-release-maker

File size: 2.0 KB
Line 
1//
2// Copyright (C) 1997, 1998 Olivetti & Oracle Research Laboratory
3//
4// This is free software; you can redistribute it and/or modify
5// it under the terms of the GNU General Public License as published by
6// the Free Software Foundation; either version 2 of the License, or
7// (at your option) any later version.
8//
9// This software is distributed in the hope that it will be useful,
10// but WITHOUT ANY WARRANTY; without even the implied warranty of
11// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12// GNU General Public License for more details.
13//
14// You should have received a copy of the GNU General Public License
15// along with this software; if not, write to the Free Software
16// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307,
17// USA.
18//
19
20//
21// animatedMemoryImageSource.java
22//
23package mindbright.vnc;
24
25import java.awt.image.*;
26
27class animatedMemoryImageSource implements ImageProducer {
28 int width;
29 int height;
30 ColorModel cm;
31 byte[] pixels;
32 ImageConsumer ic;
33
34 animatedMemoryImageSource(int w, int h, ColorModel c, byte[] p) {
35 width = w;
36 height = h;
37 cm = c;
38 pixels = p;
39 }
40
41 public void addConsumer(ImageConsumer c) {
42 if (ic == c)
43 return;
44
45 if (ic != null) {
46 ic.imageComplete(ImageConsumer.IMAGEERROR);
47 }
48
49 ic = c;
50 ic.setDimensions(width, height);
51 ic.setColorModel(cm);
52 ic.setHints(ImageConsumer.RANDOMPIXELORDER);
53 ic.setPixels(0, 0, width, height, cm, pixels, 0, width);
54 ic.imageComplete(ImageConsumer.SINGLEFRAMEDONE);
55 }
56
57 public boolean isConsumer(ImageConsumer c) {
58 return (ic == c);
59 }
60
61 public void removeConsumer(ImageConsumer c) {
62 if (ic == c)
63 ic = null;
64 }
65
66 public void requestTopDownLeftRightResend(ImageConsumer c) {
67 }
68
69 public void startProduction(ImageConsumer c) {
70 addConsumer(c);
71 }
72
73 void newPixels(int x, int y, int w, int h) {
74 if (ic != null) {
75 ic.setPixels(x, y, w, h, cm, pixels, width * y + x, width);
76 ic.imageComplete(ImageConsumer.SINGLEFRAMEDONE);
77 }
78 }
79}
Note: See TracBrowser for help on using the repository browser.