gdi+

GDI+ : Changing DPI

孤街浪徒 提交于 2019-12-13 00:33:40
问题 I have two points that i need be to be clarifief on : changing image DPI from 200 to 100 does it mean that i have to resize the image by half or i could keep the actual dimensions but decrease the DPI. I herd that GDI+ could be a nice alternative to change the image DPI, i googled in that way but i found no example showing how to change the DPI with GDI+. Any Idea about those questions, and thank you. 回答1: Changing the dpi of an existing image doesn't make much sense. It records the

Locking a GDI+ Bitmap in Native C++?

 ̄綄美尐妖づ 提交于 2019-12-12 18:42:32
问题 I can find many examples on how to do this in managed c++ but none for unmanaged. I want to get all the pixel data as efficiently as possible, but some of the scan0 stuff I would need more info about so I can properly iterate through the pixel data and get each rgba value from it. right now I have this: Bitmap *b = new Bitmap(filename); if(b == NULL) { return 0; } UINT w,h; w = b->GetWidth(); h = b->GetHeight(); Rect *r = new Rect(0,0,w,h); BitmapData *lockdat; b->LockBits(r,ImageLockModeRead

x64 applications using gdi+: what are the consequences on performance?

怎甘沉沦 提交于 2019-12-12 18:18:20
问题 I am currently implementing an ASP.Net application which is using GDI+ to do server-side rendering. First versions were dependent on a 32 bits unmanaged component, so all the managed assembly were compiled for x86 platform. Lastly I got rid of this dependency and am now able to set the target platform to AnyCPU. Since the application can potentially be used to handle a lot of data, being able to run it in 64 bits may be useful. However I read there is a performance decrease when using GDI+ on

A generic error occurred in GDI+ exception when trying to save image into MemoryStream

廉价感情. 提交于 2019-12-12 16:32:43
问题 I am using C# windows form. My code : private void Openbutton_Click(object sender, EventArgs e) { OpenFileDialog openFileDialog = new OpenFileDialog(); if (openFileDialog.ShowDialog() == DialogResult.OK) { SurveyDiagrampictureBox.Image = Bitmap.FromFile(openFileDialog.FileName); MemoryStream memoryStream = new MemoryStream(); SurveyDiagrampictureBox.Image.Save(memoryStream, ImageFormat.Jpeg); SurveyDiagram = memoryStream.GetBuffer(); } } It doesn't always occur, the exception throws when

OutOfMemory Exception when recursively drawing rectangles in GDI+

强颜欢笑 提交于 2019-12-12 15:47:01
问题 I have a problem drawing and filling rectangles in C# using GDI+. I'm trying to render a treemap and have therefore constructed a recursive algorithm which traverses the tree structure from root to leaf levels and draws a rectangle in any case, but also fills the rectangle if the node happens to be a leaf node. The code works fine for smaller trees, but reproducably crashes for a larger data set which has 42 layers of nodes. The upper DrawRectangle call throws an OutOfMemoryException when

How to detect and highlight rectangle on mouse hover

◇◆丶佛笑我妖孽 提交于 2019-12-12 15:10:00
问题 I have created a windows application control in C#.net to show some objects(things) in graphical mode. So I created a rectangles depend on number of items I got in list and plot it over control by using Control OnPaint event. Now I want to highlight that rectangle if mouse hovering on it. Please check attached image for more clarity & suggest me how can I achieve it . 回答1: Did you check the classical DrawCli example? It shows how a basic application should manage objects and tools. In short

Bitmap.Save “Generic Error”

…衆ロ難τιáo~ 提交于 2019-12-12 15:03:27
问题 When I run my application the following error get's thrown in my face "A generic error occurred in GDI+." I've looked around and seen people have similar errors, but have found no real solution, or it is a real pain in the butt to implement. And those that have not gotten a solution have not posted their code. So I thought I might as well give it a shot and throw another thread up about how to fix this error. This is my Code & Error Random r = new Random(); DirectoryInfo di = new

GraphicsPath and OutOfMemoryException

偶尔善良 提交于 2019-12-12 13:07:16
问题 I have the following private bool IsPathVisible(Rectangle detectorRectangle, GraphicsPath path, Pen pen) { path.Widen(pen); return IsPathVisible(detectorRectangle, path); } When path points are the same point, I receive a OutOfMemoryException (using Widen function). How can I manage it? 回答1: That's a bug with the pen and the widen method. Make sure your startpoint of the path and the endpoint of the path are not the same. This is a demonstration: private void panel1_Paint(object sender,

Is their a way to stop the picturebox from flickering when being resized?

坚强是说给别人听的谎言 提交于 2019-12-12 12:35:03
问题 I have an image that I wanted to include in my vb.net app, so I sliced it up in photoshop and divided it into multiple picture boxes, and anchored them accordingly so when my application is resized it wont stretch all parts of the image. That is all good, it looks great and almost works great..except the fact that when the form is being resized it is causing the pictureboxes to flicker. I know that the picturebox is not the fastest control, so I am geussing it is not refreshing fast enough.

How to turn on GDI+ 1.1 instead of 1.0 in MFC project?

烈酒焚心 提交于 2019-12-12 12:18:37
问题 I unable to use GDI+ 1.1 classes in my VS2012 MFC C++ project (on Win7). Classes Image, Bitmap, Graphics works just fine but when I try to declare an object of Blur class (or other v1.1 classes) I am getting an error C2065: ‘Blur’: undeclared identifier . I tried to define GDIPVER (in stdafx.h) like this #define GDIPVER 0x0110 //also I get the warning C4005: 'GDIPVER' : macro redefinition #include <gdiplus.h> #pragma comment (lib,"Gdiplus.lib") but it does not work. How to turn on GDI+ 1.1