gdi+

How do I draw a circular gradient?

核能气质少年 提交于 2020-01-21 03:46:09
问题 How do I draw a circular gradient like this in vb.net? 回答1: Check out this great page. The code in the article is in C#. Here is a vb.net port of the code you'e interested in and updated for a rectangular fill: (based on the article's triangle fill sample.) Dim pgb As New PathGradientBrush(New Point() { _ New Point(0, 0), _ New Point(0, Me.ClientRectangle.Height), _ New Point(Me.ClientRectangle.Width, Me.ClientRectangle.Height), _ New Point(Me.ClientRectangle.Width, 0)}) pgb.SurroundColors =

gdi+ error saving image from webpage

感情迁移 提交于 2020-01-16 14:19:20
问题 I have such method for saving image from url: public Image DownloadImage(string _URL) { Image _tmpImage = null; try { // Open a connection System.Net.HttpWebRequest _HttpWebRequest = (System.Net.HttpWebRequest)System.Net.HttpWebRequest.Create(_URL); _HttpWebRequest.AllowWriteStreamBuffering = true; // You can also specify additional header values like the user agent or the referer: (Optional) _HttpWebRequest.UserAgent = "Mozilla/5.0 (Windows NT 6.1; WOW64; rv:23.0) Gecko/20100101 Firefox/23.0

gdi+ error saving image from webpage

佐手、 提交于 2020-01-16 14:19:06
问题 I have such method for saving image from url: public Image DownloadImage(string _URL) { Image _tmpImage = null; try { // Open a connection System.Net.HttpWebRequest _HttpWebRequest = (System.Net.HttpWebRequest)System.Net.HttpWebRequest.Create(_URL); _HttpWebRequest.AllowWriteStreamBuffering = true; // You can also specify additional header values like the user agent or the referer: (Optional) _HttpWebRequest.UserAgent = "Mozilla/5.0 (Windows NT 6.1; WOW64; rv:23.0) Gecko/20100101 Firefox/23.0

Color value with alpha of zero shows up as black

笑着哭i 提交于 2020-01-16 03:24:05
问题 I'm using .NET 4.0. I don't know if this is a framework bug or if it's a GDI+ thing. I just discovered it while writing an app to swap color channels. Let me try to explain the problem. I'm reading pixels from one bitmap, swapping the channels, and writing them out to another bitmap. (Specifically, I'm setting the output image's RGB values equal to the input image's alpha, and output's alpha equal to the input's green channel… or, to put it succinctly, A => RGB and G => A.) The code is as

A generic error occurred in GDI+ when resizing image in MemoryStream

帅比萌擦擦* 提交于 2020-01-16 03:08:13
问题 I am using ImageProcessor to process images in my website. I have this resize function : public Image ResizePhoto6version(Image img, int width, int height) { using (var ms = new MemoryStream()) { using (var imgf = new ImageFactory(false)) { imgf.Load(img) .Resize(new ResizeLayer(new Size(width, height), ResizeMode.Max)) .Save(ms); return Bitmap.FromStream(ms); } } } In the webservice, I run this code : MemoryStream ytSmallStream = new MemoryStream(); MemoryStream ytMediumStream = new

Draw a GraphicsPath in a PDF

前提是你 提交于 2020-01-16 00:25:27
问题 I am trying to create a PDF based on some vector art I have in my C# application. I have two major problems when I try to map the points and types from a GraphicsPath. Some paths are just plain missing. When a sub path is an internal boundary I need to indicate that somehow. ie, the circle in the letter d is filled in. I'm referencing iTextSharp 5.5.2 on NuGet. I'm only using AddString here because I want an easy way to demonstrate creating a complex path in this example. For my need I won't

Speeding Up Image Handling

廉价感情. 提交于 2020-01-15 11:59:06
问题 This is a follow on to my question How To Handle Image as Background to CAD Application I applied the resizing/resampling code but it is not making any difference. I am sure I do not know enough about GDI+ etc so please excuse me if I seem muddled. I am using a third party graphics library (Piccolo). I do not know enough to be sure what it is doing under the hood other than it evenually wraps GDI+. My test is to rotate the display at different zoom levels - this is the process that causes the

C# alternative to setpixel

自闭症网瘾萝莉.ら 提交于 2020-01-15 11:54:29
问题 I have read through several articles which are alternatives to using setpixel/getpixel but I am not seeing how they relate to my issue. I have a multicoloured image which (depending on dynamic values taken from DB) changes the color of each pixel color group to a new color. Lets say I want all pixels with Argb value of -989556 changed to -16 & all pixels with Argb value of -1331 changed to -5383962. I am currently looking at every pixel in the Bitmap and checking their value, if they match

C# alternative to setpixel

亡梦爱人 提交于 2020-01-15 11:53:12
问题 I have read through several articles which are alternatives to using setpixel/getpixel but I am not seeing how they relate to my issue. I have a multicoloured image which (depending on dynamic values taken from DB) changes the color of each pixel color group to a new color. Lets say I want all pixels with Argb value of -989556 changed to -16 & all pixels with Argb value of -1331 changed to -5383962. I am currently looking at every pixel in the Bitmap and checking their value, if they match

A generic error occurred in GDI+

偶尔善良 提交于 2020-01-15 03:43:11
问题 A generic error occurred in GDI+ [ExternalException (0x80004005): A generic error occurred in GDI+.] System.Drawing.Image.Save(Stream stream, ImageCodecInfo encoder, EncoderParameters encoderParams) +615257 I have a webpage in which a pdf is converted to png, and using the response.outputstream it is displayed. when i run this on my local machine is works fine. but when i run the same code on server is throws this exception. my question is , where i could look in for error. as there is no