1 | /* |
2 | * $Id: BITMAP.java,v 1.6 2005/10/28 18:53:53 hastings Exp $ |
3 | * |
4 | * (c) Copyright, Moebius Solutions, Inc., 2004 |
5 | * |
6 | * All Rights Reserved |
7 | * |
8 | * This material may be reproduced by or for the U. S. Government |
9 | * pursuant to the copyright license under the clause at |
10 | * DFARS 252.227-7014 (OCT 2001). |
11 | */ |
12 | package com.moesol.bindings.platform_sdk.windows_api; |
13 | |
14 | import java.nio.ByteBuffer; |
15 | import com.moesol.bindings.NativeStructure; |
16 | |
17 | public class BITMAP extends NativeStructure { |
18 | private ByteBuffer m_bits; |
19 | |
20 | public BITMAP() { |
21 | super( new byte[sizeof()] ); |
22 | } |
23 | public BITMAP(ByteBuffer bb) { |
24 | super( bb ); |
25 | } |
26 | public static int sizeof() { |
27 | return 24; |
28 | } |
29 | public void set_bmType(int v) { |
30 | putInt(0, v); |
31 | } |
32 | public int get_bmType() { |
33 | return getInt(0); |
34 | } |
35 | public void set_bmWidth(int v) { |
36 | putInt(4, v); |
37 | } |
38 | public int get_bmWidth() { |
39 | return getInt(4); |
40 | } |
41 | public void set_bmHeight(int v) { |
42 | putInt(8, v); |
43 | } |
44 | public int get_bmHeight() { |
45 | return getInt(8); |
46 | } |
47 | public void set_bmWidthBytes(int v) { |
48 | putInt(12, v); |
49 | } |
50 | public int get_bmWidthBytes() { |
51 | return getInt(12); |
52 | } |
53 | public void set_bmPlanes(short v) { |
54 | putShort(16, v); |
55 | } |
56 | public short get_bmPlanes() { |
57 | return getShort(16); |
58 | } |
59 | public void set_bmBitsPixel(short v) { |
60 | putShort(18, v); |
61 | } |
62 | public short get_bmBitsPixel() { |
63 | return getShort(18); |
64 | } |
65 | public void set_bmBits(ByteBuffer v) { |
66 | m_bits = v; |
67 | } |
68 | public ByteBuffer get_bmBits() { |
69 | return m_bits; |
70 | } |
71 | |
72 | public boolean equals(Object o) { |
73 | if (!(o instanceof BITMAP)) { |
74 | return false; |
75 | } |
76 | BITMAP bm = (BITMAP) o; |
77 | return (super.equals(o) && m_bits.equals(bm.get_bmBits())); |
78 | } |
79 | |
80 | public int hashCode() { |
81 | int hash = super.hashCode(); |
82 | if (m_bits == null) { |
83 | return hash; |
84 | } |
85 | hash = hash * 31 + m_bits.hashCode(); |
86 | return hash; |
87 | } |
88 | } |