Adding freetype font rendering to renderscript.

Change-Id: I3a10ffe27092a41df156341c9cb3f7aa19c49f19
This commit is contained in:
Alex Sakhartchouk
2010-06-24 17:15:34 -07:00
parent 8f31bd6b68
commit 9b949fce39
22 changed files with 1250 additions and 15 deletions

View File

@@ -386,6 +386,21 @@ public class Allocation extends BaseObj {
Bitmap b = BitmapFactory.decodeResource(res, id, mBitmapOptions);
return createFromBitmapBoxed(rs, b, dstFmt, genMips);
}
static public Allocation createFromString(RenderScript rs, String str)
throws IllegalArgumentException {
byte[] allocArray = null;
try {
allocArray = str.getBytes("UTF-8");
Allocation alloc = Allocation.createSized(rs, Element.U8(rs), allocArray.length);
alloc.data(allocArray);
return alloc;
}
catch (Exception e) {
Log.e("rs", "could not convert string to utf-8");
}
return null;
}
}