bitmap

Copy Screen Object to Bitmap File

荒凉一梦 提交于 2019-12-28 00:35:10
This is not a big deal, but it is worth to share for everyone. 1 private void copyScreen( string filename) 2 { 3 Bitmap bmp = new Bitmap( this .Width, this .Height); 4 Graphics gBmp = Graphics.FromImage(bmp); 5 IntPtr gBmpHdc = gBmp.GetHdc(); 6 IntPtr srcHdc = Win32Api.GetWindowDC( this .Handle); 7 Win32Api.BitBlt(gBmpHdc, 0 , 0 , this .Width, this .Height, 8 srcHdc, 0 , 0 , 9 Win32Api.SRCCOPY); 10 Win32Api.ReleaseDC( this .Handle, srcHdc); 11 12 bmp.Save(filename, System.Drawing.Imaging.ImageFormat.Bmp); 13 14 gBmp.ReleaseHdc(gBmpHdc); 15 16 gBmp.Dispose(); 17 18 bmp.Dispose(); 19 20 } 21 I

Save and retrieve image (binary) from SQL Server using Entity Framework 6

倖福魔咒の 提交于 2019-12-27 11:01:28
问题 I am trying to save a bitmap image to database Bitmap map = new Bitmap(pictureBoxMetroMap.Size.Width, pictureBoxMetroMap.Size.Height); I created a column imgcontent in the database with datatype binary but my problem is how can I convert this bitmap (map) to binary data? And how can I retrieve data from database? I googled it and I found something like this but it didn't work: byte[] arr; ImageConverter converter = new ImageConverter(); arr = (byte[])converter.ConvertTo(map, typeof(byte[]));

Save and retrieve image (binary) from SQL Server using Entity Framework 6

醉酒当歌 提交于 2019-12-27 11:01:12
问题 I am trying to save a bitmap image to database Bitmap map = new Bitmap(pictureBoxMetroMap.Size.Width, pictureBoxMetroMap.Size.Height); I created a column imgcontent in the database with datatype binary but my problem is how can I convert this bitmap (map) to binary data? And how can I retrieve data from database? I googled it and I found something like this but it didn't work: byte[] arr; ImageConverter converter = new ImageConverter(); arr = (byte[])converter.ConvertTo(map, typeof(byte[]));

MFC更换背景(基于对话框)

你说的曾经没有我的故事 提交于 2019-12-27 03:41:24
最近为了赶实验自学了一点点点点的mfc,然后也是去百度了很多用于修改一些小细节的东西,先来说说怎么更换基于对话框的背景。我用的是VC++6.0,比较老了,但是实验需要,我就下着了。 步入主题吧! 1、首先你要把你想要的背景图片放在建立的对象文件夹中的res文件夹 2、而且要注意的是,这个图片格式不可以是.jpg的哦,可以用画图软件打开,然后保存的时候保存为.bmp格式,而且不能是24位的,我保存的是256色的,但是还是失真了啊,有一点点的不好看呢~ 3、VC++菜单栏的“插入”按钮,然后选择“资源”,选择第二个“Bitmap”,点击 引入 4、找到xxxxDlg.cpp打开,找到…onpaint的代码块,有if()else(),然后把else语句块里面内容改为以下代码: //CDialog::OnPaint();//要禁止这个调用 CPaintDC dc(this); CRect rect; GetClientRect(&rect); CDC dcMem; dcMem.CreateCompatibleDC(&dc); CBitmap bmpBackground; bmpBackground.LoadBitmap(IDB_BITMAP2); //IDB_Bg为刚刚载入的图片对应的ID BITMAP bitmap; bmpBackground.GetBitmap(&bitmap);

Image optimization like whatsapp and instagram in ios and android

我们两清 提交于 2019-12-25 19:30:21
问题 Task :- optimize image like Facebook and WhatApp does? Upload image to server with optimize size in android and ios without losing image quality and dimension. I have seen many code like native image compression (UIImageJPEGRepresentation(viewImage, 0.8)) but I am not able to get proper result. Can someone suggest me any algorithm or library in iOS and android through which we can optimise the image without losing quality. Links I already visited: iOS What's the easiest way to resize/optimize

how to avoid OUtOfMemory problems with create Bitmap

梦想的初衷 提交于 2019-12-25 19:05:14
问题 I'm trying to create a bitmap from a view with this code : public Bitmap getmyBitmap(View v) { Bitmap b = Bitmap.createBitmap(v.getWidth(), v.getHeight(), Bitmap.Config.ARGB_8888); Canvas c = new Canvas(b); v.draw(c); return b; } But I have an Out Of Memory problems. I can fix it by adding this option to the Manifest file android:largeHeap="true" which is not recommended !! I'm thinking about the recycle of the view ,could be a solution? this is the printStack: 11-25 15:31:46.556 2115-2115

Bitmap hittesting in AS3

£可爱£侵袭症+ 提交于 2019-12-25 18:59:13
问题 I'm building a 16 bit game for my final project and have completed all the objects and environments, I exported all the images as png files into flash as well as my character, breaking the environment up into background, objects and foreground. I can't however find a simple tutorial explaining how to do bitmap hit testing or another simple way of making my character not be able to move into the objects. Could someone recommend a simple tutorial or an alternative method of achieving this ?

LockBits seems to result in wrong stride when copying byte array to bitmap

谁说胖子不能爱 提交于 2019-12-25 18:45:41
问题 I'm trying to copy a simple byte array to an 8bit indexed bitmap. Using the exact same code as shown in countless answered questions on many forums, I still get the wrong result. The data I'm trying to write to image files is 360 bytes, setup as an 18x20 byte linear array. That is, the first 18 bytes (0-17) belong on the top row of the image, the next 18 bytes (18-35) belong on the 2nd row, etc. I have confirmed that this data is correct, as I can manually parse it in Excel (and even

Use Bitmap Caching the correct way

不羁岁月 提交于 2019-12-25 18:23:27
问题 Care: No code here, only text and some questions about bitmap caching I'm currently developing an App which is almost finished. The only thing left, that I would like to do is caching images. Because, at the moment, when the user opens the app the app downloads images from a server. Those images are not static, that means they can change every minute/hour/day. I don't know when they change, because it's a list of images gathered by the amount of twitter shares, facebook likes etc. That means,

Circle of light ontop of bitmap - Android

为君一笑 提交于 2019-12-25 16:39:21
问题 I'm trying to create a torch item in my game, that will light bitmaps\bitmap that are behind him in a circle shape (for example torch in terraria), so basically I'm trying to understand how to create a bright circle. example picture made in photoshop: http://puu.sh/evqet/4277f7e2c8.png anyone has idea how can I do that? 回答1: There many ways to achieve this. One (fast) is to use the HSL color space and increase the L parameter foe example. I don't know if you are working with RGB if there is