Questions tagged [gdi]

Graphics Device Interface (GDI) is a device-independent, pure software graphics API under the Windows operating system for drawing graphic primitives and text. It is the underlying base used to render the Windows GUI elements.

Filter by
Sorted by
Tagged with
0 votes
0 answers
65 views

Win32 - Drawing a native window with a specific style

Does the Win32 API expose any of the facilities that are used by Windows to draw the native controls as they appear by default? Say my application wants to display a non-interactive preview/mockup of ...
user2593449's user avatar
0 votes
0 answers
35 views

Translating Windows Forms Drawing Logic to Xamarin.Forms with SkiaSharp

I have a Windows Forms application with the following drawing logic using Graphics and PictureBox: I'm currently porting this application to Xamarin.Forms and using SkiaSharp for drawing. My UI ...
user avatar
0 votes
0 answers
34 views

how to create dynamically Point point[] to use in (place the x, y values from computation within a for loop)

how to create dynamically Point point[] (place the x, y values from computation within a for loop) then use in LineTo GDI+ within for loop with a point array? LineTo(hdc, point1, point2); want ...
elwolv's user avatar
  • 1
0 votes
0 answers
23 views

How to use RGBQUAD to create system-wide shaders?

There's some videos online of people using Windows' gdi32.dll to create very intense and colorful effects over the entire desktop screen, some using the RGBQUAD struct. See the image below for an ...
Depressed Emo's user avatar
0 votes
1 answer
38 views

How to change a GDI CDC printing configuration to Duplex during output?

I have C++ code that works for generating printer output (quasi/abbreviated code): CDC dcPrinter; dcPrinter.Attach(hdcPrinter); DOCINFO docinfo; dcPrinter.StartDoc(&docinfo); dcPrinter.StartPage();...
user386093's user avatar
2 votes
1 answer
149 views

SetWindowRgn with antialiasing

Does SetWindowRgn support anti-aliasing? And if so, how to set it up?
c00000fd's user avatar
  • 21.4k
0 votes
0 answers
108 views

Why does BitBlt() fail for me?

I have been trying to capture the desktop, using the Windows GDI, following code available online. It works perfectly well, but I have a game that does API hooking (I believe), that blocks BitBlit() ...
Aravind A's user avatar
  • 386
-1 votes
1 answer
85 views

How to create a DIB after loading a 32-bit PNG image with alpha channel?

I want to use the BITMAPINFO structure to define the DIB of the 32-bit png image, so that I can then use StretchDIBits to send the image to the printer for printing. I tried the following code: HDC ...
douxiaobao's user avatar
0 votes
0 answers
39 views

Issue with redrawing premultiplied alpha bitmap with Win32 GDI

I am building a setup program that has a back button and a next button, typical for setup programs. However, I seem to be having an problem, while the initial draw works, if I change the button bitmap ...
Genki's user avatar
  • 1
0 votes
0 answers
98 views

Resize Windows window and redraw the contents at the same time in C

I have some code which expands my Windows app window in all four directions as an animation on startup. I then need to re-center some elements in order for it to look correctly. It looks somewhat like ...
Andreas Sandberg's user avatar
-1 votes
1 answer
89 views

Black screen when im trying to make double buffered GDI overlay

Im trying to create double buffered gdi overlay over desktop but all what i get is black screen with red line HDC hdc = GetDC(0); HDC mem_handle = CreateCompatibleDC(hdc); HBITMAP ...
kiiiiiiiiiiiiiiiiiiiilmepls's user avatar
0 votes
2 answers
38 views

DirectWrite lists regular, Oblique, Bold, Bold Oblique versions of Microsoft Sans Serif, but they all point to the same TTF file

So I have used the DirectWrite APIs to query the available fonts in my system. One of the fonts is Microsoft Sans Serif. DirectWrite returns me four faces for this font: Regular, Oblique, Bold and ...
Kevmeister68's user avatar
1 vote
0 answers
121 views

WinAPI: draw RGBA image

I know there are a lot of answers related with this question, but I read them all and still don't understand. My target is to draw RGBA image on the top of all windows using WinAPI. For this I make ...
Anaph's user avatar
  • 21
0 votes
0 answers
59 views

making a cube rotating, making the old disappear

im trying to create an app with a rotating cube, and i created the window, then when i press 'p' my cube is create and every time the pc get the 'p' pressed the cube rotates. the issue is that the old ...
Matteo Rocco Micò's user avatar
2 votes
0 answers
75 views

Unable to figure out problem with BitBlt in win32

I am new to windows programming and stuck with legacy code of software and having difficulty in figuring out the cause. The problem at hand is I have a SourceHDC and I am dumping it onto ScreenDC(HWND)...
native_window's user avatar
2 votes
1 answer
60 views

Changing the GDI Pen won't work in my VB6 draw lines code

I am trying to use the createPen/SelectObject GDI functions to change the DC pen in a VB6 simple program. The program is a vb6 form with Picture1 pictureBox control. It waits for the user to click ...
Emilio Nakhle Antoun's user avatar
1 vote
1 answer
70 views

