gdi

in gdi, how to clear the background color of DC. so, the drawed text will show no background color.

when i draw text use DC, it always show an backgournd color which is diffrent from window's background. ...

how to fill gradient for roundrect in pure gdi (not gdi+)

just in pure gdi. thoughts or code are all welcome. ...

Draw Bitmap with alpha channel

I have a Format32bppArgb backbuffer, where I draw some lines: var g = Graphics.FromImage(bitmap); g.Clear(Color.FromArgb(0)); var rnd = new Random(); for (int i = 0; i < 5000; i++) { int x1 = rnd.Next(ClientRectangle.Left, ClientRectangle.Right); int y1 = rnd.Next(ClientRectangle.Top, ClientRectangle.Bottom); int x2 = rnd.Ne...

QT: QPainter + GDI in the same widget?

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 an...

How to get an BITMAP struct from a RenderTargetBitmap in C++/CLI?

I've got a WPF RenderTargetBitmap in C++/CLI and I want to be able to create a BITMAP structure from it to use with BitBlt. I've not worked with BITMAP or RenderTargetBitmap much before, so any thoughts would be great! ...

How can I overwrite a System.Drawing.Bitmap onto an existing GDI bitmap?

If I have a .Net Bitmap, I can create from it a GDI bitmap by calling the Bitmap's GetHbitmap() method. Bitmap bmp = new Bitmap(100, 100); IntPtr gdiBmp = bmp.GetHbitmap(); This works fine, but every time you call GetHbitmap, Windows has to allocate the new memory that the returned IntPtr references. What I'd like to do - if possib...

Win32: Is there a replacement GDI32.dll that uses hardware acceleration?

Has anyone out there created a version of GDI32.dll that takes advantage of hardware acceleration available on the machine? gdiplus.dll? Starting with Windows Vista, GDI is no longer hardware accelerated. (GDI+ was never hardware accelerated). Without Microsoft fixing GDI (and GDI+) to be able to run well on the computer: native applica...

How do I fix the alpha value after calling GDI text functions?

I have a application that uses the Aero glass effect, so each pixel has an alpha value in addition to red, green, and blue values. I have one custom-draw control that has a solid white background (alpha = 255). I would like to draw solid text on the control using the GDI text functions. However, these functions set the alpha value to ...

Runtime Drawing on window

I usually put my drawing in WM_PAINT to draw on screen but if you need to figure out this at runtime would you still use GDI drawing APIs? Example- //In WndProc case WM_PAINT: { hdc = GetWindowDC (hwnd) ; //draw here using hdc ReleaseDC (hwnd, hdc) ; } Instead of putting the drawing in WM_PAINT, can you draw using function...

Hiding Mouse Pointer on window Screen using GDI in c++

How to hide the mouse pointer on the window screen of GDI, kindly give me some hints. ...

When using DrawText, what does TextFormatFlags.Internal (a.k.a. DT_INTERNAL) do?

When using TextRenderer.DrawText(), what does setting the TextFormatFlags.Internal flag actually do? Equivalently, what does setting the DT_INTERNAL flag to Win32's DrawTextEx() function do? More to the point, when should I set that flag and when should I not set it? The documentation says: "Uses the system font to calculate text metr...

Compiler construction and DirectX

Hi! I am a beginner in the process of designing and coding a project, I already have all the ideas on my head, but I have a problem impeding me of continuing this project. I feel the code is ugly and unreadable and I cannot continue it this way. The project is a programming language I have on my mind, and it has small graphics capabilit...

Hooking extTextOut problems

Hi, I am working on a dll injection soft in c#, the injected dll is also in c# and i'am using pinvoke for certain system functions. When using extTextOut i get the string scrambled and the lines get mixed together What am i doing wrong? I hooked extTextOut using EasyHook from codeplex.com like this: try { ...

A library to port GDI code to DirectX/OpenGL?

I have some old MFC program using GDI heavily for drawing of texts and vectors. The program is scheduled to be rewritten in the future using DirectX/OpenGL. In the meantime, is there any library which acts as a simple wrapper that could replace GDI for one of these hardware accelerated APIs to improve performance? ...

Why would GDI+ colours vary based off whether a tooltip is visible?

I'm displaying a bitmap using GDI+. After loading the bitmap from a DLL resource I set the background colour (blue - #0000FF) to transparent using TransparentBlt. On Windows Vista and later this works as expected. However, on a Windows XP system we're testing on this only works when any tooltip (e.g. the "title" property in IE, or Win...

How to get the "real" colors when exporting a GDI drawing to bmp

Hi guys I'm developing a ASP.Net web handler that returns images making a in-memory System.Windows.Forms.Control and then exports the rendered control as a bitmap compressed to PNG, using the method DrawToBitmap(). The classes are fully working by now, except for a problem with the color assignment. By example, this is a Gauge generated...

Setting the pixel format of an existing Bitmap in GDI+

How do I set the PixelFormat property in a GDI+ Bitmap if I can't use one of the constructors that allow me to specify it? It looks like the PixelFormat property itself is read-only. ...

How does GDI+ support floating point values?

Given that GDI+ is a wrapper around GDI, how does it handle floating point values? I don't see any support for floating point co-ordinates in the GDI documentation. ...

Is it possible to duplicate a GDI handle?

Or in my particular case a windows region (HRGN)? Updated: The problems is the following: I've a collection of objects, each of these objects can hold a HRGN. These region once acquired is released when the object is destroyed. Since some of those objects are stored in a std::vector I've to define an assignement operator. Until now I...

Need Help Setting an Image with Transparent Background to Clipboard

I need help setting a transparent image to the clipboard. I keep getting "handle is invalid". Basically, I need a "second set of eyes" to look over the following code. (The complete working project at ftp://missico.net/ImageVisualizer.zip.) This is an image Debug Visualizer class library, but I made the included project to run as an exe...