gdi+

How to Set this Kind of Perspective Transform in Matrix3D?

I have an image with and have a few values to make it a perspective in Silverlight, but can't quite figure out what I need to do mathmatically to make it happen. The most important thing is I have an angle called a "Field of View" (FOV). This is the normal picture: For example: X = 30° X = 30° X = 30° ...

How to rotate monochrome images in GDI+

I am trying to rotate a monochrome Bitmap in GDI+ using RotateFlip method. When i try to rotate it by 90/270 I get a wrong image or the application crashes. But when I try to rotate it by 180 degrees it works fine. Hence I am now rotating all monochrome bitmaps twice through 180 and then rotating it again by the angle required. Is this ...

Update a rectangular region in a drawing.

I paint a drawing on a drawing area. In order to optimize the performance of that drawing I decided to redraw only inside the really necessary region(clipping region). See the picture. The problem is that I don't arrive to build a method(GetBitmapFromRectangle) that returns me the result of intersection of my paths with the clipping r...

How can i use GDI+ to save a HBITMAP

I want to save my created image as a PNG or JPEG file with the help of GDI+ but i can't find a way to do this. Seems that there is no way to create a non file based Image and fill it with a bitblit from the HBITMAP. Or do i miss something? ...

Matrix TransformPoints vs TransformVectors

What is, in a "for dummies" interpretation, the difference between System.Drawing.Drawing2D.Matrix TransformPoints(pointsArray) <==> TransformVectors(pointsArray) ? Edit: there is also a VectorTransformPoints(...) method, by the way... :) ...

FNT font file in C#

Hi all, I would like to know if I can use FNT font file in c# .net. FNTs are not windows font file. If such fonts are available, can you please tell me how to load it and change windows form font to FNT? I use .Net GDI+ technology, but please let me know if WPF is better for this. Thanks, ...

Is there an easy way to display bitmap fonts (like .fon) in C#

Currently I am implementing a graphic editor project using C#, my project should to have ability to display bitmap font. I plan to write a COM component in VC++ and send bitmap font as bitmap array to C# and implement a string render class. However my project leader thinks that the method will take to much time and want a easier solution...

Drawing on a panel in the constructor of a form

I have the following sample code, which I expect to color the panel on the form red as soon as it loads: public partial class Form1 : Form { public Form1() { InitializeComponent(); drawstuff(); } public void drawstuff() { using (Graphics g = panel1.CreateGraphics()) { g.C...

C# - Crop Transparent/White space

I'm trying to remove all white or transparent pixels from an image, leaving the actual image (cropped). I've tried a few solutions, but none seem to work. Any suggestions or am I going to spend the night writing image cropping code? ...

how to draw an image on a canvas with transparency/alpha

hy there! i left out usings etc... just plain code: var image = Image.FromFile(/* my magic source */); var bitmap = new Bitmap(image.Width, image.Height); var canvas = Graphics.FromImage(bitmap); var brush = new SolidBrush(/* my magic color */); canvas.FillRectangle(brush, 0, 0, image.Width, image.Height); canvas.DrawImage(image, new R...

Getting an Image object from a byte array

I've got a byte array for an image (stored in the database). I want to create an Image object, create several Images of different sizes and store them back in the database (save it back to a byte array). I'm not worried about the database part, or the resizing. But is there an easy way to load an Image object without saving the file t...

Paint background only once.

I have a drawing graph on a panel. The drawing has 2 components: "background" Grid and "foreground" graph. The user can move the graph lines, but the background remains static (for a selected time interval). Re-drawing the background is a little expensive. Is there a way to keep the background "intact" and redraw the "foreground" graph ...

Graphics object not flushing correctly

I have a Bitmap called "buffer" to which I Paint another image (using DrawImage) Paint a partially transparent gradient (using a LinearGradientBrush) I call Flush(FlushIntention.Sync) on the buffer's Graphics object after each of those steps. I then paint the contents of the buffer onto an on-screen control. However, while debugging...

VB.NET ComboBox - Need to force a redraw when a key is pressed when it is dropped down.

I am using a DrawItem and MeasureItem events to paint a combobox with a DrawMode of OwnerDrawVariable. Basically, I'm trying to have the user highlight a selection with the mouse, and then press the space bar to toggle the Save status of a song list. Then I call the Me.Refresh() event for the form in an attempt to redraw the form and t...

PictureBox Drawing Coordinates Relative to Form

I have a PictureBox on a form. In Load event of the form I create graphics as follows: imageGraphics = Graphics.FromImage(PictureBox1.Image) Then, in PictureBox_MouseMove event I draw ellipse: imageGraphics.FillEllipse(New SolidBrush(brushColor), e.X, e.Y, brushWidth, brushWidth) No matter what I try, it always draws on incorrect ...

Huge Whitespace exists to right after drawing image. Want to get rid of it.

I'm using the following codeproject to build an asp.net website and so far everything is good. My only problem is after the barcode is generated, a huge whitespace exist to the right of the barcode. I've been playing with this and am unable to resolve it. Details below: Link to Code Project Article: http://www.codeproject.com/KB/aspn...

How to change colors of a GDI+ LinearGradientBrush?

I have to write several small vertical gradients (on a loop) and so I think it's faster to re-use an existing LinearGradientBrush (correct?) But this isn't what I expected to happen... Drawing2D.LinearGradientBrush myBrush = new Drawing2D.LinearGradientBrush(new Rectangle(0, 0, 200, 200), Color.Red, Color.Black, Drawing2D.LinearGradi...

BitBlt + UpdateLayeredWindow and CreateDIBSection in 16-bit desktop color depth

Hello there! I have an application with transparent background in client area which is drawn black because the window is not layered. In each of it's WM_PAINT messages I am doing a BitBlt to a memory-DC, after that I use the memory-DC with UpdateLayeredWindow to a layered canvas window. setup of memory-DC: HDC hdcMemory = CreateCompat...

A generic error occurred in GDI+, possible server.mappath issue

I've narrowed down the issue I'm having to this block of code, where I am resizing an uploaded image and saving it. This works fine on my local machine, but when I run the site on the server, I get a generic GDI+ error that's coming from the "thumbnail.Save" call. if(fup_displayPicUpload.HasFile) { string ima...

How to using gdi+ to write Exif info into a exist image file in C++ windows?

How to using gdi+ to write Exif info into a exist image file in C++ windows? I get a part of code in the following way, however I think most of the following code is not necessary: BOOL bRet = FALSE; CString cstrFormat = TransferImageFormatToString(eFormat); if ( !cstrFormat.IsEmpty() ) { CLSID clsid; int fd = _open(CSTRI...