gdi

Is it possible to BitBlt directly from a GDI+ bitmap?

匿名 (未验证) 提交于 2019-12-03 02:50:02
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试): 由 翻译 强力驱动 问题: Is it possible to use BitBlt to copy directly out of a GDI+ bitmap without using GetHBitmap? GetHBitmap is slow because it makes a new copy of the whole image, in addition to and slower than the BitBlt copy, and the given HBITMAP must be disposed. The image is large. Is there a way to point BitBlt to use the pixel data of the original GDI+ image? EDIT: I can get a pointer to where the GDI+ bitmap pixel data is in the memory. Can I create an HBITMAP that points to the GDI+ bitmap pixel data to avoid the extra copy, and BitBlt from

Qt: QPainter + GDI in the same widget?

匿名 (未验证) 提交于 2019-12-03 02:35:01
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试): 问题: I'm trying to use the method described here to use a QPainter and GDI calls on the same widget. Unfortunately this tutorial seem to have been written on an earlier version of Qt and now it does not work. I set the WA_PaintOnScreen flag and reimplement paintEngine() to return NULL. Then on the paintEvent() I create a QPainter, use it and then use some GDI calls to paint a bitmap. The GDI calls work fine but the QPainter does nothing. I get the following error on the console: QPainter::begin: Paint device returned engine == 0, type: 1 Is this

Command to get GDI handle count from a crash dump

匿名 (未验证) 提交于 2019-12-03 02:28:01
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试): 由 翻译 强力驱动 问题: I have a crash dump and I suspect GDI leaks to be a cause of the crash From the full crash dump is there anyway to find out the number of GDI handles used by my process when it crashed? 回答1: It is unlikely since the only debugger extension gdikdx.dll tailored at gdi tasks is not actively maintained since the w2k version and i believe they stopped shipping it since not that many folks are into hacking into gdi internals - according to someone's statement i stumbled upon in a newsgroup - therefore it is no longer invested into. You

Why not use GDI to repeatedly fill a window with RGB data from an array?

六月ゝ 毕业季﹏ 提交于 2019-12-03 01:55:35
This is a follow-up to this question . I'm currently writing a simple game and am looking for the fastest way to (repeatedly) display an array of RGB data in a Win32 window, without flickering or other artifacts. Several different approaches were recommended in the answers to the previous question, but there was no consensus on which would be the fastest. So, I threw together a test program. The code simply displays a framebuffer on the screen repeatedly, as fast as possible. These are the results I obtained, for 32-bit data running in a 32-bit video mode - they may surprise some people: -

image.save method is not save image GDI+ error occured

匿名 (未验证) 提交于 2019-12-03 01:45:01
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试): 问题: string ServerUploadFolder = HttpContext.Current.Server.MapPath("~/Uploads/" + value.PhysicalFileName); MultipartFormDataStreamProvider streamProvider = new MultipartFormDataStreamProvider(ServerUploadFolder); Image img = Image.FromFile(ServerUploadFolder); var bmp = new Bitmap(img.Width, img.Height); using (Graphics gfx = Graphics.FromImage(bmp)) { gfx.Clear(Color.White); gfx.DrawImage(img, 0, 0, img.Width, img.Height); } bmp.RotateFlip(RotateFlipType.Rotate90FlipNone); string imagePath = value.FileUrl.Replace(Path.GetFileName(value.FileUrl)

GDI rendering to direct2D ID2D1BitmapRenderTarget is always transparent

匿名 (未验证) 提交于 2019-12-03 01:34:02
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试): 问题: I want to port my movie rendering software from DirectDraw to Direct2D. Because of compatibility issues, GDI rendering needs to be done on top of the image. To optimize performance I want to implement some kind of backbuffer mechanism, but there seems to be a problem with the alpha channel information, all GDI drawing appears somehow transparent . I create a ID2D1HwndRenderTarget for my window handle and and a ID2D1Bitmap to copy the images to. The pixelformat of the bitmap is DXGI_FORMAT_B8G8R8A8_UNORM , the alpha mode is D2D1_ALPHA_MODE

gdi+ Graphics::DrawImage really slow~~

匿名 (未验证) 提交于 2019-12-03 01:18:02
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试): 问题: I am using a GDI+ Graphic to draw a 4000*3000 image to screen, but it is really slow. It takes about 300ms. I wish it just occupy less than 10ms. Bitmap *bitmap = Bitmap::FromFile("XXXX",...); //-------------------------------------------- // this part takes about 300ms, terrible! int width = bitmap->GetWidth(); int height = bitmap->GetHeight(); DrawImage(bitmap,0,0,width,height); //------------------------------------------ I cannot use CachedBitmap, because I want to edit the bitmap later. How can I improve it? Or is any thing wrong? This

A generic error occurred in GDI+ at System.Drawing.Image.Save

匿名 (未验证) 提交于 2019-12-03 01:14:02
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试): 问题: Exception: A generic error occurred in GDI+. at System.Drawing.Image.Save(String filename, ImageCodecInfo encoder, EncoderParameters encoderParams) at System.Drawing.Image.Save(String filename, ImageFormat format) at System.Drawing.Image.Save(String filename) Code: byte[] bitmapData = new byte[imageText.Length]; MemoryStream streamBitmap; bitmapData = Convert.FromBase64String(imageText); streamBitmap = new MemoryStream(bitmapData); System.Drawing.Image img = Image.FromStream(streamBitmap); img.Save(path); We convert a base64 string into a

How to get the exact text margins used by TextRenderer

不羁岁月 提交于 2019-12-03 01:09:43
System.Windows.Forms.TextRenderer.DrawText method renders formatted text with or without left and right padding depending on the value of the flags parameter: TextFormatFlags.NoPadding - fits the text tightly into the bounding box, TextFormatFlags.GlyphOverhangPadding - adds some left and right margins, TextFormatFlags.LeftAndRightPadding - adds even bigger margins. Now, my question is how can I get the exact amount of padding (left and right) added by DrawText to the text for a given device context, string, font etc? I've dug into .NET 4 with .NET Reflector and found that TextRenderer

About GDI/GDI+ coordinate compatibility?

人走茶凉 提交于 2019-12-02 22:40:33
I have a problem while drawing with both GDI and GDI+ interchangeably. The page transformation—in particular scaling—seems to be a little bit off between the two. Which properties of the GDI context affects the scaling of the output other than SetViewportExt and SetWindowExt ? The code uses almost exclusively GDI for its drawing, but uses GDI+ in a few cases where its features (semitransparency) are needed. It uses SetViewportExt , SetWindowExt and SetViewportOrg to enable zooming and scrolling. When GDI+ is needed I construct a Gdiplus::Graphics object around the HDC and do the drawing. I