bitmap

Get bitmap file name

99封情书 提交于 2020-02-01 03:11:53
问题 I use this line below for create my Bitmap: Bitmap b = new Bitmap(@"C:\<file name>"); After I modify this bitmap and I want to save it as in line below: b.Save(@"C:\\<other file name>") My question is - how to get the file name bitmap from property. Simply put, I need to save the bitmap with the same name with whom I had initiated it. Thanks 回答1: Perhaps you can do this with Metadata - but I'm not familiar with this subject so I'm not completely sure it's possible, nor do I how to do it. What

Get bitmap file name

拈花ヽ惹草 提交于 2020-02-01 03:11:06
问题 I use this line below for create my Bitmap: Bitmap b = new Bitmap(@"C:\<file name>"); After I modify this bitmap and I want to save it as in line below: b.Save(@"C:\\<other file name>") My question is - how to get the file name bitmap from property. Simply put, I need to save the bitmap with the same name with whom I had initiated it. Thanks 回答1: Perhaps you can do this with Metadata - but I'm not familiar with this subject so I'm not completely sure it's possible, nor do I how to do it. What

查看网络上图片的功能实现

无人久伴 提交于 2020-01-31 09:35:17
首先在AndroidManifest.xml中给程序加上访问Internet的权限: <uses-permissionandroid:name="android.permission.INTERNET" /> 然后在布局文件中加入一个ImageView,用来显示网络上的图片: <?xml version="1.0" encoding="utf-8"?> <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="fill_parent" android:layout_height="fill_parent" android:orientation="vertical" > <TextView android:layout_width="fill_parent" android:layout_height="wrap_content" android:text="@string/hello" /> <ImageView android:layout_width="wrap_content" android:layout_height="wrap_content" android:id="@+id/imageView" /> </LinearLayout>

Dump characters (glyphs) from TrueType font (TTF) into bitmaps

夙愿已清 提交于 2020-01-31 05:36:07
问题 I have a custom TrueType font (TTF) that consists of a bunch of icons, which I'd like to render as individual bitmaps (GIF, PNG, whatever) for use on the Web. You'd think this is a simple task, but apparently not? There is a huge slew of TTF-related software here: http://cg.scs.carleton.ca/~luc/ttsoftware.html But it's all varying levels of "not quite what I want", broken links and/or hard to impossible to compile on a modern Ubuntu box -- eg. dumpglyphs (C++) and ttfgif (C) both fail to

Incorrect result with TransparentBlt

