Tag: 位图

如何调整Android中的位图?

我从远程数据库中获取了Base64string的位图( encodedImage是用Base64表示图像的string): profileImage = (ImageView)findViewById(R.id.profileImage); byte[] imageAsBytes=null; try { imageAsBytes = Base64.decode(encodedImage.getBytes()); } catch (IOException e) {e.printStackTrace();} profileImage.setImageBitmap( BitmapFactory.decodeByteArray(imageAsBytes, 0, imageAsBytes.length) ); profileImage是我的ImageView 好吧,但我必须调整这个图像之前,我的布局在我的ImageView上显示它。 我必须调整到120×120。 有人可以告诉我的代码来调整它吗? 我发现的例子不能应用于base64string获得的位图。

如何获取窗口的位图对象在C + +的屏幕截图?

如何获取窗口的位图对象在C + +的屏幕截图? 假设我已经有窗口句柄了。 而且我也想知道当它处于最小化状态时是否可以获得窗口的屏幕截图 ? 这里的C ++是指所有与Windows XP +(win32)相关的库的VC ++。

创build一个空的位图,并绘制通过在Android的canvas

我想创build一个空的位图,并设置canvas到该位图,然后在位图上绘制任何形状。

Android:如何将整个ImageView转换为Bitmap?

我有我的应用程序显示不同比例的图像,resize(centerInside)imageView中。 我需要的是从ImageView创build位图,包括背景(在这种情况下是黑色)。 所以例如我有设备屏幕320×480,全屏幕imageView与图像resize为280×480。 我怎么能从它得到320×480位图? 在这个imageview的顶部,我有一些标志或button,我不想包含在位图,他们就像在顶层。 所有我需要的是位图与图像和黑色的边界从一边。

如何将图像从drawable添加到gmail?

我试图从我的GridView的图像附加到Gmail或Facebook,但每当我试图附加我的应用程序崩溃,我得到以下错误与nullpointerexception,下面是我的代码与gridview图像select,任何一个可以帮助吗? public class Free_Cover_Activity extends AppCompatActivity { GridView grid; int[] imageId = { R.drawable.discovercover, R.drawable.burpresswordfree, R.drawable.flyfree, R.drawable.cantmovefree, R.drawable.cantmovewordfree, R.drawable.chalkthisfree, R.drawable.fivehundredmetersfree, R.drawable.freeexercise, R.drawable.gym_smilie, R.drawable.hundredcalrairesfree, R.drawable.injuryfree, R.drawable.jumpropefree, R.drawable.nicesnathcfree, R.drawable.personglrecordfree, R.drawable.posefree, R.drawable.pushupfree, R.drawable.shoulder, R.drawable.timewordfree, R.drawable.unbrokernfree, R.drawable.weightbeltfree }; private Bitmap mBitmap; private Intent email; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.free_cover_gridview); android.support.v7.app.ActionBar abar = getSupportActionBar(); ColorDrawable colorDrawable = […]

Bitmap,Bitmap.recycle(),WeakReferences和垃圾收集

Android上的AFAIK,build议引用Bitmap对象作为WeakReferences,以避免内存泄漏。 当没有更多的硬引用保留位图对象时,垃圾收集器将自动收集它。 现在,如果我理解正确,必须始终调用方法Bitmap.recycle()来释放一个位图。 我认为这是因为Bitmap对象有特殊的内存pipe理。 那是对的吗? 如果这是真的,那么在使用WeakReferences时,必须存在内存泄漏,因为在释放WeakReferences时,Bitmap.recycle()永远不会被调用。 或者,不知何故,WeakReferences足以避免内存泄漏? 谢谢

当设置选项时,BitmapFactory.decodeStream返回null

我有BitmapFactory.decodeStream(inputStream) 。 当没有选项使用它时,它会返回一个图像。 但是,当我在.decodeStream(inputStream, null, options)使用选项时.decodeStream(inputStream, null, options)它永远不会返回位图。 我想要做的是在我实际加载它来节省内存之前下取样一个位图。 我读过一些很好的指南,但没有使用.decodeStream 。 处理大的位图 和这里 Android中的image processing 工作只是罚款 URL url = new URL(sUrl); HttpURLConnection connection = (HttpURLConnection) url.openConnection(); InputStream is = connection.getInputStream(); Bitmap img = BitmapFactory.decodeStream(is, null, options); 不工作 InputStream is = connection.getInputStream(); Bitmap img = BitmapFactory.decodeStream(is, null, options); InputStream is = connection.getInputStream(); Options options = new […]

当没有剩余内存时,.Net和Bitmap不会由GC自动处理

我想知道如何分配和处理分配给位图的内存在.NET中工作。 当我在一个函数的循环中做了大量的位图创build并连续调用它时,它会一直运行,直到某些时候Bitmap将不能分配给出指定大小的“无效参数”exception的内存。 如果我打电话给垃圾收集器,而它的工作。 用下面的代码你可以重新编译错误: class BitmapObject { public bool Visible { get { return enb; } set { enb = value; } } private bool enb; private Bitmap bmp; public BitmapObject(int i, bool en) { enb = en; bmp = new Bitmap(i, i); } } class Pool<T> where T : BitmapObject { List<T> preallocatedBitmaps = […]

在Android中比较位图图像

有没有办法检查位图是否相同 ? 有人可以帮我吗?

Android,沿着path移动位图?

我想知道是否有可能从一个path中select坐标来绘制一段时间的位图,例如,我有一个太阳的图像,我想随着时间的推移,沿着弧线path。 有没有什么办法来定义这样的path,然后沿着它移动,这样我就不用计算它呢? 谢谢。