Package org.eclipse.ecf.ui.screencapture

Source Code of org.eclipse.ecf.ui.screencapture.ImageWrapper

/*******************************************************************************
* 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.ui.screencapture;

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);
  }
}
TOP

Related Classes of org.eclipse.ecf.ui.screencapture.ImageWrapper

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.