|
Hi I'm using GDI+ for a C++ application which is a great library. But this library sooo powerfull is not able to do a simple thing I need to do
I have a picture 1 x 10 px that I want to stretch to a very flat 100 x 10 px. As result I have a wonderful alpha gradient which is not what I want. Of course I tried to change the interpolation mode to InterpolationModeNearestNeighbor which give me a better result but still not perfect since and - I don't why - the area painted is not completly filled.
There is the very simple code :
// Load in some initialisation function
// a 1 x 100 picture sized
m_pBitmap1 = Bitmap::FromFile( csFilename.AllocSysString() );
// Then in onpaint method
CPaintDC dc(this);
Graphics graphics(dc.m_hDC);
graphics.SetInterpolationMode( InterpolationModeNearestNeighbor );
graphics.DrawImage(m_pBitmap1, 0, 0, 100, m_pBitmap1->GetHeight());
Can somebody provide me some explainations or even better... a solution ?
Thanks
|
|
|
|
|
Maybe I am missing something, but why not just use the GDI function StretchBlt . It does not do any of the funky gradient stuff you don't want. Use Graphics::GetHDC to get the HDC handle, and then call Graphics::ReleaseHDC when you are done. It is a very simple way to mix GDI and GDI+ in the same drawing routine.
"You're obviously a superstar." - Christian Graus about me - 12 Feb '03
"Obviously ??? You're definitely a superstar!!!" mYkel - 21 Jun '04
Within you lies the power for good - Use it!
|
|
|
|
|
Actually, if the stretch blt mode is HALFTONE (anti-aliasing), the image will indeed be alpha blended. Very annoying when you don't want it turning your image into a gradient, but do want a bit of smoothing on the edges. Take a look at SetStretchBltMode if you're curious.
Chris Richardson
|
|
|
|
|
I haven't tought to mix GDI and GDI+, that's definitely a good idea..
Thank you for the explanations about the anti-aliasing processing.
thanks, thanks, thanks
|
|
|
|
|
Hi,
is there a way to get a pointer to controls on a dialog, when
I don´t know the IDC_... of those controls.
I only have a pointer to the window on wich the controls are such as:
HWND *hWnd;
hWnd = GetForegroundWindwow() ...
Can someone show me a solution ?
Thanks, John
|
|
|
|
|
EnumChildWindows - The EnumChildWindows function enumerates the child windows that belong to the specified parent window by passing the handle to each child window, in turn, to an application-defined callback function. EnumChildWindows continues until the last child window is enumerated or the callback function returns FALSE.
|
|
|
|
|
In my main program, I am trying to create a Dialog, where along with the CFileDialog, I should also be able to have my active X. The trouble, I have is that the dialog doesn't show up ance I add the activeX. Without the Active X, It works O.K. Any suggestions would be appreciated.
I am following the example from David J. Kruglinski's Programming Microsoft Visual C++
Thanks in advance
|
|
|
|
|
Hi All,
I just want to disable the ability to switch to other Windows programs, when my programing is running(just like as the login prompt). I thought of using "SetSysModalWindow" but it now it comes under the Obsolete command set. Is there any other method by which we can achieve the same.
Thanx in advance
Sujan
|
|
|
|
|
Two parts required:
1. Install low level keyboard hook and intercept keystrokes that allow you to switch between program, like ALT+TAB for example.
2. Modify the system policy so that the task manager is not invoked.
|
|
|
|
|
Part three: Wait for your users to complain like hell, and rightly so.
Neville Franks, Author of ED for Windows www.getsoft.com and coming soon: Surfulater www.surfulater.com
|
|
|
|
|
In the case of our application, we do it for security reasons.
Don't want the operator to switch to Solitaire when he should be monitoring the nuclear power plant status...
|
|
|
|
|
Blake Miller wrote:
In the case of our application, we do it for security reasons.
Don't want the operator to switch to Solitaire when he should be monitoring the nuclear power plant status...
That's fine, but I have to wonder whether the original posters app truly has these constraints. There seems to be more and more posts about folks wanting to add global hooks and muck with other applications and that worries me.
Neville Franks, Author of ED for Windows www.getsoft.com and coming soon: Surfulater www.surfulater.com
|
|
|
|
|
Hi Neville,
Our need was also something like blake's. we just want to user to use only our application when our program is running.
Thanx
Sujan
|
|
|
|
|
Blake Miller wrote:
Don't want the operator to switch to Solitaire when he should be monitoring the nuclear power plant status...
Use Windows in a critical application? Shudder.
|
|
|
|
|
Hi Blake,
Thanx for your reply. Now i am implementing it only. I was just curious to know whether there is something like SetSysModalWindow. I got another new concept "GINA". i am reading it also.
Any way Thanx a lot
Sujan
|
|
|
|
|
How can I send a WM_Quit message to a process when all i have is its PID?
Ray
|
|
|
|
|
Perhaps EnumThreadWindows can help.
Don't try it, just do it!
|
|
|
|
|
Hi,
I have created a MDI sing MFC Application.
When I run the application, single empty childframe appears, which i don't want.
Only when the click the 'New' menu/Icon, a new childframe should appear.
Initially, no document should appear.
Could somebody please help me on this. I thank in advance.
Thanx
Mughi
|
|
|
|
|
Add this code to your application InitInstance() just before the call to ProcessShellCommands()
// stop a new document being created if just run normally
if (cmdInfo.m_nShellCommand == CCommandLineInfo::FileNew)
{
cmdInfo.m_nShellCommand = CCommandLineInfo::FileNothing;
}
If you vote me down, my score will only get lower
|
|
|
|
|
Thank You Roger Allen. It working perfectly.
Thanx
Mughi
|
|
|
|
|
hi!
i wrote an app which captures live video using the directshow api from a webcam. this works fine only when the hardware format is set to RGB (fourcc=0). when the fourcc is different like I420, the video of course is broken. do i need to use the ICDecompressOpen etc. methods to decomress the compressed frame from the DD buffer or is there a better way of decompressing the frames to RGB?
thanks for any hints
|
|
|
|
|
Hi,
Is there any way to get documentation about a visual c++ .dsp file?
I would like to be able to add parameters in the .DSP file. (environment variables for example)
Anyone could give me a good tutorial/link/documentation about this issue?
Thank you,
Jens
|
|
|
|
|
I've written code to read .DSP and .DSW files for ED (see sig). However I'm only interested in extracting folder and filenames and I don't write back to the files. If that's of any interest email me and I'll send you the code.
Neville Franks, Author of ED for Windows www.getsoft.com and coming soon: Surfulater www.surfulater.com
|
|
|
|
|
Hi Franks,
First of all, I am very interested in reading your code that can examine a .dsp file (.dsw is alsoo interesting).
I want to have a better look at what a .dsp contains and really needs.
Can I have your e-mail address please?
Best Regards,
Jens
|
|
|
|
|