Bitmap Image Graphics

Bitmap Image  Graphics

private void DrawImagePointF(PaintEventArgs e)
{

// Create image.
    Image newImage = Image.FromFile("SampImag.jpg");

// Create point for upper-left corner of image.
    PointF ulCorner = new PointF(100.0F, 100.0F);

// Draw image to screen.
    e.Graphics.DrawImage(newImage, ulCorner);
}

时间: 2024-08-08 23:00:46

Bitmap Image Graphics的相关文章

关于bitmap recycle trying to use a recycled bitmap android.graphics.Bitmap

在开发中,一直使用4.0以上手机作为测试机所以一直没有出现这个问题,今天换了2.3版本的手机,出现了这个错误: trying to use a recycled bitmap android.graphics.Bitmap 后检查代码,我的图片回收代码是介个样子的: public static void recycle(View view) { if (null == view) { return; } BitmapDrawable bd = (BitmapDrawable) view.getB

关于Canvas: trying to use a recycled bitmap android.graphics的疑惑

============问题描述============ 因为viewpager图片内存溢出的问题,不得不考虑手动释放内存,不过出的问题我不理解. 我的想法是创建一个Map,然后用instantiateItem中的参数arg0当作键,bitmap当作值,当destroyItem中去掉VIew的时候我捎带着把不再用到的bitmap也回收掉 //这个是存bitmap的map public HashMap<Integer, SoftReference<Bitmap>> cacheBit;

(转)根据ImageView的大小来压缩Bitmap,避免OOM

本文转载于:http://www.cnblogs.com/tianzhijiexian/p/4254110.html Bitmap是引起OOM的罪魁祸首之一,当我们从网络上下载图片的时候无法知道网络图片的准确大小,所以为了节约内存,一般会在服务器上缓存一个缩略图,提升下载速度.除此之外,我们还可以在本地显示图片前将图片进行压缩,使其完全符合imageview的大小,这样就不会浪费内存了. 一.思路 思路:计算出要显示bitmap的imageview大小,根据imageview的大小压缩bitma

关于Bitmap.createBitmap(Bitmap source, int x, int y, int width, int height)这个方法

============问题描述============ Bitmap android.graphics.Bitmap.createBitmap(Bitmap source, int x, int y, int width, int height) 这个方法屌爆了,不会用 后面的四个参数到底啥意思啊 不是说截的是一个矩形的x,y,宽高吗/ 为何我传入这个: Bitmap bitmap = Bitmap.createBitmap(b1, 0, 20, b1.getWidth(), b1.getHe

根据ImageView的大小来压缩Bitmap,避免OOM

Bitmap是引起OOM的罪魁祸首之一,当我们从网络上下载图片的时候无法知道网络图片的准确大小,所以为了节约内存,一般会在服务器上缓存一个缩略图,提升下载速度.除此之外,我们还可以在本地显示图片前将图片进行压缩,使其完全符合imageview的大小,这样就不会浪费内存了. 一.思路 思路:计算出要显示bitmap的imageview大小,根据imageview的大小压缩bitmap,最终让bitmap和imageview一样大. 二.获得ImageView的宽高 int android.view

[Android Pro] 关于BitmapFactory.decodeStream(is)方法无法正常解码为Bitmap对象的解决方法

在android sdk 1.6版本API帮助文档中,其中关于BitmapFactory.decodeFactory.decodeStream(InputStream is)的帮助文档是这么说明的: Bitmap android.graphics.BitmapFactory.decodeStream(InputStream is) public static Bitmap decodeStream (InputStream is) Since: API Level 1 Decode an inp

简单谈谈Resource,Drawable和Bitmap之间的转换

一直接触这些东西,还是归个类整理一下比较好. Resource -> Drawable Drawable draw1 = this.getResources().getDrawable(R.drawable.icon); Drawable -> Bitmap 1. static Bitmap drawableToBitmap(Drawable drawable) // drawable 转换成bitmap { int width = drawable.getIntrinsicWidth();/

Bitmap.recycle引发的血案

从Bitmap.recycle说起 在Android中,Bitmap的存储分为两部分,一部分是Bitmap的数据,一部分是Bitmap的引用. 在Android2.3时代,Bitmap的引用是放在堆中的,而Bitmap的数据部分是放在栈中的,需要用户调用recycle方法手动进行内存回收,而在Android2.3之后,整个Bitmap,包括数据和引用,都放在了堆中,这样,整个Bitmap的回收就全部交给GC了,这个recycle方法就再也不需要使用了. 然而-- 现在的SDK中对recycle方

创建BitMap

Bitmap pResource=(Bitmap)Image.FromFile("..\\..\\res\\animal.bmp"); Bitmap pBitMap = new Bitmap(36, 36);        //BitMap大小 Graphics pGraphics = Graphics.FromImage(pBitMap);       //创建Graphics对象 Rectangle pDestRec = new Rectangle(0, 0, 39, 39);