--- /dev/null
+/*******************************************************************************\r
+ * Copyright (c) 2007, 2010 Association for Decentralized Information Management\r
+ * in Industry THTH ry.\r
+ * All rights reserved. This program and the accompanying materials\r
+ * are made available under the terms of the Eclipse Public License v1.0\r
+ * which accompanies this distribution, and is available at\r
+ * http://www.eclipse.org/legal/epl-v10.html\r
+ *\r
+ * Contributors:\r
+ * VTT Technical Research Centre of Finland - initial API and implementation\r
+ *******************************************************************************/\r
+package org.simantics.utils.ui.gfx.clipboard.headers;\r
+\r
+import java.nio.ByteBuffer;\r
+import java.nio.ByteOrder;\r
+\r
+\r
+/**\r
+ * WIN32 API BITMAPINFOHEADER\r
+ * \r
+ * @see http://msdn.microsoft.com/library/default.asp?url=/library/en-us/gdi/bitmaps_1rw2.asp\r
+ * @see org.eclipse.swt.internal.win32.BITMAPINFOHEADER\r
+ * @author Marko Luukkainen\r
+ *\r
+ */\r
+@SuppressWarnings("restriction")\r
+public class BitmapInfoHeader {\r
+ public int biSize;\r
+ public int biWidth;\r
+ public int biHeight;\r
+ public short biPlanes;\r
+ public short biBitCount;\r
+ public int biCompression;\r
+ public int biSizeImage;\r
+ public int biXPelsPerMeter;\r
+ public int biYPelsPerMeter;\r
+ public int biClrUsed;\r
+ public int biClrImportant;\r
+ public static final int sizeof = 40; \r
+ \r
+ public byte[] getBytes() {\r
+ byte [] array = new byte[sizeof];\r
+ ByteBuffer buffer = ByteBuffer.wrap(array);\r
+ buffer.order(ByteOrder.LITTLE_ENDIAN);\r
+ buffer.putInt(biSize);\r
+ buffer.putInt(biWidth);\r
+ buffer.putInt(biHeight);\r
+ buffer.putShort(biPlanes);\r
+ buffer.putShort(biBitCount);\r
+ buffer.putInt(biCompression);\r
+ buffer.putInt(biSizeImage);\r
+ buffer.putInt(biXPelsPerMeter);\r
+ buffer.putInt(biYPelsPerMeter);\r
+ buffer.putInt(biClrUsed);\r
+ buffer.putInt(biClrImportant); \r
+ return array;\r
+ }\r
+ \r
+ public void setBytes(byte[] array) {\r
+ ByteBuffer buffer = ByteBuffer.wrap(array);\r
+ buffer.order(ByteOrder.LITTLE_ENDIAN);\r
+ biSize = buffer.getInt();\r
+ biWidth = buffer.getInt();\r
+ biHeight = buffer.getInt();\r
+ biPlanes = buffer.getShort();\r
+ biBitCount = buffer.getShort();\r
+ biCompression = buffer.getInt();\r
+ biSizeImage = buffer.getInt();\r
+ biXPelsPerMeter = buffer.getInt();\r
+ biYPelsPerMeter = buffer.getInt();\r
+ biClrUsed = buffer.getInt();\r
+ biClrImportant = buffer.getInt();\r
+ }\r
+ \r
+}\r