Skip to main content
summaryrefslogtreecommitdiffstats
blob: 10ce31792587fec72512ff0d71fd4017c1846395 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
/*******************************************************************************
 * Copyright (c) 2004, 2007 Remy Suen, Composent, Inc., and others.
 * All rights reserved. This program and the accompanying materials
 * are made available under the terms of the Eclipse Public License v1.0
 * which accompanies this distribution, and is available at
 * http://www.eclipse.org/legal/epl-v10.html
 *
 * Contributors:
 *    Remy Suen <remy.suen@gmail.com> - initial API and implementation
 ******************************************************************************/
package org.eclipse.ecf.internal.example.collab.ui;

import java.io.Serializable;

import org.eclipse.swt.graphics.ImageData;
import org.eclipse.swt.graphics.PaletteData;

public class ImageWrapper implements Serializable {

	private static final long serialVersionUID = -834839369167998998L;

	public final int width;
	public final int height;
	public final int depth;
	public final int scanlinePad;

	private final int redMask;
	private final int greenMask;
	private final int blueMask;

	public ImageWrapper(ImageData data) {
		width = data.width;
		height = data.height;
		depth = data.depth;
		scanlinePad = data.scanlinePad;
		redMask = data.palette.redMask;
		greenMask = data.palette.greenMask;
		blueMask = data.palette.blueMask;
	}

	public ImageData createImageData(byte[] data) {
		final PaletteData palette = new PaletteData(redMask, greenMask, blueMask);
		return new ImageData(width, height, depth, palette, scanlinePad, data);
	}
}

Back to the top