gdi+

PHP: How to draw an image over another image?

I am using PHP & GD library. I want to draw an image (say this one: http://www.gravatar.com/avatar/107f2fafb2d29fedc3783b141139a878?s=128&d=identicon&r=PG) over another image: http://www.geekpedia.com/gallery/fullsize/simplistic-windows-wallpaper.jpg at specified coordinates (top-left or top-right or anywhere in the image). How...

Drawing dashed borders

Imagine you are drawing a map of county borders. You are given a set of polygons, one for each boundary, and you draw each polygon. In places where two counties share a border you just end up drawing the border twice. In the absence of partial transparency effects, and with a solid pen, this is no problem. But, on maps, borders of this...

ASP.NET creating thumbails server side

It look desceptively easy to use System.Drawing to create thumbnails in your ASP.NET application. But MSDN tells you: Classes within the System.Drawing namespace are not supported for use within a Windows or ASP.NET service. Attempting to use these classes from within one of these application types may produce unexpected problems, s...

Stop LinearGradientBrush repeating

I'm trying to figure out how to stop LinearGradientBrush to repeat along with shape I'm drawing. So, for example I created gradient with height equal to 50, but next I draw rectangle with height equal to 150. In that case gradient will repeat itself three times. But I'd like to draw only first gradient and draw nothing for the rest of re...

How to paint a precise Gradient with LinearGradientBrush in C#?

Hi, I'm painting this object in C# using GDI and I need to have precise pixel painting. However, this is not working... I don't know if it matters but the object I'm painting is a ToolStrip, I'm doing a custom ToolStrip render. I drew a horizontal blue line at y-pixel 1, than a yellow one at y-pixel 2 than a red one at y-pixel 3. These...

Drawing Transparent Plane with holes in GDI+

I need to draw a transparent plane over a User control in my DotNET 2.0 app. That much is easy at least. The hard bit is that I need some (potentially overlapping) holes in this plane. Shape and size of the holes is not known at compile-time. I tried to approach this with Region and excluding a bunch of GraphicPaths from it. This works ...

GDI+ drawing in 200% DPI, will come to incorrect background

GDI+ drawing in 200% DPI (192 pixel), will come to incorrect background. In this case, the dialog is bigger than my screen. The right part of the dialog can not display when the app starts up. when I drag the dialog to the center of the screen, and see that the right part of the background image is the center part of the dialog's parent...

C# GDI+ - Remove just above bottom half of ellipse on gloss method

Hello all, I have a gloss method and I'm trying to get a inverted half moon like effect. On the below code I'd like to remove just above bottom half of this ellipse and then draw it. Does anyone know how I might begin to do that? PS. The gloss is also turning out too white. I've tried messing with the alpha to no avail, does anyone know...

How do I convert a Graphics object to a Bitmap object, inside PrintPage event?

This is the high level problem I'm trying to solve... I have a 3rd party plotting/graphing (IoComp Plot), and I want to embed a high quality (at least 600 dpi) bitmap of the Plot control in reports created by another 3rd party report package (Combit List & Label). This is the approach that seems most promising so far... ---Edit---: ...

Slice up an image into tiles

Given a loaded Bitmap object. I want to slice up this image into 256x256 tiles and save out each tile as a jpg file. You may think this as a Silverlight Deep Zoom sort task and you'd be right. I've got a solution using WPF but I would prefer a solution that would work in the .NET 2.0 framework. GDI+ is not somewhere I've spent any am...

C# GDI+ X-Y Axis questions

How does one find the coordinates halfway on the X and Y axis in a user control or form? How can I identify the range of the X-axis and the Range of the Y axis on a user control or form? ...

Scaling Image to multiple sizes for Deep Zoom

Lets assume I have a bitmap with a square aspect and width of 2048 pixels. In order to create a set of files need by Silverlight's DeepZoomImageTileSource I need to scale this bitmap to 1024 then to 512 then to 256 etc down to 1 pixel image. There are two, I suspect naive, approaches:- For each image required scale the original full ...

C# Draw Quadratic Curve

How can I draw Quadratic Curve through 3 points by using C# System.Drawing namespace? ...

How do I use (or get Windows to use) iUniq in a SURFOBJ?

The Windows Driver documentation says that a the iUniq field in a SURFOBJ can be used to determine if a surface has not changed and that the driver can used cached information to re-render the surface. I assume that if my driver is called with a SURFOBJ that has the same hsurf and iUniq values, the pixels of the SURFOBJ have not changed...

How do I remove color (colour) profile information from images using .NET?

Hi, I have a tool which manipulates images at runtime as part of my web app. This generally works fine, but with the release of Firefox 3.5 we're seeing some colour problems. I believe this is because Firefox 3.5 now supports embedded ICC colour profiles where no other browsers do. In order to achieve consistency of display, I'd like...

How to read the Color of a Screen Pixel

Okay, I am looking for a function or something that will read the color of a certain pixel on my monitor, and when that color is detected, another function will be enabled. I figure using RGB. All help appreciated. Thank You. ...

Wrap text into semi-circle region

I'm modifying this glass button code to allow for both a Text and a TextExtra property. The goal is to render the Text in a larger/bolder font on the top half of the button and the TextExtra in a smaller font on the bottom half. I'm having trouble finding a good way to do this when the button is round. As written, the code uses the te...

Is re-using GDI+ objects bad practice? (or: How to use many nested using blocks without getting headaches?)

I'm currently writing a fairly complex paint method for a user control, involving a fair amount of drawing code. I know that all GDI+ resources need to be properly disposed so I wrap each of those in a using block. But when I noticed that I used three using blocks for three different SolidBrushes I wondered whether I couldn't just re-us...

GDI+, using DrawImage to draw a transperancy mask of the source image

Is it possible to draw a transperancy mask of an image (that is, paint all visible pixels with a constant color) using Graphics::DrawImage? I am not looking for manually scanning the image pixel-by-pixel and creating a seperate mask image, I wonder if it's possible to draw one directly from the original image. My guessing is that it sho...

Determine largest font for given rectangle height (WinForms)

This is the inverse of Determine Label Size based upon amount of text and font size in Winforms/C#. Given a rectangle of fixed height but variable width, is there an efficient way to determine the largest size of a given font that will fit in the rectangle (height-wise) without risk of losing ascenders/descenders? I'm currently conside...