gdi+

Zooming to a point in c#

I am attempting to write a custom scrollable c# control that zooms to a particular point on an image. The problem that I am facing is that when double buffering is enabled, the image seems to jerk towards the top left corner and then zooms properly to the point where the mouse was clicked. This seems to only happen when I set the AutoScr...

Using GDI+ Bitmap

Hi I am using GDI+ Bitmap class to convert an IStream to HBITMAP. I have included the gliplus lib file in the Linker inputs and also have the dll in the build path. But using the statement Bitmap bm(lpStream,FALSE); gives me an error C2065: 'Bitmap' : undeclared identifier Can someone please tell me what I am doing wrong here. Tha...

GDI+ exception saving a Bitmap to a MemoryStream.

I have a problem in a Windows Forms application with Bitmap.Save failing when I save to a MemoryStream. The problem only seems to occur intermittently on one machine (so far) and the bad news it is at a customer site. I can't debug on the machine, but I got a stack trace that narrowed the problem down to a single line of code. Here's ...

Using custom TTF font for Image rendering

I am using Gdi+ on the server-side to create an image which is streamed to the user's browser. None of the standard fonts fit my requirements and so I want to load a TrueType font and use this font for drawing my strings to the graphics object: using (var backgroundImage = new Bitmap(backgroundPath)) using (var avatarImage = new...

Using char array properly in vc++

Hi I am trying to convert an IStream to HBITMAP using the GDI+ Bitmap class. The IStream object is being populated by using data from a web service. I am reading the data in parts and appending it to an object to be used later with the Bitmap class. Here is the relevant part of the code char data1[] = ""; int offset = 0; LPTSTR...

VB.NET Custom Control (custom drawing) Refresh Problem

Hi, i've created a simple solution with 2 projects. The 1st project (class library) contains a custom control called Container which draws itself with rounded corners. The 2nd project (windows forms) is a test application. If I add a Container instance to main Form in the 2nd project it shows the rounded corners nicely. Also when I run...

Non-Affine image transformations in .NET

Are there any classes, methods in the .NET library, or any algorithms in general, to perform non-affine transformations? (i.e. transformations that involve more than just rotation, scale, translation and shear) e.g.: Is there another term for non-affine transformations? ...

Effective way of making negative of image without external dlls

Hello, That is the solution to make a negative from a image in C# Windows Forms without any dlls and in a effective, fast way? ...

.Net equivalent for ScaleHeight and Scalewidth

Basically what I am trying to do is make my drawing job easier. Back in the days of VB6 there was something called Scalewidth and Scaleheight and I could set them to custom values. Ex. 100. Then when I needed to draw a point at the center of the available space i would just draw it at 50,50. Is there any way in .Net that I can get si...

Using Lockbits to search for black pixels, but does this randomly?

Hi, I got a problem with Lockbits. I'm searching black pixels, and because it does not seem right, I'm using a WindowPopup to print the colors of every pixel, but it's like my program is using another picture. I marked the first found black pixel red. As you can see there are several other pixels that should match too. What am I doin...

c# Drawing a Line with a gradient colour?

Is it possible to draw a line using a graduated colour? I want to be able to draw a stright or a curved line (if possible) where one end of the line is Blue and the other Red. Further There might be a beed to have more than one gradient per-line e.g the colour going from blue -> green -> red. Im thinking that this might just consist ...

How to deal with ColorMatrix overflows?

Before I start here, I am using C#. I would like to do some transforms using the ColorMatrix class. The problem is that sometimes an overflow occurs for r, g, or b. Instead of clamping the value at 255, the matrix loops around and starts again at 0. This means that, for images which should appear all white, they begin to turn black a...

Cannot render image to HttpContext.Response.OutputStream

Basically I am trying to render a simple image in an ASP.NET handler: public void ProcessRequest (HttpContext context) { Bitmap image = new Bitmap(16, 16); Graphics graph = Graphics.FromImage(image); graph.FillEllipse(Brushes.Green, 0, 0, 16, 16); context.Response.ContentType = "image/png"; image.Save(context.Respo...

Loading GIF freezing sometimes

I'm trying to use a loading overlay on top of a Windows form that adds a 50% opaque layer on top of a windows form with a loading GIF, while it does what it needs to do in a background thread. The overlay is a windows form that I'm drawing in the onPaint event. The loading overlay works fine on multiple different form loads, but fails ...

Equivalent of MM_ISOTROPIC mapping mode in Gdi+

I have some C++/GDI drawing code that uses the isotropic mapping mode. I have a large object model with lots of drawing code that I'm trying to reuse in a C# project to draw to an in memory bitmap. I'm having problems setting up the System.Graphics object properly to produce the same picture. Is there any way of setting up the equival...

How to copy one Graphics Object into another

I am trying to copy the contents of one graphics object to another, but the only was i have been able to find is based on using GDI32.DLL, which i would rather avoid using if possible. Does anyone know how/if this is possible using managed code? I dont mind if answers are in C# or VB.Net. Here is waht i currently have: Private Sub Co...

What's the relationship between WIC and GDI+?

I'm fuzzy on the relationship between Windows Imaging Component (WIC) and GDI+. I've done some work in the past that showed that, for example, WIC produces visually superior GIF encodings, but I'm surprised I don't see more people using it for image processing vs. GDI+. I know it doesn't have GDI+'s draw operations, but for encoding/de...

GDIPlus.dll Access violation error

I am getting an access violation error stating "Access Violation at address 4EC842CD in module gdiplus.dll". Language Used : - Delphi 10, Borland Studio 2006 Environment: - Windows XP I am having an application in which I am using File Open dialog in Delphi which facilitates users to open some type of files from any location of their sys...

PdfSharp, GDI+ and HTML printing

I currently have a "PrintingWebService" that I call from an AJAX page with all the information that is needed to construct a highly customized PDF printout using PDF Sharp and the PDFSharp's GDI+ mode, which takes DrawString and other commands that work basically just like GDI+ only they are drawn to the PDF. I then save the PDF file to...

Gdiplus 64bit colors

I am creating a 64bit bitmap and wrapping it using Graphics object to draw over it. Problem is Gdiplus Color class is only 32bit(each component is byte only i.e.max 255) so how can I draw over a 64bit image using gdiplus? e.g. Bitmap bmp(100, 100, PixelFormat64bppARGB); Graphics g(&bmp); //how do I draw a red line now, if i use Color(2...