In Windows, there seems to be at least two ways to get to the frame buffer: GDI and DirectX.
The problem is that in order to use GDI or DirectX, it seems that you must be running a GUI application, and then from this application you can call the appropriate GDI and DirectX functions. For example:
#include <windows.h>
int WINAPI WinMai...
I have a rounded rectangle that I make like so
dc.RoundRect(textBorder, CPoint(20, 20));
Later on I draw a line through it about 1/3 of the way down.
dc.LineTo(textBorder.right, textBorder.top + 15);
Now I would like to fill just the part above the line with a solid color. In other words I need to fill a partially rounded rectan...
How can I programmatically detect if a thread has windows handles on it for a given process?
spy++ gives me this information but I need to do it programmatically.
I need to do this in C#, however the .net diagnostics libs don't give me this information. I imagine spy++ is using some windows api call that I don't know about.
I have ac...
First some context:
I have a Microsoft Access 2000 project (ADP file) accessing a SQL Server 2000 Database.
The main form of that application has a lot of controls and subforms.
On one of the subforms which contain a summary of some information about companies, each record has two buttons that lead to a search form that access a web ser...
i was told to design a paintbrush program in 2 variation , one that uses lots of space and little cpu and the other vice versa.
the idea (as i was told- so not sure) is somehow to save the screen snapshots versus saving XOR maps (which i have no idea what it means) who represent the delta between the painting.
can someone suggest a wa...
I'm adding SVG export support to an old application built with MFC and using plain old GDI. As SVG 1.1 doesn't support text wrapping, I am forced to do this manually.
The application provides me with a CFont instance (which contains an HFONT). I can calculate the width of a piece of text using CFont::GetTextExtentPoint(), but I haven't ...
These days, I tries to create a hiden WebBrowser control in my program, and Using the IViewObject interface draw to my custom DC.
The result is fine, I got All the content I want, but the Draw speed is unacceptable, especially some complex web pages which contains Flash objects, Each Draw to DC cost more than 100 ms. So the flash object...
I am looking for any example code or libraries to perform image morphing in C#. For example, taking two images, defining common points and "merging" the features. My google search failed me, unless the only option is to write this from scratch? Many thanks
...
I'm performing rotation while resizing a JPEG image using GDI+.
If I use Image.RotateFlip(RotateFlipType) when saving a JPEG, it works great. When I pass in any of the Encoder.Transformation parameters, I get a "Parameter is not valid." ArgumentException.
I've read that using the Encoder.Transformation parameters during the save proces...
Summary
Using Windows GDI to convert 24-bit color to indexed color, it seems GDI chooses colors which are "close enough" even though there are exact matches in the supplied palette.
Can anyone confirm this as a GDI issue or am I making a mistake somewhere?
Maybe there's a "please check the whole palette for color matches" flag which I...
HDC hdcScreen = GetDC(NULL);
HDC hdcWindow = GetDC(mWin);
HDC hdcMem = CreateCompatibleDC(hdcScreen);
if (!hdcScreen || !hdcWindow || !hdcMem){
MessageBox(NULL, "could not locate hdc's", "Viewer", MB_ICONERROR);
}
if (!StretchBlt(hdcMem, 0, 0, 300, 300, hdcScreen, 0, 0, 300, 300, SRCCOPY)){
MessageBox(NULL, "stretchblt failed", "Viewe...
I am doing sort of a limited graphics editor in a desktop application in c# 3.5 GDI. the user first selects an image which is shown in a picturebox control which is smaller in size so image resizing is done to fit the picture.
For cropping, the user selects the area to crop. there are a number of example on the net that explains how to...
I have a need to do some drawing using win32/GDI (Native, not .NET), and I've run into the following problem:
I need to draw lines that are "styled." For example, in the attached image, the line marked "A" is a straight line as far as my application data is concerned, it just needs to be drawn with the additional zigzag as a style. Of c...
I am currently using the System.Drawing.Graphics.DrawString() method in .Net to draw text on top of an image, and then save it to a new file:
// define image file paths
string sourceImagePath = HttpContext.Current.Server.MapPath("~/img/sourceImage.jpg");
string destinationImagePath = HttpContext.Current.Server.MapPath("~/img/") + "final...
If I have a window that spans both monitors on a multimonitor system, I can't seem to erase (paint black) the entire window. Instead, only the primary window is drawn black. The secondary remains the original white color. Has anyone seen this behavior?
wxwidgets:
wxClientDC dc(this);
Erase(dc);
void SpriteWindowFrame::Erase(wxDC& d...
I've been fussing with this for the better part of the night, so maybe one of you can give me a hand.
I have found GDI+ DrawImage in C# to be far too slow for what I'm trying to render, and from the looks of forums, it's the same for other people as well.
I decided I would try using AlphaBlend or BitBlt from the Win32 API to get better...
Am i allowed to use a DC outside of a paint cycle?
Is my window's DC guaranteed to be valid forever?
i'm trying to figure out how long my control's Device Context (DC) is valid.
i know that i can call:
GetDC(hWnd);
to get the device context of my control's window, but is that allowed?
When Windows sends me a WM_PAINT message, i am ...
I created DIBPATTERN pens with ExtCreatePen API for custom pattern pens.
It sucessfully draws desired lines on Windows XP,
But on Windows 7 (x64 for my case), it does not draw any lines; no changes on screen.
(Other simply created pens, for example CreatePen(PS_DOT,1,0), are working.)
I found that calling SetROP2(hdc, R2_XORPEN) make...
I'm trying to draw some bitmap on a CImage object using GDI+ DrawImage. The resulting CImage bitmap seems to be premultiplied by alpha but I can't find any mention of that in the msdn documentation.
What happens when I draw using DrawImage over an CImage HDC ?
...
Hi,
I am trying to use the GDI GradientFill function to draw on a offscreen bitmap, then BitBlt that to the screen.
But I always get a black bitmap... if I GradientFill directly to the screen it works.
Below is a sample app to see what I mean.
#pragma comment(lib, "msimg32.lib")
#include <windows.h>
const CHAR c_szWndClass[] = "Grad...