• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * Copyright (C) 2008 The Android Open Source Project
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License");
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  *      http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  */
16 
17 #ifndef bim_UINT32_IMAGE_EM_H
18 #define bim_UINT32_IMAGE_EM_H
19 
20 /* ---- includes ----------------------------------------------------------- */
21 
22 #include "b_BasicEm/Context.h"
23 #include "b_BasicEm/UInt32Arr.h"
24 
25 /* ---- related objects  --------------------------------------------------- */
26 
27 /* ---- typedefs ----------------------------------------------------------- */
28 
29 /* ---- constants ---------------------------------------------------------- */
30 
31 /* data format version number */
32 #define bim_UINT32_IMAGE_VERSION 100
33 
34 /* ---- object definition -------------------------------------------------- */
35 
36 /** image of uint32 */
37 struct bim_UInt32Image
38 {
39 
40 	/* ---- private data --------------------------------------------------- */
41 
42 	/* ---- public data ---------------------------------------------------- */
43 
44 	/** width of image */
45 	uint32 widthE;
46 
47 	/** height of image */
48 	uint32 heightE;
49 
50 	/** array of bytes */
51 	struct bbs_UInt32Arr arrE;
52 };
53 
54 /* ---- associated objects ------------------------------------------------- */
55 
56 /* ---- external functions ------------------------------------------------- */
57 
58 /* ---- \ghd{ constructor/destructor } ------------------------------------- */
59 
60 /** initializes bim_UInt32Image  */
61 void bim_UInt32Image_init( struct bbs_Context* cpA,
62 						   struct bim_UInt32Image* ptrA );
63 
64 /** destroys bim_UInt32Image  */
65 void bim_UInt32Image_exit( struct bbs_Context* cpA,
66 						   struct bim_UInt32Image* ptrA );
67 
68 /* ---- \ghd{ operators } -------------------------------------------------- */
69 
70 /** copy operator */
71 void bim_UInt32Image_copy( struct bbs_Context* cpA,
72 						   struct bim_UInt32Image* ptrA,
73 						   const struct bim_UInt32Image* srcPtrA );
74 
75 /** equal operator */
76 flag bim_UInt32Image_equal( struct bbs_Context* cpA,
77 						    const struct bim_UInt32Image* ptrA,
78 							const struct bim_UInt32Image* srcPtrA );
79 
80 /* ---- \ghd{ query functions } -------------------------------------------- */
81 
82 /** calculates the amount of heap memory needed (16bit words) if created with given parameters */
83 uint32 bim_UInt32Image_heapSize( struct bbs_Context* cpA,
84 								 const struct bim_UInt32Image* ptrA,
85 								 uint32 widthA,
86 								 uint32 heightA );
87 
88 /** checksum of image (for debugging purposes) */
89 uint32 bim_UInt32Image_checkSum( struct bbs_Context* cpA,
90 								 const struct bim_UInt32Image* ptrA );
91 
92 /* ---- \ghd{ modify functions } ------------------------------------------- */
93 
94 /** allocates memory for bim_UInt32Image */
95 void bim_UInt32Image_create( struct bbs_Context* cpA,
96 							 struct bim_UInt32Image* ptrA,
97 						    uint32 widthA,
98 							uint32 heightA,
99  					        struct bbs_MemSeg* mspA );
100 
101 /** assigns external image to array (no allocation, deallocation or copying of data) */
102 void bim_UInt32Image_assignExternalImage( struct bbs_Context* cpA,
103 										  struct bim_UInt32Image* ptrA,
104 										  struct bim_UInt32Image* srcPtrA );
105 
106 /** sets image size */
107 void bim_UInt32Image_size( struct bbs_Context* cpA,
108 						   struct bim_UInt32Image* ptrA,
109 						   uint32 widthA,
110 						   uint32 heightA );
111 
112 /* ---- \ghd{ memory I/O } ------------------------------------------------- */
113 
114 /** word size (16-bit) needs when written to memory */
115 uint32 bim_UInt32Image_memSize( struct bbs_Context* cpA,
116 							    const struct bim_UInt32Image* ptrA );
117 
118 /** writes object to memory; returns number of words (16-bit) written */
119 uint32 bim_UInt32Image_memWrite( struct bbs_Context* cpA,
120 								 const struct bim_UInt32Image* ptrA,
121 								 uint16* memPtrA );
122 
123 /** reads object from memory; returns number of words (16-bit) read */
124 uint32 bim_UInt32Image_memRead( struct bbs_Context* cpA,
125 							    struct bim_UInt32Image* ptrA,
126 							    const uint16* memPtrA,
127  					            struct bbs_MemSeg* mspA );
128 
129 /* ---- \ghd{ exec functions } --------------------------------------------- */
130 
131 /** sets all pixels to one value */
132 void bim_UInt32Image_setAllPixels( struct bbs_Context* cpA,
133 								   struct bim_UInt32Image* ptrA,
134 								   uint32 valueA,
135 								   int32 bbpA );
136 
137 #endif /* bim_UINT32_IMAGE_EM_H */
138 
139