2,943 questions
1
vote
0
answers
79
views
Drawing metafile to Graphics with unit conversion ignores boundaries
We use FastReports and its ImageExporter in a .NET 8 / C# WinForms application to generate images that are then printed in specific locations on a PrintDocument. We are using Metafile as the image ...
3
votes
1
answer
167
views
how would I skew a Windows Forms texture/image so that one side is smaller/bigger than the other side to have a "pinched" look to it
(I am aware using windows forms for this kind of project is stupid and inefficient but it is a requirement for the college course I'm doing so I'm stuck using this)
in windows forms you can draw an ...
2
votes
1
answer
119
views
C# GDI+ questionable font rendering on Win 7
I am trying to render some kind of a picture using GDI+ with dynamically loaded fonts. Here is a minimal example (.NET 8.0):
private void Form1_Load(object sender, EventArgs e)
{
...
0
votes
0
answers
74
views
confusion converting gdiplus code to use <vector> [duplicate]
This is a continuation of a previous discussion here... I'm trying to convert an existing GDI+ practice program to use for the various GDI+ objects...
So the existing (working) code is this:
...
3
votes
1
answer
184
views
Do I need to initialize COM before using IStream with GDI+ Bitmap::FromStream()?
I am using the GDI+ function Bitmap::FromStream() to load a PNG resource, following the example provided in this article.
The Bitmap::FromStream() function requires an IStream as its first argument. ...
1
vote
0
answers
43
views
Question about scaling when printing image with GDI+
It seems that information about resolution and DPI that I get from printer are not correct.
I want the picture that I send to the printer is always maximized in width.
Horizontal resolution for ...
0
votes
1
answer
40
views
GraphicsPath element in List <>
I have defined the class Intersection as:
// ******************************************** class Intersection
public class Intersection
{
public string name { get; set; }
public ...
1
vote
0
answers
66
views
GDI+ DrawLines bug when used with Pen size more than 1
The following code:
Graphics g(hdc);
Pen pen1(Color(0, 0, 0), 1.0f);
pen1.SetAlignment(PenAlignmentCenter);
Pen pen10(Color(0, 0, 0), 10.0f);
pen10.SetAlignment(...
0
votes
0
answers
41
views
Strange behaviour of GDI+ pen and drawline/drawlines
The following code gets weird results:
Graphics g(hdc);
Pen pen(Color(0, 0, 0), 50.0f);
std::vector<PointF> line;
line.push_back({ 200, 200 });
line.push_back({ 200, 100 });...
0
votes
1
answer
155
views
How to set separate colors in GDI+ Color?
GDI+ Color class has functions Get* which return the values of specific colors and alpha channel (like GetR and GetRed; two of them for the same thing!) and at the same time lacks functions Set for ...
7
votes
0
answers
148
views
How to preview GDI+ images using Image Watch?
I'm trying to visualize on memory GDI+ images using the Image Watch extension.
I requested support on this feature long time ago directly on the developercommunity it got a lot of upvotes but MSFT ...
0
votes
0
answers
127
views
Generic GDI+ error building in VS2019, or when saving as PNG (works with JPEG)
I installed Windows 11 and Visual Studio 2019 Professional to build our application, but the build always fails with a "Generic GDI+ error" when compiling the resources. If I remove the PNG ...
0
votes
1
answer
85
views
When I rescale the image, or minimize the window, the image created with Gdiplus is gone
I am trying to recreate a 1996 program, that barely anyone knows. It is called Identibacter Interactus. I am using C++ and Gdiplus to recreate it, and it was originally created with Macromedia ...
0
votes
1
answer
56
views
How can I resolve the "System.Runtime.InteropServices.ExternalException: 'A generic error occurred in GDI+.'"error when saving an image in C# WinForm?
When saving the image in C# WinForm, I encountered the following error:
System.Runtime.InteropServices.ExternalException: 'A generic error occurred in GDI+.'
Here is the updated code with the ...
2
votes
0
answers
118
views
How to draw a rounded filled rectangle with only the corners anti aliased using GDI+?
I'm trying to draw a rounded rectangle with anti-aliased corners, however the entire rectangle is being aliased, resulting in blured edges of the rectangle. I'd like to only have the rounded corners ...
-1
votes
1
answer
160
views
Issue while loading a Gdiplus::Bitmap of PixelFormat8bppIndexed into an open cv::mat
I am trying to load an Gdiplus bitmap of 8 bit depth to an opencv mat. the image is in greyscale.
Greyscale Image of 8bit:
.
this is the VC++ code snippet I am using to convert it into cv::mat. But ...
0
votes
1
answer
123
views
How do I avoid heap corruption when populating an indexed bitmap using Bitmap.LockBits and Marshal.Copy?
I want to programmatically create indexed bitmaps in formats other than PixelFormat.Format8bppIndexed and need help in understanding why my current implementation is causing heap corruption.
I've ...
2
votes
1
answer
109
views
Gdi+ Graphics(HDC) vs Graphics(HWND) - reason to use which one?
In my WM_PAINT handler, I create a Gdiplus::Graphics object and I can make it from either an HWND or the HDC supplied by BeginPaint(). Is there any reason to choose one over the other?
0
votes
1
answer
247
views
Why do I need to pass PixelFormat.Format8bppIndexed to Bitmap.LockBits when my bitmap uses a different indexed PixelFormat?
I found this answer showing how to create a bitmap using PixelFormat.Format8bppIndexed and wanted to adapt it to cover the other indexed formats (Format1bppIndexed and Format4bppIndexed) and to use a ...
0
votes
1
answer
228
views
How to capture a small screenshot (cursor included) around mouse?, with AutoHotkey
I've made an AutoHotkey script to click some banners, and it sends me the photos on Telegram of the clicks it makes. Of course, my x1,y1,x2,y2 coordinates to crop the screenshot are variables and ...
1
vote
2
answers
150
views
WinAPI 32 and GDI+ move window when draggin a PNG image with some region with trasparency
I wrote a program that creates a window with the WS_POPUP attribute, in order to load a PNG image for background with transparent part,
first of all in the code contained in case WM_MOUSEMOVE: I use ...
0
votes
1
answer
85
views
GDI+ screenshot doesn't work with odd resolutions
Hi I am trying to create a Screen Capturing class in c++ (since python screenshots are slow as heck). I created this class but I can't create screenshots with odd resolutions like 101x101.
I get a ...
0
votes
0
answers
90
views
"'EmfPlusRecordType' is an incomplete type" compilation error with Intel DPC++ 2024
I'm compiling the GDI+ library in my code:
#include <gdiplus.h>
It works fine with the MSVC compiler but when using the Intel DPC++ 2024 compiler, I get the compilation error 'EmfPlusRecordType'...
1
vote
0
answers
94
views
The issue of incorrect positioning of text coordinates from SVG in C++ using the GDI+ library
Lately i have been working on a small project that reads information from SVG file and then using GDI+ to draw, but im having trouble with text drawing position, because what i draw is not the same as ...
0
votes
0
answers
59
views
How to load an image byte array into QGraphicsView?
I'm building a module for an application and, this module should take a print from the screen and show it into a QGraphicsView.
This is my Print Screen code that saves the taken photo into a jpg file:
...