01: /**
02: * Caption: Zaval Java Resource Editor
03: * $Revision: 0.37 $
04: * $Date: 2002/03/28 9:24:42 $
05: *
06: * @author: Victor Krapivin
07: * @version: 1.3
08: *
09: * Zaval JRC Editor is a visual editor which allows you to manipulate
10: * localization strings for all Java based software with appropriate
11: * support embedded.
12: *
13: * For more info on this product read Zaval Java Resource Editor User's Guide
14: * (It comes within this package).
15: * The latest product version is always available from the product's homepage:
16: * http://www.zaval.org/products/jrc-editor/
17: * and from the SourceForge:
18: * http://sourceforge.net/projects/zaval0002/
19: *
20: * Contacts:
21: * Support : support@zaval.org
22: * Change Requests : change-request@zaval.org
23: * Feedback : feedback@zaval.org
24: * Other : info@zaval.org
25: *
26: * Copyright (C) 2001-2002 Zaval Creative Engineering Group (http://www.zaval.org)
27: *
28: * This program is free software; you can redistribute it and/or
29: * modify it under the terms of the GNU General Public License
30: * (version 2) as published by the Free Software Foundation.
31: *
32: * This program is distributed in the hope that it will be useful,
33: * but WITHOUT ANY WARRANTY; without even the implied warranty of
34: * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
35: * GNU General Public License for more details.
36: *
37: * You should have received a copy of the GNU General Public License
38: * along with this program; if not, write to the Free Software
39: * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
40: *
41: */package org.zaval.awt.image;
42:
43: import java.io.*;
44: import java.awt.image.*;
45:
46: // BMP Header, Win3.1 and on ( version 3 BMP )
47: // BMP Information header
48:
49: class BMP_Info_Header {
50: public int HeaderSize;
51: public int Width;
52: public int Height;
53: public short NumOfPlanes; // Must be 1
54: public short BitsPerPixel; // 1,4,8,16,24
55: public int CompressionMethod; // COMPRESS_XXX
56: public int BitmapSize; // Size of Bitmap
57: public int HorizRes; // Pixel per Meter
58: public int VertRes; // Pixel per Meter
59: public int NumOfColors; // How many colors needed
60: public int SiginificantColors; // How many colors important
61:
62: public int readBytes = 0;
63:
64: public BMP_Info_Header(int w, int h, int bpp, int cn) {
65: Width = w;
66: Height = h;
67: BitsPerPixel = (short) bpp;
68: NumOfColors = cn;
69: }
70:
71: public BMP_Info_Header(BMP_InputStream in) throws IOException {
72: HeaderSize = in.readInt();
73: Width = in.readInt();
74: Height = in.readInt();
75: NumOfPlanes = in.readShort();
76: if (NumOfPlanes != 1)
77: throw new IllegalArgumentException("NumOfPlanes not 1"
78: + NumOfPlanes);
79:
80: BitsPerPixel = in.readShort();
81: if (BitsPerPixel != 24 && BitsPerPixel != 16
82: && BitsPerPixel != 8 && BitsPerPixel != 4
83: && BitsPerPixel != 1)
84: throw new IllegalArgumentException("Illegal BitsPerPixel "
85: + BitsPerPixel);
86:
87: CompressionMethod = in.readInt();
88: if (CompressionMethod < 0
89: || CompressionMethod > BMP_Header.COMPRESS_RLE4)
90: throw new IllegalArgumentException(
91: "Illegal CompressionMethod " + CompressionMethod);
92: BitmapSize = in.readInt();
93: HorizRes = in.readInt();
94: VertRes = in.readInt();
95: NumOfColors = in.readInt();
96: SiginificantColors = in.readInt();
97: readBytes = 40;
98: }
99: }
|