空扰寡人 提交于 2020-01-30 11:48:09
问题 I am working on a transparent treeview control. In order to achieve transparency I have subclassed the tree and am overriding WM_PAINT ( in my WM_ERASEBKGND handler I just return TRUE . Scrolling, mousewheel and other relevant messages are handled properly ). To make tree’s background transparent I am using the following algorithm ( based on this CodeGuru article ): Let tree do its default painting in memory DC ( saved in memDC ). Get parent’s background in another memory DC ( saved in

Bitmap那些事

旧城冷巷雨未停 提交于 2020-01-30 00:11:04
前言 对于安卓开发来说,Bitmap是我们经常提及的话题之一,对于早期安卓开发来说OOM异常与Bitmap的处理紧密相连,稍不留神就来个OOM玩。 现在对于Bitmap的处理大部分情境下就很简单了,一个框架基本全部解决,框架的流行也导致很多开发者一些实现细节不在关心,图片加载立马想到Glide,一行代码解决所有,但是大家应该明白一个道理能写出如此优秀的框架,那肯定是最最基本的技术细节都十分清楚的,所以,我始终认为基础最重要。 上一篇提到图片的质量压缩,本片算是对Bitmap方面知识的补充,主要涉及内存占用大小的计算,尺寸压缩的相关算法,Bitmap复用等方面知识,都是比较简单的。 本篇只是Bitmap方面基础知识的一些梳理,不属于NDK系列文章,好了,进入正文。 Bitmap内存占用 首先我们加载一张500 * 400的图片到内存,显示到250dp * 200dp的图片上,图像放置在res/drawable目录下,图像如下: 加载图片就很简单了,直接用BitmapFactory就可以了,加载完打印出相关信息。 核心代码: 1 Bitmap bitmap = BitmapFactory . decodeResource ( getResources ( ) , R . drawable . icon ) ; 2 imageView . setImageBitmap ( bitmap

c++ Get raw pixel data from hbitmap

て烟熏妆下的殇ゞ 提交于 2020-01-29 05:12:25
问题 I am fairly new to using p/invoke calls and am wondering if someone can guide me on how to retrieve the raw pixel data (unsigned char*) from an hbitmap. This is my scenario: I am loading a .NET Bitmap object on the C# side and sending it's IntPtr to my unmanaged c++ method. Once I receive the hbitmap ptr on the C++ side, I would like to access the Bitmaps' pixel data. I already made a method that accepts an unsigned char* which represents the raw pixel data from c# however I found extracting

Rendering form to bitmap

廉价感情. 提交于 2020-01-28 02:46:51
问题 I would like to render Form to bitmap... Is it possible in .net 2.0? 回答1: Sure, you can call Control.DrawToBitmap() to render a control to a bitmap. For more general drawing, you can create a Bitmap and then use Graphics.FromImage() to create a Graphics instance. You can then draw to this graphics instance as normal. Here's a simple form that can draw itself (just add a button and double click it to add the Click event handler: public partial class Form1 : Form { public Form1() {

Android内存优化杂谈

≡放荡痞女 提交于 2020-01-27 05:43:50
Android内存优化是我们性能优化工作中比较重要的一环,这里其实主要包括两方面的工作: 优化RAM,即降低运行时内存。这里的目的是防止程序发生OOM异常,以及降低程序由于内存过大被LMK机制杀死的概率。另一方面,不合理的内存使用会使GC大大增多,从而导致程序变卡。 优化ROM,即降低程序占ROM的体积。这里主要是为了降低程序占用的空间,防止由于ROM空间不足导致程序无法安装。 本文的着重点为第一点,总结概述降低应用运行内存的技巧。在这里我们不再细述PSS、USS等概念与Android应用的内存管理,如对这部分内容感兴趣,可自行阅读文末的参考文章。 内存泄露的检测与修改 内存泄露:简单来说对象由于编码错误或系统原因,仍然存在着对其直接或间接的引用,导致系统无法进行回收。内存泄露,容易留下逻辑隐患,同时增加了应用内存峰值与发生OOM的概率。它属于bug issue,是我们一定要修改的。 下面是造成内存泄露的一些常见原因,但是如何建立一套发现内存泄露、解决内存泄露的闭环方案,才是我们工作的重点。 一. 内存泄露的监控方案 Square的开源库leakcanry是一个非常不错的选择,它通过弱引用方式侦查Activity或对象的生命周期,若发现内存泄露自动dump Hprof文件,通过HAHA库得到泄露的最短路径,最后通过notification展示。 内存泄露判断与处理的流程如下图

C#飞行仪表控件

↘锁芯ラ 提交于 2020-01-26 02:46:28
C#飞行仪表控件 前言 因为工作需要,要在c#下做飞行仪表显示,在网上找了很久,终于找到一个免费开源的飞行仪表控件,下载后发现原来的飞行仪表控件有一些缺陷,我按我的思路修改后,以开源的规则重新发布到网上。 原始代码来源 : https://blog.csdn.net/qq_42237381/article/details/85258478 原代码作者 : CSDN博主「渡之」 本控件主要代码来源于 CSDN网站(见上) , 由湖南创智艾泰克科技有限公司 王文庆做出完善和改造 遵循 CC 4.0 BY-SA 版权协议,转载请附上原文出处链接及本声明。 新的改变 原来的控件有一些缺陷,我做了以下修改: 原控件尺寸固定,这里改为了可缩放的; 原控件中地平仪的滚动角的三角指示是计算出来的,在角度改变时会变形,比较难看,这里改为直接画一个三角形,然后旋转的方式; 把常用功能【重合两张图片】、【旋转图片】、【截圆】做成了共通函数; 原代码注释太少,也不太清晰,给学习带来了一些不便,这里增加了注释; 优化了原代码的一些结构; 代码以及说明 本控件基于c# 首先准备 背景图片 共通函数 先创建共通函数 /************************************************************************* * 文件名称 :CommFunClass.cs