Revision d5c71d02
Added by Leszek Koltunski over 2 years ago
src/main/java/org/distorted/objectlib/main/TwistyObject.java | ||
---|---|---|
135 | 135 |
private int[][][] mEnabled; |
136 | 136 |
private DistortedNode mNode; |
137 | 137 |
private ObjectLibInterface mInterface; |
138 |
private Bitmap mBitmap; |
|
138 | 139 |
|
139 | 140 |
//////////////////// SOLVED1 //////////////////////// |
140 | 141 |
|
... | ... | |
238 | 239 |
mTexture = new DistortedTexture(); |
239 | 240 |
mEffects = new DistortedEffects(); |
240 | 241 |
|
241 |
createTexture();
|
|
242 |
setTexture();
|
|
242 | 243 |
|
243 | 244 |
for(int q=0; q<NUM_QUATS; q++) |
244 | 245 |
{ |
... | ... | |
1081 | 1082 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
1082 | 1083 |
// the getFaceColors + final black in a grid (so that we do not exceed the maximum texture size) |
1083 | 1084 |
|
1084 |
void createTexture() |
|
1085 |
private void createTexture()
|
|
1085 | 1086 |
{ |
1086 |
Bitmap bitmap; |
|
1087 |
|
|
1088 | 1087 |
Paint paint = new Paint(); |
1089 |
bitmap = Bitmap.createBitmap( mNumTexCols*TEXTURE_HEIGHT, mNumTexRows*TEXTURE_HEIGHT, Bitmap.Config.ARGB_8888);
|
|
1090 |
Canvas canvas = new Canvas(bitmap);
|
|
1088 |
mBitmap = Bitmap.createBitmap( mNumTexCols*TEXTURE_HEIGHT, mNumTexRows*TEXTURE_HEIGHT, Bitmap.Config.ARGB_8888);
|
|
1089 |
Canvas canvas = new Canvas(mBitmap);
|
|
1091 | 1090 |
|
1092 | 1091 |
paint.setAntiAlias(true); |
1093 | 1092 |
paint.setTextAlign(Paint.Align.CENTER); |
... | ... | |
1108 | 1107 |
factory.drawRoundedPolygon(canvas, paint, col*TEXTURE_HEIGHT, row*TEXTURE_HEIGHT, color, sticker); |
1109 | 1108 |
texture++; |
1110 | 1109 |
} |
1110 |
} |
|
1111 |
|
|
1112 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
|
1113 |
|
|
1114 |
void setTexture() |
|
1115 |
{ |
|
1116 |
if( mBitmap==null ) createTexture(); |
|
1111 | 1117 |
|
1112 |
if( !mTexture.setTexture(bitmap) )
|
|
1118 |
if( !mTexture.setTexture(mBitmap) )
|
|
1113 | 1119 |
{ |
1114 | 1120 |
int max = DistortedLibrary.getMaxTextureSize(); |
1115 |
mInterface.reportProblem("failed to set texture of size "+bitmap.getWidth()+"x"+bitmap.getHeight()+" max is "+max);
|
|
1121 |
mInterface.reportProblem("failed to set texture of size "+mBitmap.getWidth()+"x"+mBitmap.getHeight()+" max is "+max);
|
|
1116 | 1122 |
} |
1117 | 1123 |
} |
1118 | 1124 |
|
... | ... | |
1289 | 1295 |
} |
1290 | 1296 |
} |
1291 | 1297 |
|
1298 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
|
1299 |
|
|
1300 |
public Bitmap getStickerBitmap() |
|
1301 |
{ |
|
1302 |
return mBitmap; |
|
1303 |
} |
|
1304 |
|
|
1292 | 1305 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
1293 | 1306 |
|
1294 | 1307 |
public DistortedNode getNode() |
Also available in: Unified diff
Make it possible to extract objects' sticker pngs.