blob: 5d2a0590d6913876db05a6aed589a26e13a6844d [file] [log] [blame]
Jason Sams36e612a2009-07-31 16:26:13 -07001/*
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
17package android.renderscript;
18
Jason Sams43ee06852009-08-12 17:54:11 -070019import java.lang.reflect.Field;
Alex Sakhartchoukdfac8142010-07-15 11:33:03 -070020import android.util.Log;
Jason Sams36e612a2009-07-31 16:26:13 -070021
22/**
23 * @hide
24 *
25 **/
26public class Element extends BaseObj {
Jason Samsea84a7c2009-09-04 14:42:41 -070027 int mSize;
Jason Sams718cd1f2009-12-23 14:35:29 -080028 Element[] mElements;
29 String[] mElementNames;
Jason Sams36e612a2009-07-31 16:26:13 -070030
Jason Sams718cd1f2009-12-23 14:35:29 -080031 DataType mType;
32 DataKind mKind;
33 boolean mNormalized;
34 int mVectorSize;
Jason Sams768bc022009-09-21 19:41:04 -070035
Jason Sams718cd1f2009-12-23 14:35:29 -080036 int getSizeBytes() {return mSize;}
Jason Sams36e612a2009-07-31 16:26:13 -070037
38 public enum DataType {
Jason Sams718cd1f2009-12-23 14:35:29 -080039 //FLOAT_16 (1, 2),
40 FLOAT_32 (2, 4),
41 //FLOAT_64 (3, 8),
42 SIGNED_8 (4, 1),
43 SIGNED_16 (5, 2),
44 SIGNED_32 (6, 4),
45 //SIGNED_64 (7, 8),
46 UNSIGNED_8 (8, 1),
47 UNSIGNED_16 (9, 2),
48 UNSIGNED_32 (10, 4),
49 //UNSIGNED_64 (11, 8),
50
Jason Samsf110d4b2010-06-21 17:42:41 -070051 BOOLEAN(12, 1),
Jason Sams718cd1f2009-12-23 14:35:29 -080052
Jason Samsf110d4b2010-06-21 17:42:41 -070053 UNSIGNED_5_6_5 (13, 2),
54 UNSIGNED_5_5_5_1 (14, 2),
55 UNSIGNED_4_4_4_4 (15, 2),
56
57 RS_ELEMENT (16, 4),
58 RS_TYPE (17, 4),
59 RS_ALLOCATION (18, 4),
60 RS_SAMPLER (19, 4),
61 RS_SCRIPT (20, 4),
62 RS_MESH (21, 4),
63 RS_PROGRAM_FRAGMENT (22, 4),
64 RS_PROGRAM_VERTEX (23, 4),
65 RS_PROGRAM_RASTER (24, 4),
66 RS_PROGRAM_STORE (25, 4);
Jason Sams36e612a2009-07-31 16:26:13 -070067
68 int mID;
Jason Sams718cd1f2009-12-23 14:35:29 -080069 int mSize;
70 DataType(int id, int size) {
Jason Sams36e612a2009-07-31 16:26:13 -070071 mID = id;
Jason Sams718cd1f2009-12-23 14:35:29 -080072 mSize = size;
Jason Sams36e612a2009-07-31 16:26:13 -070073 }
74 }
75
76 public enum DataKind {
77 USER (0),
Jason Sams718cd1f2009-12-23 14:35:29 -080078
79 PIXEL_L (7),
80 PIXEL_A (8),
81 PIXEL_LA (9),
82 PIXEL_RGB (10),
83 PIXEL_RGBA (11);
Jason Sams36e612a2009-07-31 16:26:13 -070084
85 int mID;
86 DataKind(int id) {
87 mID = id;
88 }
89 }
90
Jason Samsf110d4b2010-06-21 17:42:41 -070091 public static Element BOOLEAN(RenderScript rs) {
92 if(rs.mElement_BOOLEAN == null) {
93 rs.mElement_BOOLEAN = createUser(rs, DataType.BOOLEAN);
94 }
95 return rs.mElement_BOOLEAN;
96 }
97
Jason Sams8cb39de2010-06-01 15:47:01 -070098 public static Element U8(RenderScript rs) {
99 if(rs.mElement_U8 == null) {
100 rs.mElement_U8 = createUser(rs, DataType.UNSIGNED_8);
Jason Sams718cd1f2009-12-23 14:35:29 -0800101 }
Jason Sams8cb39de2010-06-01 15:47:01 -0700102 return rs.mElement_U8;
Jason Sams718cd1f2009-12-23 14:35:29 -0800103 }
104
Jason Sams8cb39de2010-06-01 15:47:01 -0700105 public static Element I8(RenderScript rs) {
106 if(rs.mElement_I8 == null) {
107 rs.mElement_I8 = createUser(rs, DataType.SIGNED_8);
Jason Sams718cd1f2009-12-23 14:35:29 -0800108 }
Jason Sams8cb39de2010-06-01 15:47:01 -0700109 return rs.mElement_I8;
Jason Sams718cd1f2009-12-23 14:35:29 -0800110 }
111
Jason Samse29f3e72010-06-08 15:40:48 -0700112 public static Element U16(RenderScript rs) {
113 if(rs.mElement_U16 == null) {
114 rs.mElement_U16 = createUser(rs, DataType.UNSIGNED_16);
115 }
116 return rs.mElement_U16;
117 }
118
119 public static Element I16(RenderScript rs) {
120 if(rs.mElement_I16 == null) {
121 rs.mElement_I16 = createUser(rs, DataType.SIGNED_16);
122 }
123 return rs.mElement_I16;
124 }
125
Jason Sams8cb39de2010-06-01 15:47:01 -0700126 public static Element U32(RenderScript rs) {
127 if(rs.mElement_U32 == null) {
128 rs.mElement_U32 = createUser(rs, DataType.UNSIGNED_32);
Jason Sams718cd1f2009-12-23 14:35:29 -0800129 }
Jason Sams8cb39de2010-06-01 15:47:01 -0700130 return rs.mElement_U32;
Jason Sams718cd1f2009-12-23 14:35:29 -0800131 }
132
Jason Sams8cb39de2010-06-01 15:47:01 -0700133 public static Element I32(RenderScript rs) {
134 if(rs.mElement_I32 == null) {
135 rs.mElement_I32 = createUser(rs, DataType.SIGNED_32);
Jason Sams718cd1f2009-12-23 14:35:29 -0800136 }
Jason Sams8cb39de2010-06-01 15:47:01 -0700137 return rs.mElement_I32;
Jason Sams718cd1f2009-12-23 14:35:29 -0800138 }
139
Jason Sams8cb39de2010-06-01 15:47:01 -0700140 public static Element F32(RenderScript rs) {
141 if(rs.mElement_F32 == null) {
142 rs.mElement_F32 = createUser(rs, DataType.FLOAT_32);
Jason Sams718cd1f2009-12-23 14:35:29 -0800143 }
Jason Sams8cb39de2010-06-01 15:47:01 -0700144 return rs.mElement_F32;
Jason Sams718cd1f2009-12-23 14:35:29 -0800145 }
146
Jason Sams8cb39de2010-06-01 15:47:01 -0700147 public static Element ELEMENT(RenderScript rs) {
148 if(rs.mElement_ELEMENT == null) {
149 rs.mElement_ELEMENT = createUser(rs, DataType.RS_ELEMENT);
Jason Samsa70f4162010-03-26 15:33:42 -0700150 }
Jason Sams8cb39de2010-06-01 15:47:01 -0700151 return rs.mElement_ELEMENT;
Jason Samsa70f4162010-03-26 15:33:42 -0700152 }
153
Jason Sams8cb39de2010-06-01 15:47:01 -0700154 public static Element TYPE(RenderScript rs) {
155 if(rs.mElement_TYPE == null) {
156 rs.mElement_TYPE = createUser(rs, DataType.RS_TYPE);
Jason Samsa70f4162010-03-26 15:33:42 -0700157 }
Jason Sams8cb39de2010-06-01 15:47:01 -0700158 return rs.mElement_TYPE;
Jason Samsa70f4162010-03-26 15:33:42 -0700159 }
160
Jason Sams8cb39de2010-06-01 15:47:01 -0700161 public static Element ALLOCATION(RenderScript rs) {
162 if(rs.mElement_ALLOCATION == null) {
163 rs.mElement_ALLOCATION = createUser(rs, DataType.RS_ALLOCATION);
Jason Samsa70f4162010-03-26 15:33:42 -0700164 }
Jason Sams8cb39de2010-06-01 15:47:01 -0700165 return rs.mElement_ALLOCATION;
Jason Samsa70f4162010-03-26 15:33:42 -0700166 }
167
Jason Sams8cb39de2010-06-01 15:47:01 -0700168 public static Element SAMPLER(RenderScript rs) {
169 if(rs.mElement_SAMPLER == null) {
170 rs.mElement_SAMPLER = createUser(rs, DataType.RS_SAMPLER);
Jason Samsa70f4162010-03-26 15:33:42 -0700171 }
Jason Sams8cb39de2010-06-01 15:47:01 -0700172 return rs.mElement_SAMPLER;
Jason Samsa70f4162010-03-26 15:33:42 -0700173 }
174
Jason Sams8cb39de2010-06-01 15:47:01 -0700175 public static Element SCRIPT(RenderScript rs) {
176 if(rs.mElement_SCRIPT == null) {
177 rs.mElement_SCRIPT = createUser(rs, DataType.RS_SCRIPT);
Jason Samsa70f4162010-03-26 15:33:42 -0700178 }
Jason Sams8cb39de2010-06-01 15:47:01 -0700179 return rs.mElement_SCRIPT;
Jason Samsa70f4162010-03-26 15:33:42 -0700180 }
181
Jason Sams8cb39de2010-06-01 15:47:01 -0700182 public static Element MESH(RenderScript rs) {
183 if(rs.mElement_MESH == null) {
184 rs.mElement_MESH = createUser(rs, DataType.RS_MESH);
Jason Samsa70f4162010-03-26 15:33:42 -0700185 }
Jason Sams8cb39de2010-06-01 15:47:01 -0700186 return rs.mElement_MESH;
Jason Samsa70f4162010-03-26 15:33:42 -0700187 }
188
Jason Sams8cb39de2010-06-01 15:47:01 -0700189 public static Element PROGRAM_FRAGMENT(RenderScript rs) {
190 if(rs.mElement_PROGRAM_FRAGMENT == null) {
191 rs.mElement_PROGRAM_FRAGMENT = createUser(rs, DataType.RS_PROGRAM_FRAGMENT);
Jason Samsa70f4162010-03-26 15:33:42 -0700192 }
Jason Sams8cb39de2010-06-01 15:47:01 -0700193 return rs.mElement_PROGRAM_FRAGMENT;
Jason Samsa70f4162010-03-26 15:33:42 -0700194 }
195
Jason Sams8cb39de2010-06-01 15:47:01 -0700196 public static Element PROGRAM_VERTEX(RenderScript rs) {
197 if(rs.mElement_PROGRAM_VERTEX == null) {
198 rs.mElement_PROGRAM_VERTEX = createUser(rs, DataType.RS_PROGRAM_VERTEX);
Jason Samsa70f4162010-03-26 15:33:42 -0700199 }
Jason Sams8cb39de2010-06-01 15:47:01 -0700200 return rs.mElement_PROGRAM_VERTEX;
Jason Samsa70f4162010-03-26 15:33:42 -0700201 }
202
Jason Sams8cb39de2010-06-01 15:47:01 -0700203 public static Element PROGRAM_RASTER(RenderScript rs) {
204 if(rs.mElement_PROGRAM_RASTER == null) {
205 rs.mElement_PROGRAM_RASTER = createUser(rs, DataType.RS_PROGRAM_RASTER);
Jason Samsa70f4162010-03-26 15:33:42 -0700206 }
Jason Sams8cb39de2010-06-01 15:47:01 -0700207 return rs.mElement_PROGRAM_RASTER;
Jason Samsa70f4162010-03-26 15:33:42 -0700208 }
209
Jason Sams8cb39de2010-06-01 15:47:01 -0700210 public static Element PROGRAM_STORE(RenderScript rs) {
211 if(rs.mElement_PROGRAM_STORE == null) {
212 rs.mElement_PROGRAM_STORE = createUser(rs, DataType.RS_PROGRAM_STORE);
Jason Samsa70f4162010-03-26 15:33:42 -0700213 }
Jason Sams8cb39de2010-06-01 15:47:01 -0700214 return rs.mElement_PROGRAM_STORE;
Jason Samsa70f4162010-03-26 15:33:42 -0700215 }
216
217
Jason Sams718cd1f2009-12-23 14:35:29 -0800218 public static Element A_8(RenderScript rs) {
219 if(rs.mElement_A_8 == null) {
220 rs.mElement_A_8 = createPixel(rs, DataType.UNSIGNED_8, DataKind.PIXEL_A);
221 }
222 return rs.mElement_A_8;
223 }
224
225 public static Element RGB_565(RenderScript rs) {
226 if(rs.mElement_RGB_565 == null) {
227 rs.mElement_RGB_565 = createPixel(rs, DataType.UNSIGNED_5_6_5, DataKind.PIXEL_RGB);
228 }
229 return rs.mElement_RGB_565;
230 }
231
232 public static Element RGB_888(RenderScript rs) {
233 if(rs.mElement_RGB_888 == null) {
234 rs.mElement_RGB_888 = createPixel(rs, DataType.UNSIGNED_8, DataKind.PIXEL_RGB);
235 }
236 return rs.mElement_RGB_888;
237 }
238
239 public static Element RGBA_5551(RenderScript rs) {
240 if(rs.mElement_RGBA_5551 == null) {
241 rs.mElement_RGBA_5551 = createPixel(rs, DataType.UNSIGNED_5_5_5_1, DataKind.PIXEL_RGBA);
242 }
243 return rs.mElement_RGBA_5551;
244 }
245
246 public static Element RGBA_4444(RenderScript rs) {
247 if(rs.mElement_RGBA_4444 == null) {
248 rs.mElement_RGBA_4444 = createPixel(rs, DataType.UNSIGNED_4_4_4_4, DataKind.PIXEL_RGBA);
249 }
250 return rs.mElement_RGBA_4444;
251 }
252
253 public static Element RGBA_8888(RenderScript rs) {
254 if(rs.mElement_RGBA_8888 == null) {
255 rs.mElement_RGBA_8888 = createPixel(rs, DataType.UNSIGNED_8, DataKind.PIXEL_RGBA);
256 }
257 return rs.mElement_RGBA_8888;
258 }
259
Jason Sams8cb39de2010-06-01 15:47:01 -0700260 public static Element F32_2(RenderScript rs) {
261 if(rs.mElement_FLOAT_2 == null) {
262 rs.mElement_FLOAT_2 = createVector(rs, DataType.FLOAT_32, 2);
Jason Sams718cd1f2009-12-23 14:35:29 -0800263 }
Jason Sams8cb39de2010-06-01 15:47:01 -0700264 return rs.mElement_FLOAT_2;
Jason Sams718cd1f2009-12-23 14:35:29 -0800265 }
266
Jason Sams8cb39de2010-06-01 15:47:01 -0700267 public static Element F32_3(RenderScript rs) {
268 if(rs.mElement_FLOAT_3 == null) {
269 rs.mElement_FLOAT_3 = createVector(rs, DataType.FLOAT_32, 3);
Jason Sams718cd1f2009-12-23 14:35:29 -0800270 }
Jason Sams8cb39de2010-06-01 15:47:01 -0700271 return rs.mElement_FLOAT_3;
Jason Sams718cd1f2009-12-23 14:35:29 -0800272 }
273
Jason Sams8cb39de2010-06-01 15:47:01 -0700274 public static Element F32_4(RenderScript rs) {
275 if(rs.mElement_FLOAT_4 == null) {
276 rs.mElement_FLOAT_4 = createVector(rs, DataType.FLOAT_32, 4);
Jason Sams718cd1f2009-12-23 14:35:29 -0800277 }
Jason Sams8cb39de2010-06-01 15:47:01 -0700278 return rs.mElement_FLOAT_4;
Jason Sams718cd1f2009-12-23 14:35:29 -0800279 }
280
Jason Sams8cb39de2010-06-01 15:47:01 -0700281 public static Element U8_4(RenderScript rs) {
282 if(rs.mElement_UCHAR_4 == null) {
283 rs.mElement_UCHAR_4 = createVector(rs, DataType.UNSIGNED_8, 4);
Jason Sams718cd1f2009-12-23 14:35:29 -0800284 }
Jason Sams8cb39de2010-06-01 15:47:01 -0700285 return rs.mElement_UCHAR_4;
Jason Sams718cd1f2009-12-23 14:35:29 -0800286 }
287
Jason Sams718cd1f2009-12-23 14:35:29 -0800288
289 Element(RenderScript rs, Element[] e, String[] n) {
Jason Sams3c0dfba2009-09-27 17:50:38 -0700290 super(rs);
Jason Samsea84a7c2009-09-04 14:42:41 -0700291 mSize = 0;
Jason Sams718cd1f2009-12-23 14:35:29 -0800292 mElements = e;
293 mElementNames = n;
294 int[] ids = new int[mElements.length];
295 for (int ct = 0; ct < mElements.length; ct++ ) {
296 mSize += mElements[ct].mSize;
297 ids[ct] = mElements[ct].mID;
298 }
299 mID = rs.nElementCreate2(ids, mElementNames);
300 }
301
302 Element(RenderScript rs, DataType dt, DataKind dk, boolean norm, int size) {
303 super(rs);
304 mSize = dt.mSize * size;
305 mType = dt;
306 mKind = dk;
307 mNormalized = norm;
308 mVectorSize = size;
309 mID = rs.nElementCreate(dt.mID, dk.mID, norm, size);
Jason Sams36e612a2009-07-31 16:26:13 -0700310 }
311
Alex Sakhartchoukdfac8142010-07-15 11:33:03 -0700312 Element(RenderScript rs, int id) {
313 super(rs);
314 mID = id;
315 }
316
317 @Override
318 void updateFromNative() {
319
320 // we will pack mType; mKind; mNormalized; mVectorSize; NumSubElements
321 int[] dataBuffer = new int[5];
322 mRS.nElementGetNativeData(mID, dataBuffer);
323 for (DataType dt: DataType.values()) {
324 if(dt.mID == dataBuffer[0]){
325 mType = dt;
326 }
327 }
328 for (DataKind dk: DataKind.values()) {
329 if(dk.mID == dataBuffer[1]){
330 mKind = dk;
331 }
332 }
333
334 mNormalized = dataBuffer[2] == 1 ? true : false;
335 mVectorSize = dataBuffer[3];
336 int numSubElements = dataBuffer[4];
337 if(numSubElements > 0) {
338 mElements = new Element[numSubElements];
339 mElementNames = new String[numSubElements];
340
341 int[] subElementIds = new int[numSubElements];
342 mRS.nElementGetSubElements(mID, subElementIds, mElementNames);
343 for(int i = 0; i < numSubElements; i ++) {
344 mElements[i] = new Element(mRS, subElementIds[i]);
345 mElements[i].updateFromNative();
346 }
347 }
348
349 }
350
Jason Sams36e612a2009-07-31 16:26:13 -0700351 public void destroy() throws IllegalStateException {
Jason Sams7ce033d2009-08-18 14:14:24 -0700352 super.destroy();
Jason Sams36e612a2009-07-31 16:26:13 -0700353 }
354
Jason Sams718cd1f2009-12-23 14:35:29 -0800355 /////////////////////////////////////////
356 public static Element createUser(RenderScript rs, DataType dt) {
Jason Sams718cd1f2009-12-23 14:35:29 -0800357 return new Element(rs, dt, DataKind.USER, false, 1);
358 }
359
360 public static Element createVector(RenderScript rs, DataType dt, int size) {
Jason Sams718cd1f2009-12-23 14:35:29 -0800361 if (size < 2 || size > 4) {
362 throw new IllegalArgumentException("Bad size");
Jason Samsea84a7c2009-09-04 14:42:41 -0700363 }
Jason Sams718cd1f2009-12-23 14:35:29 -0800364 return new Element(rs, dt, DataKind.USER, false, size);
Jason Samsea84a7c2009-09-04 14:42:41 -0700365 }
366
Jason Sams718cd1f2009-12-23 14:35:29 -0800367 public static Element createPixel(RenderScript rs, DataType dt, DataKind dk) {
Jason Sams718cd1f2009-12-23 14:35:29 -0800368 if (!(dk == DataKind.PIXEL_L ||
369 dk == DataKind.PIXEL_A ||
370 dk == DataKind.PIXEL_LA ||
371 dk == DataKind.PIXEL_RGB ||
372 dk == DataKind.PIXEL_RGBA)) {
373 throw new IllegalArgumentException("Unsupported DataKind");
374 }
375 if (!(dt == DataType.UNSIGNED_8 ||
376 dt == DataType.UNSIGNED_5_6_5 ||
377 dt == DataType.UNSIGNED_4_4_4_4 ||
378 dt == DataType.UNSIGNED_5_5_5_1)) {
379 throw new IllegalArgumentException("Unsupported DataType");
380 }
381 if (dt == DataType.UNSIGNED_5_6_5 && dk != DataKind.PIXEL_RGB) {
382 throw new IllegalArgumentException("Bad kind and type combo");
383 }
384 if (dt == DataType.UNSIGNED_5_5_5_1 && dk != DataKind.PIXEL_RGBA) {
385 throw new IllegalArgumentException("Bad kind and type combo");
386 }
387 if (dt == DataType.UNSIGNED_4_4_4_4 && dk != DataKind.PIXEL_RGBA) {
388 throw new IllegalArgumentException("Bad kind and type combo");
389 }
390
391 int size = 1;
392 if (dk == DataKind.PIXEL_LA) {
393 size = 2;
394 }
395 if (dk == DataKind.PIXEL_RGB) {
396 size = 3;
397 }
398 if (dk == DataKind.PIXEL_RGBA) {
399 size = 4;
400 }
401
402 return new Element(rs, dt, dk, true, size);
403 }
Jason Sams36e612a2009-07-31 16:26:13 -0700404
405 public static class Builder {
406 RenderScript mRS;
Jason Sams718cd1f2009-12-23 14:35:29 -0800407 Element[] mElements;
408 String[] mElementNames;
409 int mCount;
Jason Sams22534172009-08-04 16:58:20 -0700410
411 public Builder(RenderScript rs) {
Jason Sams36e612a2009-07-31 16:26:13 -0700412 mRS = rs;
Jason Sams718cd1f2009-12-23 14:35:29 -0800413 mCount = 0;
414 mElements = new Element[8];
415 mElementNames = new String[8];
Jason Sams36e612a2009-07-31 16:26:13 -0700416 }
417
Jason Sams718cd1f2009-12-23 14:35:29 -0800418 public void add(Element element, String name) {
419 if(mCount == mElements.length) {
420 Element[] e = new Element[mCount + 8];
421 String[] s = new String[mCount + 8];
422 System.arraycopy(mElements, 0, e, 0, mCount);
423 System.arraycopy(mElementNames, 0, s, 0, mCount);
424 mElements = e;
425 mElementNames = s;
Jason Sams36e612a2009-07-31 16:26:13 -0700426 }
Jason Sams718cd1f2009-12-23 14:35:29 -0800427 mElements[mCount] = element;
428 mElementNames[mCount] = name;
429 mCount++;
Jason Sams07ae4062009-08-27 20:23:34 -0700430 }
431
Jason Sams22534172009-08-04 16:58:20 -0700432 public Element create() {
Jason Sams771bebb2009-12-07 12:40:12 -0800433 mRS.validate();
Jason Sams718cd1f2009-12-23 14:35:29 -0800434 Element[] ein = new Element[mCount];
435 String[] sin = new String[mCount];
436 java.lang.System.arraycopy(mElements, 0, ein, 0, mCount);
437 java.lang.System.arraycopy(mElementNames, 0, sin, 0, mCount);
438 return new Element(mRS, ein, sin);
Jason Sams36e612a2009-07-31 16:26:13 -0700439 }
440 }
441
Jason Sams718cd1f2009-12-23 14:35:29 -0800442 static void initPredefined(RenderScript rs) {
443 int a8 = rs.nElementCreate(DataType.UNSIGNED_8.mID,
444 DataKind.PIXEL_A.mID, true, 1);
445 int rgba4444 = rs.nElementCreate(DataType.UNSIGNED_4_4_4_4.mID,
446 DataKind.PIXEL_RGBA.mID, true, 4);
447 int rgba8888 = rs.nElementCreate(DataType.UNSIGNED_8.mID,
448 DataKind.PIXEL_RGBA.mID, true, 4);
449 int rgb565 = rs.nElementCreate(DataType.UNSIGNED_5_6_5.mID,
450 DataKind.PIXEL_RGB.mID, true, 3);
451 rs.nInitElements(a8, rgba4444, rgba8888, rgb565);
452 }
Jason Sams36e612a2009-07-31 16:26:13 -0700453}
454