Questions tagged [gdi+]
The Graphics Device Interface (GDI) is a Microsoft Windows application programming interface and core operating system component responsible for representing graphical objects and transmitting them to output devices such as monitors and printers. -Wikipedia
2,860
questions
0
votes
1
answer
35
views
Formulas for rendering raised graphic buttons
With each new version of Windows, native desktop applications are at the mercy of its changing visual styling.
If the application wants to take control of its own styling and present a consistent ...
0
votes
0
answers
38
views
C# winforms - How can I set the initial position of the scrollbars in the middle?
Problem: The main problem is that after scaling(Zoom centered on mouse position), the mouse click position on the canvas does not match the display position. The problem may be related to the movement ...
2
votes
1
answer
70
views
How to create a HICON from base64?
I am converting a picture from a base64 string into an HICON that could work when registering a new class:
WNDCLASSEX wc{};
wc.hIcon = < here >;
I got the base64_decode() function here: base64....
0
votes
0
answers
78
views
Fastest way to copy my own system memory RGB array into a Win32 window
while it seems such a basic question, I open this thread after extensive stackoverflow and Google search, which helped but not in a definitive way.
My C++ code draws to an array used as RGB ...
0
votes
0
answers
44
views
Extract all possible polygons from set of different types of geometrical elements in WinForms GDI - Extracted polygons will be used to fill color
I have an input, a set of different types of 2D geometrical elements with all its attributes (arcs, circles, lines, polylines, rectangles, polygons..). These elements can be connected end to end, ...
1
vote
1
answer
45
views
Draw a smooth string
I'm trying to create a simple "Avatar" user control in WinForms that draws a string in the middle of the control. However, I can't figure out a way to draw a smooth text. Here's the code:
...
1
vote
1
answer
68
views
C# winforms - How to combine scrollbar with mouse wheel zooming?
Problem - I'm writing a program that draws graphics, and zooming is one of the features. Currently, a picturebox is placed on a panel, and the picturebox has vertical and horizontal scroll bars on the ...
0
votes
1
answer
51
views
C# winforms - How can I get all the points on the Bezier curve or the equation drawn with DrawBeziers? [duplicate]
I'm doing some computer graphics program. I need to draw a bezier curve and then determine if a point is on this curve. I've defined 4 points(2 endpoints, 2 control points) and plotted a bezier curve ...
1
vote
1
answer
170
views
How to correct the mouse down position after zooming?
Problem - Before the zoom operation, the user can draw "points" according to the click position of the mouse on the canvas(picturebox), but when the user uses the mouse wheel to zoom (...
-1
votes
1
answer
29
views
[C#]DrawImage will make picture volume bigger
var map = new Bitmap("a.jpg");
var w = map.Width;
var h = map.Height;
var _bitmap = new Bitmap(w, h, PixelFormat.Format24bppRgb);
Graphics _g = Graphics.FromImage(_bitmap);
var ret = new ...
0
votes
0
answers
13
views
sharpdx effect couldn't accelerate
we apply a d2dcontext effect gaussianblureffect to a JPG file 4000*3000 32bit , sharpdx takes 270ms , c++ dx version takes 6ms, seems that the graphic accelerate was not functional. the sharpdx code ...
0
votes
1
answer
28
views
Convert Gdiplus::Region to ID2D1Geometry* for clipping
I am trying to migrate my graphics interface project from Gdiplus to Direct2D.
Currently, I have a code that calculates clipping area for an rendering object:
Graphics g(hdc);
Region regC = Rect(x, y, ...
0
votes
0
answers
34
views
GraphicsPath.IsVisible() does not return if the point is inside the polygon correctly?
I add a polygon to the GraphicsPath and try to check if the rectangle is positioned inside of it. When rectangle is completely outside the polygon code responds correctly. However, when inside the ...
4
votes
0
answers
79
views
How to convert a Gdiplus::GpBitmap* to Gdiplus::Bitmap*?
I'm using AutoHotkey the source is written in c++ and internally it uses the GDI+ Flat API.
Im creating bitmaps into script using the Gdiplus.dll, something like:
DllCall("gdiplus.dll\...
0
votes
0
answers
30
views
C# pictureBox: from coordinates to graphics object
I am working with the following code to draw graphics elements on a pictureBox in C#
gGraphics = Graphics.FromImage(bBitMap);
pictureBoxB.Image = bBitMap;
This is working fine. For example:
gGraphics....
0
votes
1
answer
33
views
GDI+ draws internal lines in a polygon path
I am trying to paint a following polygon:
with this code:
procedure TForm1.Paint;
var
g: TGPGraphics;
pen: TGPPen;
i: Integer;
p: TGPGraphicsPath;
m: TGPMatrix;
br: TGpSolidBrush;
begin
...
0
votes
1
answer
90
views
Get PDF Page size from HDC C++
I want to draw string in 3 location(Top, Center, bottom) of my printing page. I use Gdiplus::RectF and drawstring() to Draw string in the page. for setting string Location I need the Page dimentions. ...
0
votes
0
answers
28
views
End cap in gdiplus with transformation is broken
I am using gdiplus inside my mfc application. I want to draw an arc ended with a cap. When I use a TranslateTransform (in this example I want to swap the positive angle direction), the end cap is ...
1
vote
0
answers
35
views
Is it possible to paint a part of an panel with a different Colour?
Image for better understanding: This Polygon should be in another colour I'm new into programming but i made a good progress in the last weeks.
I've writen an application for calculating the second ...
-1
votes
1
answer
47
views
Generell error in GDI+ when using bitmap.save
I want to take a screenshot of a frame and safe it. I used a bitmap, but always the error "Generell error in GDI", when i want to save the bitmap, occurs.
var picture = _webcamStreaming....
1
vote
1
answer
57
views
How to draw a point in 3d coordinates on C# WinForms?
I want to have points drawn in runtime in a WinForms application. How do I do that?
0
votes
1
answer
24
views
How GDI+ DrawString draws the string with hieroglyphs when Font doesn't support these symbols
How it's possible that the GDI+ DrawString() method can draw a string with hieroglyphs characters, even if the Font selected for it doesn't support these symbols?
FontFamily fontFamily("Segoe UI&...
0
votes
1
answer
64
views
Locked image causing Generic GDI+ Error when using same image
I have an application that is reading registration plates of an image. I have a simple UI where user can select image to scan using FilePicker.
So scenario where the problem occurs
Select image A
...
0
votes
0
answers
39
views
How to use GDI+ to fill a PNG image and keep its transparent layer?
When we want to fill a transparent icon image in Photoshop, it is very simple. Just press Ctrl + left mouse button, then select the non-transparent area of the icon, and then fill it with color.
I ...
0
votes
0
answers
41
views
In GDI+, I'm drawing a arc and a circle with the save center point and radius, but the graphics are separated
I'm new to GDI+, and I'm writing a program to draw a circle and arc segments on the circle using GDI+'s DrawArc and DrawElllipse, but in some cases, the arc is not on the circle in the outcome graphic....
0
votes
0
answers
29
views
ActionViolation when using LockBits
I am trying to get the pixels a bit faster than one could when using .GetPixel() but I have found myself that it throws an exception with a 0,0 index with the right LockImageMode.
Exception
Attempted ...
0
votes
0
answers
20
views
A generic error occurred in GDI+ Bmp to memorystream, not the normal disposing problem
I'm trying to convert a pdf to image using Docnet.Core and for some PDF's it works but with others it fails with that hated Generic Error has occurred. Most examples on this error involve disposing ...
1
vote
1
answer
61
views
How to fill text with 2 different color/texture
I draw text on top of a image using Path.Addstring and filling it with a color and it works perfectly. Now I would like to split(bisect) the text vertically and have 2 different colors or textures. ...
0
votes
0
answers
26
views
How to resize the rotated graph in the graph group in c#?
I'm using c# GDI+ to write a function for geometric transformation of a graph, but I'm running into a problem. When I use the Scale and rotateAt methods of the Matrix matrix to scale the rotated graph ...
0
votes
1
answer
67
views
How to add button with events on third party windows form application?
I need to add one button with events on third party windows application, whose click event will open web browser with provided link.
Is there any way to achieve this using c#, .net framework?
I do ...
0
votes
0
answers
42
views
GDI+ How to Center Graphics
Bitmap bitmap(m_X, m_Y, PixelFormat32bppARGB);
new_Bitmap = bit.Clone(0,0, bitmap.GetWidth(), bitmap.GetHeight(), PixelFormat32bppARGB);
Graphics graphics(bitmap);
SolidBrush brush(Color(255, 255, ...
0
votes
1
answer
35
views
Occasionally getting a generic error occurred in GDI+ in a C# program that takes a screenshot every 15 seconds
I have a C# program that takes a screenshot every 15 seconds that works great. But now I seem to get an occasional "a generic error occurred in GDI+". I am then using a javascript file ...
1
vote
0
answers
180
views
Drawing shapes into the Rectangle
I developing paint application with winform and i have to draw some custom shapes(right arrow, left arrow, trapezoid, rhombus etc) but i dont understand how drawPolygon method drawing wrong ...
0
votes
0
answers
4
views
Compose a parametric equation c# gdi+
Compose a parametric equation and construct the motion path of the disk's extreme point if the disk rolls over:
· Ox axis;
· Oy axis;
· the outer part of the unit circle;
· the inside of the unit ...
1
vote
1
answer
98
views
how do I center align drawstring bmp from text input in picturebox c#
I'm a beginner writing a simple windows desktop form app with a textbox that user types into and then clickbutton converts that text into a bitmap that is shown in a picturebox (that is only 96 x 64 ...
0
votes
1
answer
118
views
c# graphics animation with timer tick flickering
I am trying to make an animation in WinForms, C#. I have a timer, and for each tick, I move a circle around a panel on a form. It works, but the display is not smooth, it seems to flicker. Anyone can ...
0
votes
0
answers
64
views
Drawing splines in varying color segments
I'm using GDI+ to draw a cardinal spline through a series of points. I wish to draw certain segments in a different color. I've tried drawing the segments individually with multiple Graphics::...
3
votes
1
answer
124
views
How to avoid controls flickering in a CDialog (MFC C++ )
Hello i've been looking for a couple of days now how to avoid controls themselves from flickering in a CDialog.
I am using CMemDC and erasing the background to draw some basic shapes with GDI+
void ...
0
votes
1
answer
98
views
how to create a dynamic bitmap array?
How to create a dynamic bitmap array?
I tried it like this:
Bitmap* bit = new int(5);
But it didn't work out.
After, I tried like this:
Bitmap* bit = (Bitmap*)malloc(6);
bit[5] = new Bitmap(sFileName)...
-1
votes
2
answers
144
views
Soft edged images in GDI+
Im trying to convert the code found here: soft-edged-images-in-gdi, to c++. Its used to create bitmaps with rounded corners and soft edges.
#include <windows.h>
#include <iostream>
#...
0
votes
1
answer
106
views
Not drawing bitmap
GIF::GIF(Bitmap* bit, HDC hdc) {
this->bit = bit;
}
void GIF::draw(Graphics* g,HDC hdc, Bitmap *bit)
{
this->position.x = 50;
this->position.y = 50;
this->CachedBitmap = ...
2
votes
0
answers
90
views
In Powershell convert image to BMP 16 bits
I have a code to batch convert a folder of jpg files to BMP.
The code i have works OK, but it gets saved as BMP 24 bits.
I need it to convert it to BMP 16 bits using Powershell
function ConvertImage{
...
-1
votes
1
answer
150
views
How to round the corners of an image inside of a hdc?
I'm capturing a window using the winapi PrintWindow, and cropping only the desired region using BitBlt, but the region I'm trying to capture is a rounded rect, how I could round the corners of the ...
3
votes
1
answer
98
views
Can I show ToolTip for the nodes I am painting on a panel?
I have a mesh system for a MMO and it's uses A* to find paths. Occasionally it fails because I have nodes that are badly placed. To fix this, I made a mesh visualiser. It works OKish - I can see ...
0
votes
0
answers
35
views
Is there a way to let the printer handling multiple copies when printing using gdi plus?
I'm printing using the hDC I get from the print dialog and was wondering if there's a way to let the printer/printer driver/OS handle multiple copies and collation settings? I can of course print the ...
3
votes
0
answers
142
views
GDI+ PenAlignmentInset seems to be different than GDI PS_INSIDEFRAME
I've encountered a strange issue when trying to draw rectangles with GDI+, but I'm not sure if I'm doing something wrong.
The GDI+ pen alignment setting, PenAlignmentInset, seems to not work properly ...
0
votes
0
answers
68
views
GDIPlus in a multithreaded environment inside a DLL and in the main app
I have an application that catalogs image files on my computer. In CWinApp::InitInstance, I initialize Gdiplus using the following:
GdiplusStartupInput gdiplusStartupInput;
GdiplusStartup(&...
0
votes
0
answers
44
views
How to convert a ImageMagick Image to a Gdi HBITMAP?
How to convert an Image from the lib Magick++ to a HBITMAP?
MagickImage image;
try {
// Read a file into image object
image.read("1.png");
Geometry newSize = Geometry("...
0
votes
1
answer
189
views
How to get a bitmap from a hdc?
I can load a hbitmap into a hdc like this:
Gdiplus::Color Color{ 255, 255, 255 };
hBitmap = NULL;
Gdiplus::Bitmap* bitmap = Gdiplus::Bitmap::FromFile(L"home.png", ...