bitmap

How to draw the bitmap icon on title bar when Windows Aero theme is enabled

☆樱花仙子☆ 提交于 2019-12-31 02:56:11
问题 I'm developing a MFC application ( DWM library is not available ). I want to draw a bitmap functioning as a button on the title bar. However, the bitmap won't present when the Aero theme is enabled in Windows 7 (There are no problem when I disable the Aero theme). But my application still reactable by clicking on the position of the bitmap. Does anyone can teach me how to solve this problem? Thanks 回答1: Drawing custom data into the frame area with DWM is described on MSDN, also the hit

How do I create a dynamic mouse cursor .NET without using interop?

强颜欢笑 提交于 2019-12-31 01:45:59
问题 I have an application which I'm interested in eventually porting to mono so I'm trying to avoid using p/invoke's to accomplish this task. I would like to load a cursor dynamically, as in I have a Bitmap that is generated on the fly in the application. From what I can tell the safest way to do it without using p/invoke's is to create a .cur file which I can then load to a memory stream and use the Cursor(Stream) constructor. However I have no idea how to create a .cur file. I found this

Bitmap.SetPixel(x,y, Color) too slow

穿精又带淫゛_ 提交于 2019-12-31 00:57:08
问题 So currently I'm creating a 1000x1000 bitmap and it's spending about .3 seconds simply calling the Bitmap.SetPixel() function. I'm actually only drawing probably 50% of the pixels so it's more like 500,000 call to setpixel. While that does seem like a lot of calls, OTOH video games are do alot more and push many many more pixels (some of them procedureally generated). Obviously Bitmap.SetPixel isn't optimized for speed, but if I needed to update a bitmap 20-30 times a second to get decent

初冬太冷?圣诞无处可去?那跟我一起来学Android吧

*爱你&永不变心* 提交于 2019-12-30 23:55:28
又到年底了,每到这个时候,我们都会慢慢反思,这一年都做了什么?有什么进步?年初的计划都实现了吗?明年年初有跳槽的底气了吗?况且今年的互联网环境太差,需要自己有足够的知识储备,才能够应对这凌冽的寒风。 本文主要是整理了中高级安卓需要会的(或者说面试被频繁问到的内容),主要作为参考大纲,之后会陆续更新每个详细部分,供大家参考,互相学习。 面试板块(PDF版如下): BAT面试合集(Binder,组件化插件化,热修复,AOP,QQ换肤,虚拟机,https,线程池原理,音视频原理) 算法合集(Hash,KMP 等) 中小厂面试合集(内存泄漏,Handler,View,MVC.MVP.MVVM,) 大厂相关更新技术(Glide,数据库,NDK) 面试小知识(java小知识) 设计模式(设计模式原则和分类) 数据结构(数据结构等等) 网络编程(三次握手和四次握手,Volley,OKHttps,Retrofit) 源码解析(属性动画实现原理等) 多线程解析(线程同步,进程线程) 性能优化(Webview,内存泄漏和内存溢出等) ( 顺手留下GitHub链接,需要获取相关面试或者面试宝典核心笔记PDF等内容的可以自己去找 ) https://github.com/xiangjiana/Android-MS 一丶设计模式与使用场景 (如)建造者模式: 将一个复杂对象的构建与它的表示分离

WPF, C#: Draw a line onto existing bitmap in image control

时光毁灭记忆、已成空白 提交于 2019-12-30 23:33:49
问题 I have a bitmap image in an image control I need to draw a red line on the bitmap each time I click with the mouse onto it, at the place where I clicked the mouse. I first thought of creating a Line object, but found out, that I cannot add the Line. I would need a canvas. But if I put my image in a canvas, my bitmap does not stretch over the whole canvas (I found out, that the coordinates of the bitmap determine the place on the canvas, so my bitmap is wrongly displayed.) Then I tried using

WPF, C#: Draw a line onto existing bitmap in image control

十年热恋 提交于 2019-12-30 23:33:28
问题 I have a bitmap image in an image control I need to draw a red line on the bitmap each time I click with the mouse onto it, at the place where I clicked the mouse. I first thought of creating a Line object, but found out, that I cannot add the Line. I would need a canvas. But if I put my image in a canvas, my bitmap does not stretch over the whole canvas (I found out, that the coordinates of the bitmap determine the place on the canvas, so my bitmap is wrongly displayed.) Then I tried using

Android Convert view to BitMap

淺唱寂寞╮ 提交于 2019-12-30 12:39:16
问题 I'm trying to convert a view to bitmap but I lose the black color. I'm converting like this: Bitmap returnedBitmap = Bitmap.createBitmap(view.getWidth(),view.getHeight(), Bitmap.Config.ARGB_8888); Example How can i convert to bitmap so the black of the percentage value is not lost? Thanks, Regards 回答1: Hi you can use this method to convert View to Bitmap private Bitmap createBitmapFromView(Context context, View view) { DisplayMetrics displayMetrics = new DisplayMetrics(); ((Activity) context)

Load BitmapImage into WriteableBitmap but no method existing

倖福魔咒の 提交于 2019-12-30 12:23:26
问题 The constructor of WriteableBitmap class with Windows 8 only takes two arguments: the height and the width of this object. Meanwhile with Silverlight it accepts a BitmapImage object as argument. (Verified on MSDN : WriteableBitmap.WriteableBitmap constructor) I would like to load this BitmapImage because I'm trying to blur an image which already exists on my Assets folder. 回答1: Thanks for your help, I succeed to blur my image. Here is the sample in order to link the BitmapImage into the

Get bitmap info from MPEG-2 Program / Transport Stream?

£可爱£侵袭症+ 提交于 2019-12-30 11:33:47
问题 In order to render a DirectShow graph in my WPF application, I use a sample grabber to write a bitmap to memory, and read it elsewhere in code. This may seem as a wierd solution, but seems to be the only way to get a WPF brush out of it. The following code gives me the information I need about the bitmap: AMMediaType mt = grabber.GetConnectedMediaType(); VideoInfoHeader header = (VideoInfoHeader)Marshal.PtrToStructure(mt.formatPtr, typeof VideoInfoHeader); header.BmiHeader // ... Now, header

Creating 8bpp bitmap with GDI and saving it as a file

孤人 提交于 2019-12-30 11:28:27
问题 I have a perfectly working code that creates 32bpp bitmap and I need to change it so that 8bpp bitmap is created. Here's the piece of code that creates 32bpp bitmap, draws into it, then it creates a bitmap file and store it into the vector of bytes: // prepare bitmap: BYTE* bitmap_data = NULL; HDC hDC = GetDC(NULL); HDC memHDC = CreateCompatibleDC(hDC); BITMAPINFO bmi; memset(&bmi, 0, sizeof(BITMAPINFO)); bmi.bmiHeader.biSize = sizeof(BITMAPINFOHEADER); bmi.bmiHeader.biWidth = desiredWidth; /