bitmap

Android Bitmap save without transparent area

假如想象 提交于 2019-12-31 21:33:56
问题 I want to save bitmap without transparent area. Bitmap has large transparent pixel. So i want to remove that How can i do this? I cant add picture so explain with symbols. I dont want to crop function. I hope use filter ┌────────────────────────┐ │ transparent area │ ┌────────┐ │ crop this └────────┘ └────────────────────────┘ 回答1: To find the non-transparent area of your bitmap, iterate across the bitmap in x and y and find the min and max of the non-transparent region. Then crop the bitmap

Performing Overlap Detection of 2 Bitmaps

你。 提交于 2019-12-31 07:17:12
问题 I have a custom picturebox control that allows dragging 2 bitmaps separately on the Main image,thus allowing the user to select the location of the 2 bitmaps. For First Bitmap Point src = e.Location; PointF ratio = new PointF((float)src.X / ClientSize.Width, (float)src.Y / ClientSize.Height); LaunchOrigin.textratio = ratio; Point origin = new Point((int)(backupbit1.Width * ratio.X), (int)(backupbit1.Height * ratio.Y)); LaunchOrigin.textorigin = origin; point.X = src.X - origin.X; point.Y =

Differences between scaling images with dpi as opposed to dp

橙三吉。 提交于 2019-12-31 06:43:13
问题 I have all of the dpi drawable directories (are xxhdpi and xxxhdpi even necessary?) consisting of nine-patch bitmaps, the drawable resource file in the drawable directory that retrieves all of the scaled bitmaps, and I set the backgrounds of the Buttons with the drawable resource file... Now, my problem is that I also created "scaled" layout directories in terms of size (small, normal, and etc.), in which I tried to manually change the dp of the buttons as follows: Here's my xhdpi bitmap: ...

Rotate a bitmap in android about a point without animation of view

夙愿已清 提交于 2019-12-31 05:34:14
问题 I found some good resources for rotating a bitmap in android here and elsewher eon the net. I am close to getting my code to work but apparently I don't fully understand how the Matrix Translations work. The following is three main functions from my sprite class. THey worked great before I added things to facilitate the matrix rotation (namely in the onDraw I called the draw with just x,y and no matrix). I wrote some test code to add a sprite, and rotate it from 0 to 360 and back to 0 again

monochrome black-and-white bitmap

时间秒杀一切 提交于 2019-12-31 05:06:27
问题 I'm working on Android for converting a colored bitmap captured from the camera into a black-and-white monochromatic image (no grays!). I've got several methods for the gray scale conversion but I can't manage to get my image to a b&W format. Are there any methods for converting a bitmap into this format? 回答1: One solid way is a mean threshold bitmap. The method is described in this paper, in the method section. It's often used for image alignment, and will compensate for different brightness

C# winforms draw to bitmap invalid parameter

一曲冷凌霜 提交于 2019-12-31 05:06:26
问题 I have made an application, and i need the function drawbitmap to print my panel. When i push the button (btnUpdate) 12 times or more I get a parameter exception(invalid parameter)on this rule: panel1.DrawToBitmap(bmp1, new Rectangle(0, 0, 2480, 3508)); private void preview() { Bitmap bmp1 = new Bitmap(2480, 3508); panel1.DrawToBitmap(bmp1, new Rectangle(0, 0, 2480, 3508)); pictureBox2.Image = bmp1; } private void btnUpdate_Click(object sender, EventArgs e) { preview(); } Can someone help me

Loading image from cache using BitmapFactory.decodeStream() in Android

安稳与你 提交于 2019-12-31 04:39:09
问题 UPDATES : Even if i don't retrieve images from cache, i tried to retrieve via Drawable where i stored all the 18 images in the "drawable-mdpi" folder. Still, a blank screen was display. I was able to retrieved images from the server and save the image (.GIF) into the cache. However, when i need to load that image from cache, the image doesn't show up on screen. Here is the codes that does the work: File cacheDir = context.getCacheDir(); File cacheMap = new File(cacheDir, smallMapImageNames

How to add String on Bitmap Image in Android?

余生颓废 提交于 2019-12-31 04:13:27
问题 I want to add a string on bitmap image.I have a metod drawTextToBitmap ,this method working success place string on bitmap image.But my bitmap image is very small like pinmark image.This function set the string based on the bitmap height and width.I want to place the string exceed than the bitmap image.So Please help me to solve the problem. Following method i am using to get bitmap : public Bitmap drawTextToBitmap(Context gContext, int gResId, String gText) { Resources resources = gContext

C# 柱状图, 折线图, 扇形图

一个人想着一个人 提交于 2019-12-31 03:36:00
统计图形种类繁多, 有柱状图, 折线图, 扇形图等等, 而统计图形的绘制方法也有很多, 有Flash制作的统计图形, 有水晶报表生成统计图形, 有专门制图软件制作, 也有编程语言自己制作的;这里我们用就C# 制作三款最经典的统计图: 柱状图, 折线图和扇形图;既然是统计, 当然需要数据, 这里演示的数据存于Sql Server2000中, 三款统计图形都是动态生成. 其中柱状图我会附上制作步骤, 其他两款统计图直接附源码. 说明: 需求不一样, 统计图形绘制后的显示效果也不一样, 比如这里柱状图的主要需求是为了比较每一期报名人数与通过人数的差, 因此会把两根柱子放在一起会使比较结果一目了然. 因此大家可以根据需要灵活绘制. 一. 柱状图的绘制. 绘制步骤如下: 1. 定义绘图用到的类. 定义绘图类 int height = 500 , width = 700 ; Bitmap image = new Bitmap(width, height); Graphics g = Graphics.FromImage(image); Pen mypen = new Pen(brush, 1 ); 2. 绘制图框. 绘制图框 g.FillRectangle(Brushes.WhiteSmoke, 0 , 0 , width, height); 3. 绘制横向坐标线 绘制横向坐标线 for (

ImageView bitmap scale dimensions

十年热恋 提交于 2019-12-31 02:58:11
问题 I have a Bitmap that is larger than the ImageView that I'm putting it in. I have the ScaleType set to center_inside. How do I get the dimensions of the scaled down image? 回答1: Ok. I probably should have been clearer. I needed the height and width of the scaled Bitmap before it's ever drawn to the screen so that I could draw some overlays in the correct position. I knew the position of the overlays in the original Bitmap but not the scaled. I figured out some simple formulas to calculate where