gdi+

Font problems with GDI+

I'm having trouble with some ttf fonts not working in GDI+. I cannot seem to find any differences between some of the working and non working fonts. Some can be read and rendered without a problem. For some fonts GDI+ just reports the file as missing (which it is not). Something must be wrong with the format but I cannot for the life of ...

.net onpaint vertical sync

I'm trying to implement some animation using winforms and gdi+, but I get a lot of tearing moving sprites inside a control. Is there a way in managed .net to have the overriden Control.OnPaint method wait for the vertical retrace of the monitor? ...

Are there any performance tests available re Direct2D?

I'm particularly interested in drawing primitives performance (CAD, GIS, etc.) but any speed comparison with GDI/GDI+ would be very interesting. ...

Where Can I Find Current Adobe Image Format Specifications? "Clipping Paths"

This is in regards to Adobe's Image Resource Blocks(IRB), that they store in TIFF, PSD, JPEG Formats. It's also called "8BIM", This standard was released with Adobe's Photoshop 3 (November 1994). IRB contains information on color profiles and clipping paths(what i am interested in). The only piece of documentation i can find on the int...

Antialiased SmoothingMode distorts Dashed Pen

Why does switching on anti-aliasing interfere with my dashed pen? ...

Winforms: SuspendLayout/ResumeLayout is not enough?

Hi, I have a library of a few "custom controls". Essentially we have our own buttons, rounder corner panels, and a few groupboxes with some custom paint. Despite the "math" in the OnPaint methods, the controls are pretty standard. Most of the time, all we do is draw the rounded corners and add gradient to the background. We use GDI+ for ...

how to clone a solidbrush in GDI+ C++

I am using gdi+ and c++. I have a question about SolidBrush. How To clone a SolidBrush? SolidBrush* oldBrush xxx; Brush* newBrush = oldBrush->Clone(); I found newBrush is a Brush Object. Which mean if I use dynamic_cast<SolidBrush>(newBursh), I will always get NULL. I read the .h file of gdi+ SolidBrush seems used Brush's virtual Clo...

Reset Scale in a GDI+ Transformation Matrix

I'm writing a function to draw UI handles (rotate, resize and so on) in my client area in a Windows Forms application. The function is called when an object is selected. The caller sends me a Graphics object properly rotated, scaled and translated to fit into the larger scheme of things (the selected object has its own rotation/translat...

Blanket Alpha Component in GDI+

Is there a way I can set an Alpha value that affects all subsequent GDI/GDI+ calls? in other words, I am looking to set the transparency for all calls on a Graphics object. (I'm looking for something similar to how the *Transform functions affect the Graphics object they are called on) ...

What events can I use in order to notify a control that part of it has left the viewable area of the screen?

Hi, I have a userControl I'm doing some Painting to, and when the control is moved to the edge of the screen, or moved so that the Vista Taskbar overlaps it, the screen edge/taskbar edge is being drawn to the control, leaving ugly lines over the paintable area of the control. What is the best way to detect this and call Invalidate on th...

Why can't I stretchBlt a dc onto another dc?

Why can't the following code draw the content of graphics onto finalDC? It just draw black rectangle; Bitmap* bitmapCanvasCore = new Bitmap(width, height ,PixelFormat24bppRGB); xxxxxx // operation on bitmapCanvasCore... Graphics * canvasGraphics = new Graphics(bitmapCanvasCore); HDC tempdc = m_UnSelectedGraphics->GetHDC(); ::SetStretchB...

In GDI+, how does Bitmap::LockBits work?

Hi, I am trying to implement as small a subset of GDI+ as possible in order to port an application (written in C++) from Windows to Linux. Right now I am having a problem to understand how Bitmap::LockBits is supposed to work. According to MSDN, it has a signature like this: Status LockBits( const Rect *rect, UINT flags, ...

c# external Exception in GDI+

I want to run this piece of code Bitmap grayImage = (Bitmap)img.Clone(); for (int x = 0; x < arr.GetLength(0); x++) { for (int y = 0; y < arr.GetLength(1); y++) { int col = arr[x, y]; Color grau = Color.FromArgb(col, col, col); grayImage.Set...

image processing techniques - direct manipulation of destination image or virtualized?

i need to re-project a series of ariel images that have been referenced in a geographical coordinate system into a UTM projection. I had read that using getPixel and setPixel might be slow - should set up a series of 2 dimensional arrays for intermediate access and then flush the values to the destination image when I am done. Is this ...

How can I create GDI Leaks in Windows Forms!

I am investigating a GDI resource leak in a large application. In order to further my understanding of how these problems occur, I have created a very small application which I have deliberately made 'leaky'. Here is a simple user control which should result in the creation of 100 Pen objects: public partial class TestControl : UserCon...

GDI+ DashStyle throws OutOfMemoryException in .NET

I'm using DashStyle.Dash while rendering my hierarchy of objects. My application uses Graphics.Transform extensively and I find that at some scale values (including a scale of 100%) and some angles of rotation, Graphics.DrawLine throws OutOfMemoryException when using a pen with DashStyle.Dash. Using Google I found that this is a well-kno...

What is the best way to create a realistic highlighter in .NET (using GDI+)?

How can i create a realistic highlighter (simulating a real world highlighter pen) in .NET using GDI+? It is meant to be used on a graphics object not on selectable text. Using a transparent brush (with alpha channel) doesn't do the job since everything below the area covered by the brush gets "fuzzy", and i would like the "foreground" ...

GdiPlus OverflowException

I've been encountering an OverflowException recently within GDI+ via a 3rd party tool which is causing me a few problems. I'm trying to track down the cause of this, and then decide if there is any resolution for the problem. The error is occuring in SafeNativeMethods.Gdip.GdipFillPath() returning an error code of 11 which is equal to G...

Unsafe Per Pixel access, 30ms access for 1756000 pixels

So I've been sharing some thoughts on the above topic title on my website about fast, unsafe pixel access. A gentlemen gave me a rough example of how he'd do it in C++, but that doesn't help me in C# unless I can interop it, and the interop is fast as well. I had found a class in the internet that was written using MSDN help, to unsafely...

How can I tell if a point belongs to a certain line?

How can I tell if a point belongs to a certain line? Examples are appreciated, if possible. ...