On May 20, 2014, at 8:29 AM, Barry Fawthrop <security@isscp.com> wrote:
I'm confused as to why the alignment changes when the View is savedHere is my layout<FrameLayout android:layout_width="1000dp" android:layout_height="707dp" android:layout_marginLeft="140dp" android:layout_marginTop="670dp" android:id="@+id/home" android:background="@color/black" ><ImageView android:layout_width="1000dp" android:layout_height="707dp" android:background="@color/brown" android:id="@+id/graphic" android:src="@drawable/anatomy_hooves" /><com.TouchPanel android:layout_width="1000dp" android:layout_height="707dp" android:background="@android:color/transparent" android:id="@+id/touchLayer" /><com.PenPanel android:layout_width="1000dp" android:layout_height="707dp" android:background="@android:color/transparent" android:id="@+id/penLayer" /></FrameLayout>Here is the code that savesFrameLayout home = (FrameLayout)findViewById(R.id.home); home.layout(0, 0, 1500, 1061);……home.layout(0, 0, 1500, 1061);home.setDrawingCacheEnabled(true);Bitmap bmp = Bitmap.createBitmap(home.getDrawingCache());Log.i("VISIT","Bitmap " + bmp.getWidth() + " x " + bmp.getHeight() + " " + bmp.getDensity() );try {FileOutputStream out = new FileOutputStream(Environment.getExternalStorageDirectory() + "/DCIM/Images/" + skeletonFileName);bmp.compress(Bitmap.CompressFormat.PNG, 100, out);out.flush();out.close();Log.i("INFO","saved Skeleton to ["+ skeletonFileName +"] ");} catch (Exception err) {err.printStackTrace();Log.e("INFO","Could Not save Skeleton to ["+ skeletonFileName +"] ");}home.setDrawingCacheEnabled(false);Here is the screen BEFORE pressing the save ButtonHere is the resulting PNG file generated by executing the codeWhy does the drawing shift and rescale ?What am I missing, how can I save the image as it appear on the screenThanks in advance--
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscribe@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en
---
You received this message because you are subscribed to the Google Groups "Android Developers" group.
To unsubscribe from this group and stop receiving emails from it, send an email to android-developers+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
No comments:
Post a Comment