01: ///////////////////////////////////////////////////////////////////////////////
02: //
03: // This program is free software; you can redistribute it and/or modify
04: // it under the terms of the GNU General Public License and GNU Library
05: // General Public License as published by the Free Software Foundation;
06: // either version 2, or (at your option) any later version.
07: //
08: // This program is distributed in the hope that it will be useful,
09: // but WITHOUT ANY WARRANTY; without even the implied warranty of
10: // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11: // GNU General Public License and GNU Library General Public License
12: // for more details.
13: //
14: // You should have received a copy of the GNU General Public License
15: // and GNU Library General Public License along with this program; if
16: // not, write to the Free Software Foundation, 675 Mass Ave, Cambridge,
17: // MA 02139, USA.
18: //
19: //////////////////////////////////////////////////////////////////////////////
20:
21: package org.rdesktop.server.rdp.rdp5.cliprdr;
22:
23: import java.io.*;
24: import java.awt.Image;
25:
26: import org.rdesktop.server.rdp.RdpPacket;
27:
28: public class BMPToImageThread extends Thread {
29: private RdpPacket m_data;
30: private int m_length;
31: private ClipInterface m_clip;
32:
33: public BMPToImageThread(RdpPacket data, int length,
34: ClipInterface clip) {
35: super ();
36: m_data = data;
37: m_length = length;
38: m_clip = clip;
39: }
40:
41: public void run() {
42: String thingy = "";
43: OutputStream out = null;
44:
45: int origin = m_data.getPosition();
46: int head_len = m_data.getLittleEndian32();
47:
48: m_data.setPosition(origin);
49:
50: byte[] content = new byte[m_length];
51:
52: for (int i = 0; i < m_length; i++) {
53: content[i] = (byte) (m_data.get8() & 0xFF);
54: }
55:
56: Image img = ClipBMP
57: .loadbitmap(new ByteArrayInputStream(content));
58: ImageSelection imageSelection = new ImageSelection(img);
59: m_clip.copyToClipboard(imageSelection);
60: }
61: }
|