Try initialising the engine:
int main()
{
ULONG_PTR t;
Gdiplus::GdiplusStartupInput s;
Gdiplus::GdiplusStartup( &t, &s, nullptr );
. . .
}
This browser is no longer supported.
Upgrade to Microsoft Edge to take advantage of the latest features, security updates, and technical support.
Hi! I am trying to learn to use the gdiplus GraphicsPath class and wrote some code to test the setup, but the number of points always returns 0. What is wrong with this code?
#include <windows.h>
#include <gdiplus.h>
#include <iostream>
//use gdiplus library when compiling
#pragma comment( lib, "gdiplus" )
using namespace Gdiplus;
VOID GetPointCountExample()
{
// Create a path that has one ellipse and one line.
GraphicsPath path;
path.AddLine(220, 120, 300, 160);
// Find out how many data points are stored in the path.
int count = path.GetPointCount();
std::cout << count << std::endl;
}
int main()
{
GetPointCountExample();
}
A high-level, general-purpose programming language, created as an extension of the C programming language, that has object-oriented, generic, and functional features in addition to facilities for low-level memory manipulation.
Answer accepted by question author
Try initialising the engine:
int main()
{
ULONG_PTR t;
Gdiplus::GdiplusStartupInput s;
Gdiplus::GdiplusStartup( &t, &s, nullptr );
. . .
}