-/*******************************************************************************\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
+/*******************************************************************************
+ * Copyright (c) 2007, 2010 Association for Decentralized Information Management
+ * in Industry THTH ry.
+ * 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:
+ * VTT Technical Research Centre of Finland - initial API and implementation
+ *******************************************************************************/
+package org.simantics.utils.ui.gfx.clipboard.headers;
+
+import java.nio.ByteBuffer;
+import java.nio.ByteOrder;
+
+
+/**
+ * WIN32 API BITMAPINFOHEADER
+ *
+ * @see http://msdn.microsoft.com/library/default.asp?url=/library/en-us/gdi/bitmaps_1rw2.asp
+ * @see org.eclipse.swt.internal.win32.BITMAPINFOHEADER
+ * @author Marko Luukkainen
+ *
+ */
+@SuppressWarnings("restriction")
+public class BitmapInfoHeader {
+ public int biSize;
+ public int biWidth;
+ public int biHeight;
+ public short biPlanes;
+ public short biBitCount;
+ public int biCompression;
+ public int biSizeImage;
+ public int biXPelsPerMeter;
+ public int biYPelsPerMeter;
+ public int biClrUsed;
+ public int biClrImportant;
+ public static final int sizeof = 40;
+
+ public byte[] getBytes() {
+ byte [] array = new byte[sizeof];
+ ByteBuffer buffer = ByteBuffer.wrap(array);
+ buffer.order(ByteOrder.LITTLE_ENDIAN);
+ buffer.putInt(biSize);
+ buffer.putInt(biWidth);
+ buffer.putInt(biHeight);
+ buffer.putShort(biPlanes);
+ buffer.putShort(biBitCount);
+ buffer.putInt(biCompression);
+ buffer.putInt(biSizeImage);
+ buffer.putInt(biXPelsPerMeter);
+ buffer.putInt(biYPelsPerMeter);
+ buffer.putInt(biClrUsed);
+ buffer.putInt(biClrImportant);
+ return array;
+ }
+
+ public void setBytes(byte[] array) {
+ ByteBuffer buffer = ByteBuffer.wrap(array);
+ buffer.order(ByteOrder.LITTLE_ENDIAN);
+ biSize = buffer.getInt();
+ biWidth = buffer.getInt();
+ biHeight = buffer.getInt();
+ biPlanes = buffer.getShort();
+ biBitCount = buffer.getShort();
+ biCompression = buffer.getInt();
+ biSizeImage = buffer.getInt();
+ biXPelsPerMeter = buffer.getInt();
+ biYPelsPerMeter = buffer.getInt();
+ biClrUsed = buffer.getInt();
+ biClrImportant = buffer.getInt();
+ }
+
+}