Windows API screenshot only updated once

I am trying to get a screenshot of another application's window with this rust code. It works the first time it is run, however following screenshots are the exact same bitmap as the first screenshot. ...
Si1veR's user avatar
  • 67
-1 votes
1 answer
74 views

Why does the SetDIBitsToDevice not working?

I am trying to simulate a horizontal and vertical scroll of a DI bitmap that is larger than the page in the main dialog. The problem is that the contents in the page does not change when scrolling. ...
Thema Guishard's user avatar
0 votes
2 answers
43 views

Why does the RECT of a window not change by resizing it through dragging the left/top edge of it?

The following is my WindowProc function: LRESULT CALLBACK WindowProc(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam) { PAINTSTRUCT ps; switch (uMsg) { case WM_SIZE: ...
SZYoo's user avatar
  • 171
0 votes
2 answers
31 views

Why do view port extent and window extent of a DC keep constant even if I resize the window?

Here is my WindowProc function's code: LRESULT CALLBACK WindowProc(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam) { PAINTSTRUCT ps; switch (uMsg) { case WM_SIZE: {...
SZYoo's user avatar
  • 171
0 votes
0 answers
85 views

Why does the DI Bitmap contain zero?

I am trying to create a page like window with horizontal and vertical scrolls. Users can zoom in the contents of the page, which works fine except until the contents exceed the boundary of the page. I ...
Thema Guishard's user avatar
1 vote
1 answer
84 views

Why does CreateDIBSection return NULL?

I am trying to get the DI Bitmap of a section of an application's client area. The client area is a dialog window and I have used the CreateDIBSection function which is returning NULL with ...
Thema Guishard's user avatar
1 vote
0 answers
60 views

Behaviour of Graphics.AddRectangle() / Graphics.DrawPath()

I attempt to draw lines on specific coordinates using a Graphics.AddRectangle() and Graphics.DrawPath(). The parameters of my Rectangle: Dim objPath As New GraphicsPath objPath.AddRectangle(New ...
Bender110001's user avatar
1 vote
0 answers
50 views

C# StretchBlt to copy between two Bitmaps draws nothing

tl;dr; I'm trying to use the following code to copy and stretch part of my srcBmp bitmap into my destBmp using StretchBlt - it's returning 1 indicating success, but there's nothing drawn on the ...
mclayton's user avatar
  • 8,387
0 votes
0 answers
58 views

Direct2D calling WM_PAINT repeatedly without calling BeginPaint and EndPaint in WM_PAINT?

I have been learning Direct2D for a while now and I have come across a problem from my point of view. Does Direct2D call WM_PAINT multiple times in one second? Because without using BeginPaint and ...
user avatar
0 votes
1 answer
60 views

Drawing Algorithm works with normal Device Context but not with Compatible Device Context + StretchBlt

Im writing an application which works as an API for Java Code using JNI. The Java application assumes the Window Client Area is 800x400 pixels. This value cannot be modified. All sizes and positions ...
HelpfulHelper's user avatar
-1 votes
1 answer
61 views

win32/gdi drawing lines or make a pixel move

this is my code: #include <Windows.h> #include <iostream> #include <string> #include <sstream> LRESULT CALLBACK WndProc(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam) { ...
Matteo Rocco Micò's user avatar
1 vote
0 answers
60 views

The printwindow function works on some computers but not on others

I wrote some code inside a Winform. I have one panel and one PictureBox. As can be seen in the codes below; I open an exe program called Stellerium in the panel. I painted this program, which I opened ...
bozmech's user avatar
  • 53
0 votes
0 answers
107 views

Where is the byte Array?

I have C++ code that uses GDI to take a screenshot of the environment, and GDI+ to compress it into a JPG. I want to send the image over TCP, and for that I need to know where the byte array that ...
kuybt6's user avatar
  • 31
0 votes
1 answer
128 views

How do I show an image into a window's client area in Win32?

Given an RGBA array (24 bpp) of an image that has the same width and height of a window's client area, how do I efficiently show that image on that client area, using the Win32 API? Can I use the same ...
Edoardo's user avatar
1 vote
1 answer
122 views

Bitmap.Save is throwing Invalid Parameter

When passing a Bitmap to a method using thread.Start() and later calling bitmap.save() it throws the exception Invalid parameter when trying to save it to memory stream. I'm using a WPF project with ....
hiddenUser's user avatar
0 votes
1 answer
96 views

Window still shows elements that are not being drawn anymore. The window is being cleared properly

I have some code setup with Windows GDI to create a transparent window and then draw a red transparent box in the upper left of the window. After a while, it moves the box a bit to the left and makes ...
Hackermon's user avatar
  • 146
0 votes
1 answer
172 views

How the GetTextMetrics method gets the font metrics from a font ?

I am designing a font and need to set its font metrics, as mentioned in this article, different software and systems may use different parameters as font metrics. I would like to know how the win32 ...
Bourbon_7's user avatar
  • 161
0 votes
0 answers
42 views

How can I check if GDI is hardware-accelerated?

This documentation mentions that the driver should set DXGKDDI_INTERFACE_VERSION to Windows 7 or above to indicate that it supports the hardware-acceleration of GDI. But how do I check that the value ...
denoyo9984's user avatar
0 votes
0 answers
64 views

Difficulties with using Windows GDI Print API

I have programmed printing using GDI Print API Windows. The program is in FreePascal (Lazarus development environment), the sequence of calls to the Windows API functions is as follows (I've omitted ...
Ales Prochaska's user avatar
-1 votes
1 answer
92 views

A generic error occurred in GDI+ (VB.NET)

A Generic error occurred in GDI+ (Vb.NET) Code for Save Button: If MessageBox.Show("Before continuing, make sure you profile picture doesn't contain any material that is sensitive or ...
Automie Is Here's user avatar
0 votes
0 answers
217 views

Capturing screenshots from games using Python results in a black screen

I'm trying to write a program to take a screenshot of my game and detect the rgb values of the pixel in the middle, in a loop. This was my initial code: import pyautogui def get_middle_pixel_color(): ...
oas333's user avatar
  • 101
0 votes
1 answer
61 views

SetWindowPos - resize just the rectangle below menu strip [duplicate]

I want to call SetWindowPos so that I make my window (but just the area below the menu) 400x400. How do I do that? Seems SetWindowPos includes also the menu. Basically I want an area in which I can ...
peter.petrov's user avatar
  • 38.5k
0 votes
0 answers
26 views

Restore world transformation exactly after change world transformation

The world transformation is internal stored in the dc with double precision. GetWorldTransform and SetWorldTransform works with single precision. So we can lost precision if we use this functions. An ...
AWirthK2's user avatar
0 votes
0 answers
112 views

Image not displaying properly using the most popular jpeg-decoder in rust

Simply trying to decode jpg data to bmp and display the result on screen using Windows GDI. Image did show on screen with correct size but looks mono and quite broken. I don't know how to debug this. ...
abcjeff's user avatar
0 votes
0 answers
34 views

Borderless Transparent QWidget' content not drawn when put inside another QWidget

In my project, I need to place a window inside the window containing the program icons on Windows desktop. The specific method is to use the Windows API to find the handle of that window, and then set ...
KeyboardMan's user avatar
3 votes
0 answers
262 views

Delphi 11.3: strange issue with "GDI Scaling" + bsNone BorderStyle on secondary form, wrong screen coordinates with multiple monitor setup

I'm experiencing a weird issue when I set "DPI Awareness" mode in the project options to "GDI Scaling" with a secondary form, where, if I set its BorderStyle to bsNone and change ...
hikari's user avatar
  • 3,403
0 votes
0 answers
147 views

Is there a win32 function to capture contents under the provided layered window?

I am developing a screen recording application in C using the win32 API. I have successfully made the capture, and the widget that I have the control buttons such as pause, etc. on. However, I have an ...
Germ's user avatar
  • 1
0 votes
0 answers
114 views

Subclassing RichEdit control causes text to no longer display

I tried subclassing the RichtextEdit control MSFTEDIT_CLASS to implement a custom colour for highlighting any selected text. // subclass the rich edit control SetWindowSubclass(hwndEdit, ...
Chuck's user avatar
  • 192
0 votes
0 answers
97 views

Implementing AlphaBlend in Print using C++

I want to use alpha-blending for my printer DC. However, in the printer driver, type 3 does not support AlphaBlend(). Starting with type 4, AlphaBlend() is supported. But I have to use alpha-blending ...
Seongtaek OH's user avatar
0 votes
0 answers
182 views

How to do bilinear interpolation of quad without banding artifacts and FAST?

I want to draw a rectangle such that each of its pixels are interpolated from the colors specified at its four corners, and it needs to be fast. I'm currently doing it by drawing two triangles, using ...
victimofleisure's user avatar
0 votes
0 answers
43 views

How to draw an image with transparency applied to the print HDC

I tried drawing an image using the existing DrawImage, but it was too slow, so I wrote the code below. IStream* pStream = NULL; HDC hDCImage = NULL; HDC hDCImageMem = NULL; HBITMAP hBitmap ...
Seongtaek OH's user avatar
1 vote
0 answers
71 views

C++ Windows window with opacity background nothing shows

I tried to create a window with a background with true opacity (only background opacity, not anything inside it). This is what I expecting it to be: But, in my project, when I start the program, ...
HelloGUI's user avatar
  • 161
0 votes
0 answers
71 views

How to draw a circle that is on top of all windows opened in Win10

I’m trying to use gdi+ to draw a circle on screen in Win10 with AHK, now I can manage to draw a circle anywhere I want, but the problem is I can’t make it on top of all windows, it could be covered by ...
Chen Jon's user avatar
0 votes
0 answers
150 views

Black screen when using Gdi Capture module on laptop

I found this module online called gdi_capture and used it to take screenshots of applications every few seconds. Initially it works fine on my desktop. But when I tried it on my laptop, it started to ...
Derpy's user avatar
  • 3

1
2 3 4 5
44