|
Did you write the software? If not, then the vendor's website is probably a better place for
answers than this programming forum.
Mark
"If you can dodge a wrench, you can dodge a ball."
|
|
|
|
|
vimal_yet wrote: If U Get Errors U Will Learn
If U Don't Get Errors U Have Learnt
I hate to tell you this, but your sig is wrong. If you don't get errors, it just means that you haven't been thorough enough in your testing.
Deja View - the feeling that you've seen this post before.
|
|
|
|
|
vimal_yet wrote: If U Get Errors U Will Learn
If U Don't Get Errors U Have Learnt
We learn by the mistakes we make. If you don't make mistakes you learn nothing. You will always make mistakes.
|
|
|
|
|
Colin Angus Mackay wrote: We learn by the mistakes we make. If you don't make mistakes you learn nothing. You will always make mistakes.
Indeed. It is a mistake to think you will make no mistakes.
Deja View - the feeling that you've seen this post before.
|
|
|
|
|
Hi everyone.
Does anyone have experience in developing an equalizer with DirectX? I really damned with Directx.Sound. Thanks.
|
|
|
|
|
You want to do an audio equaliser ? this is the graphics forum.
Christian Graus - Microsoft MVP - C++
Metal Musings - Rex and my new metal blog
"I am working on a project that will convert a FORTRAN code to corresponding C++ code.I am not aware of FORTRAN syntax" ( spotted in the C++/CLI forum )
|
|
|
|
|
Hi.
I have (in my oppinion) a VERY annoying and wierd problem. I'm using UpdateLayeredWindow() according to the code below. I do the FillRect() just for testing. But when I do this UpdateLayeredWindow() returns 0 which, according to the msdn documentation, indicates that the function failed and more info should be in GetLastError(). However, if I call GetLastError() just after UpdateLayeredWindow() it simply returns 0, indicating that there was no last error. I have remembered to set WS_EX_LAYERED...
Could it be that FillRect() doesn't set any alpha information? Any ideas? Thanks.
<br />
HDC dcScreen = ::GetDC(NULL);<br />
HDC dcMemory = ::CreateCompatibleDC(dcScreen);<br />
HBITMAP bmpMemory = ::CreateCompatibleBitmap(dcScreen, 500, 500);<br />
<br />
::SelectObject(dcMemory, bmpMemory);<br />
<br />
BITMAP bitmap;<br />
GetObject(bmpMemory, sizeof(BITMAP), &bitmap);<br />
<br />
RECT rc = {0, 0, 100, 100};<br />
::FillRect(dcMemory, &rc, ::GetSysColorBrush(COLOR_HIGHLIGHTTEXT));<br />
<br />
BLENDFUNCTION bf = {AC_SRC_OVER, 0, 255, AC_SRC_ALPHA};<br />
<br />
UpdateLayeredWindow(m_hWnd,<br />
dcScreen,<br />
NULL,<br />
NULL,<br />
dcMemory,<br />
NULL,<br />
0,<br />
&bf,<br />
ULW_ALPHA);
|
|
|
|
|
Since you're specifying the source DC (dcMemory), I would try passing values for arguments 3,4 & 6 (i.e., the various size and positions). Argument 6 should just be the address of a POINT with value (0,0).
I use this function all the time, and that's what I do (returns non zero - and it works of course )
|
|
|
|
|
I have a 32 bit bitmap that I want to convert to a 1 bit monochrome bitmap but the problem is that it has all it's alpha bits set to 0xFF. This results in the monochrome bitmap being all black. Is there an easy way, short of the GetDIBits()-traverse-SetDIBits() route, to set all the alpha bits to 0x00?
You may be right I may be crazy -- Billy Joel --
Within you lies the power for good, use it!!!
|
|
|
|
|
Having an alpha of FF is the correct starting point - something else is going wrong. An alpha of FF is fully opaque; if you set the alphas to all 00, the resulting bitmap would be 100% transparent.
|
|
|
|
|
Then my problem must be elsewhere.
pja::CBitmap bmp1(IDB_BITMAP1);
pja::CBitmap bmp2(IDB_BITMAP2);
pja::CBitmap bmpbw = CreateBitmap(bmp1.Width(), bmp1.Height(), 1, 1, NULL);
ShowGraphic(bmp1);
ShowGraphic(bmp2);
pja::CCompatibleDC dc1;
pja::CCompatibleDC dc2;
pja::CCompatibleDC dcbw;
SelectObject(dc1, bmp1);
SelectObject(dc2, bmp2);
SelectObject(dcbw, bmpbw);
BitBlt(dc1, 0, 0, bmp1.Width(), bmp1.Height(), dc2, 0, 0, 0x00990066);
ShowGraphic(dc1);
SetBkColor(dc1, RGB(255, 255, 255));
BitBlt(dcbw, 0, 0, bmpbw.Width(), bmpbw.Height(), dc1, 0, 0, SRCCOPY);
ShowGraphic(bmpbw);
The final step does not work, the b&w bitmap is all black. If I change my display settings to 16 or 24 bit then this code works perfect. The only time it has a problem is with 32 bits, that is why I suspected the alpha bits as being the cause.
So Ok, same question but opposite. How to ensure all alpha bits are 0xFF if they are 0x00?
You may be right I may be crazy -- Billy Joel --
Within you lies the power for good, use it!!!
|
|
|
|
|
Nope, I was not mistaken. Changing the alpha bits from 0xFF to 0x00 solved the problem.
But I still would like to know if there is an easier way than the GetDIBits()-traverse-SetDIBits() method that I have used so far.
You may be right I may be crazy -- Billy Joel --
Within you lies the power for good, use it!!!
|
|
|
|
|
The solution to set all the alpha bits to zero is actually quite simple (now that I know it). It involves a white brush, the PatBlt function, and the DPa ROP.
SelectObject (dc1, GetStockObject(WHITE_BRUSH));
PatBlt (dc1, 0, 0, bmp1.Width(), bmp1.Height(), 0x00A000C9);
Now that is a lot simplier code than going through all the steps required for the GetDIBits() /SetDIBits() method I have been using.
You may be right I may be crazy -- Billy Joel --
Within you lies the power for good, use it!!!
|
|
|
|
|
Hi,
I am not sure but this section seems the most suitable one. I want to clear a partial area of a bitmap using graphics object in c#. I also mean making it transparent by "clear". Is it possible? How?
What i am trying to do is; I am drawing a rectangle on a transparent bitmap and displaying it in the picturebox. There is another image at the background of picturebox. And I want to highlight and move that rectangle without clearing whole image and redrawing it. Any ideas?
Thanks for any comments and directings..
oktay
|
|
|
|
|
Could you use a layered approach?
Have your picture box at the back,
the bitmap above that,
then draw a repeated black texture on top of it all.
This is assuming I got it right, that you want the rectangle to cover up some part of a bitmap which displays over some sort of semi-visible background.
Yet another spam post on yet another forum!
I am the lazy one, who sleeps as it suits him, codes what he wishes, and has many years to look forward to.
I love being a student.
|
|
|
|
|
how can i change forms caption and borders?
i wanna have caption in new color and shape with custom title and position and new color for borders
many skin designers dont support rtl layout and i wanna design one myself
|
|
|
|
|
|
Does anyone know of any libraries for reading JPEG Extended files ( which I believe are 12 bit ), preferably in .NET ?
Christian Graus - Microsoft MVP - C++
Metal Musings - Rex and my new metal blog
"I am working on a project that will convert a FORTRAN code to corresponding C++ code.I am not aware of FORTRAN syntax" ( spotted in the C++/CLI forum )
|
|
|
|
|
Hey Christian,
Do you have a sample image I can borrow?
Mark
"Great job, team. Head back to base for debriefing and cocktails."
(Spottswoode "Team America")
|
|
|
|
|
I am not sure. The images are being passed to me inside a DICOM image. I don't know for sure if the tag is correct in all cases, some of hte images I have tagged as JPEG Extended, may be plain old JPEGs.
I can pull some out and look for one that GDI+ doesn't open.
Christian Graus - Microsoft MVP - C++
Metal Musings - Rex and my new metal blog
"I am working on a project that will convert a FORTRAN code to corresponding C++ code.I am not aware of FORTRAN syntax" ( spotted in the C++/CLI forum )
|
|
|
|
|
OK, I have one, where do I send it ? Sending a private message to me on CP won't work right now, send it instead to christian dot graus, that's my gmail address.
Christian Graus - Microsoft MVP - C++
Metal Musings - Rex and my new metal blog
"I am working on a project that will convert a FORTRAN code to corresponding C++ code.I am not aware of FORTRAN syntax" ( spotted in the C++/CLI forum )
|
|
|
|
|
|
Richard A. Abbott wrote: Don't know how deep your pockets are
These are the clowns I am trying to avoid. I've had no good dealings with them, and they are ridiculous in their pricing.
Richard A. Abbott wrote: but you might find this interesting reading
Thanks, I will check it out.
Christian Graus - Microsoft MVP - C++
Metal Musings - Rex and my new metal blog
"I am working on a project that will convert a FORTRAN code to corresponding C++ code.I am not aware of FORTRAN syntax" ( spotted in the C++/CLI forum )
|
|
|
|
|
Help! I'm working on a control that does a fair amount of work to render itself. I've got it set up where it basically does all of its drawing to a bitmap that it holds on to, and then in the Paint method just copies the data from the bitmap to the client area, depdning on how much of it is currently visible, zoom factor, etc. Certain operations by the user can cause this bitmap to need to be redrawn. This is a time consuming operation (might take 5-10 seconds), and I'd like to update the bitmap in a worker thread, so that the app doesn't freeze while its doing its rendering. Anyone know how to go about this?
I created a BackgroundWorker, as follows:
I initialize the worker here:
worker = new BackgroundWorker();
worker.WorkerReportsProgress = false;
worker.WorkerSupportsCancellation = false;
worker.RunWorkerCompleted += new RunWorkerCompletedEventHandler(worker_RunWorkerCompleted);
worker.DoWork += new DoWorkEventHandler(worker_DoWork);
Then, if my bitmap needs to be redrawn, I start it here:
worker.RunWorkerAsync();
void worker_DoWork(object sender, DoWorkEventArgs e)
{
// Create a new bitmap for the log
int width = (int)Math.Round(Width * fDPIX);
int height = LogHeightPixels;
bmp = new Bitmap(width, height);
DrawLogToBitmap(bmp);
e.Result = bmp;
}
void worker_RunWorkerCompleted(object sender, RunWorkerCompletedEventArgs e)
{
Bitmap bmpNew = (Bitmap)e.Result;
if (bmp != null)
{
bmp.Dispose();
bmp = null;
}
bmp = bmpNew;
}
In the DoWork handler, I create a new bitmap, do the drawing, and then assign the bitmap to the Result parameter in the RunWorkerCompletedEventArgs. It looks fine here, but then I get back to the main thread (in the RunWorkerCompleted) and the bitmap looks like garbage there.
Any ideas what I might be doing wrong?
Thanks In Advance,
Aaron
|
|
|
|
|
What language is that code in?
If the "bmp" created in worker_DoWork is the same one disposed of in worker_RunWorkerCompleted,
and it's the same one passed in e.Result, then doesn't
Bitmap bmpNew = (Bitmap)e.Result; <-- isn't bmpNew == bmp here?
if (bmp != null)
{
bmp.Dispose();
bmp = null;
}
bmp = bmpNew;
}
dispose the bitmap before you use it?
"Great job, team. Head back to base for debriefing and cocktails."
(Spottswoode "Team America")
|
|
|
|
|