|
maybe it is some helpful to you Here[^]
whitesky
|
|
|
|
|
I have found some rather strange behaviour with GDI calls when used with an memory HDC. If you create the HDC, associate it with a 32 bit DIB i.e. BGRA channels, then initialize the DIB memory to have 0xFF set for all the alpha values, and then use GDI calls like Rectangle/Ellipse/Polygon, etc, the alpha values will get overwritten! They will always be reset back to 0! Is this by design? Is there a workaround?
¡El diablo está en mis pantalones! ¡Mire, mire!
Real Mentats use only 100% pure, unfooled around with Sapho Juice(tm)!
SELECT * FROM User WHERE Clue > 0
0 rows returned
Save an Orange - Use the VCF!
|
|
|
|
|
I would expect this is probably by design since RGBQUAD has the same ordering (assuming the reserved byte is alpha in RGBQUAD) as the GDI+ Color object. I would also suspect that your Red and Blue components are switched since GDI uses COLORREF.
I like to embed my ARGB Color objects into COLORREF structures so I can easily serialize them with CArchive. However, I must be careful as the Red and Blue are switched so I can't use them directly in GDI calls without bit shifting them around. The alpha always gets lost if I use the RGB macros on them so I'm guessing the GDI calls for LineTo, Rectangle, Ellipse use those macros internally which should strip off any alpha that was inserted in the structure.
I'm curious to see if your Red and blue are switched as this would further confirm my suspicion. If not, my theory is bust methinks.
For what it's worth
-- modified at 20:42 Saturday 3rd June, 2006
Oops. I got myself mixed up. Scratch what I said about the MACROS as that didn't quite make any sense now that I reread it while reading your reply. The alpha gets removed using
COLORREF colorRGB=colorARGB.ToCOLORREF();
instead of
COLORREF colorRGB=Color::MakeARGB(255,255,0,0);
I need to get some sleep
One thing that catches my attention is the alpha value. I'm used to 0xFF being completely opaque while 0x00 being transparent.
|
|
|
|
|
No the red and blue colors seem fine - it's just the alpha values that get overwritten. What surprising is that ALL the values get overwritten. So if I have an image of 500 X 500 pixels and only draw a rect at 10, 10, 20, 20, all alpha values get stripped to 0 for the whole image, not just the affected area.
¡El diablo está en mis pantalones! ¡Mire, mire!
Real Mentats use only 100% pure, unfooled around with Sapho Juice(tm)!
SELECT * FROM User WHERE Clue > 0
0 rows returned
Save an Orange - Use the VCF!
|
|
|
|
|
Can any one tell me how can i get a good tutorial about WinFX.
I want to study either WinFX or Win32.What should i select.
aLi
|
|
|
|
|
|
Function AlphaBlend didn't worked in my project, but when I added "msimg32.lib" in compilator settings (project/settings/link --> "object/library modules") it stardet working fine.
But there's another problem:
constant AC_SRC_ALPHA from structure BLENDFUNCTION is unknown. Compilator throws this error:
error C2065: 'AC_SRC_ALPHA' : undeclared identifier
Can you help me?
~~~~
|
|
|
|
|
You probably need to download the platform SDK. In addition, you'll need to make sure the platform SDK headers are getting picked up. If you using Visual C++ 6, then you need to go to Tools > Options click on the Directories tab, select Include Dirs, and make sure that the path to the Platform SDK includes are FIRST, before the rest of the headers.
¡El diablo está en mis pantalones! ¡Mire, mire!
Real Mentats use only 100% pure, unfooled around with Sapho Juice(tm)!
SELECT * FROM User WHERE Clue > 0
0 rows returned
Save an Orange - Use the VCF!
|
|
|
|
|
Whats your application type?
whitesky
|
|
|
|
|
It's MDI, and I'm using Visual C++ 6.0.
~~~~
|
|
|
|
|
hallo
is anybody out there who has used the OSK.EXE inside W2K or XP to communicate with a C/C++-program. the question is not to start/end this application but how to communicate with it char by char.
Any idea ?
best regards
simon
|
|
|
|
|
I am a C# devoloper. I want to ask whether it is good to learn C++/MFC since now most application are always devoloped using C#/VB.Net.
aLi
|
|
|
|
|
Musfsdfsdf wrote: since now most application are always devoloped using C#/VB.Net
(Back to reality...)
It's never a good time to learn MFC. Microsoft likes to introduce a great library and then deprecate it. They will abandon .NET soon enough so don't worry.
Learning C++ is not for anyone who considers VB or VB.NET a "swell language" but for those that embrace C#, you can adapt but users of higher level libraries almost always have trouble understanding "why" we do it this way. A small (OK somewhat larger than small) proportion of us "accidently" embraced MFC some years back since it was easier to use than raw Win32 and now we find that addictions are hard to break. We are the unfortunate ones. Oddly enough, some of us still use it for our development but I would not recommend going down that road since Microsoft has taken every measure to bury it and I can say that I feel that pain. Most now say to learn Win32 since pointers are about the only thing that has changed in 64-bit programming so Win32 is alive and well for some time to come. Steer clear of MFC if possible.
Not sure if that helps.
|
|
|
|
|
|
Very good, thanks (apart from Microsoft using 'leverage' as a verb...).
Elaine
The tigress is here
|
|
|
|
|
I believe it is good idea to learn C++ and/or MFC (and, perhaps Win32) if you plan to be a programmer for hire. Large corporations don't usually adapt the cutting-edge technology until they feel threre is a business need for it or they are forced to adapt because it is the only feasible option. So, the more tools you have at your disposal; the better chances you have to keep or obtain a decent job.
|
|
|
|
|
Hallo
I'd like to change the chars printed unsing HEX.
Sample:
<br />
int nHex = 0xABCDEF;<br />
char nHexText[7];<br />
sprintf(nHexText,"%x",nHex);<br />
By now i convert as hex to string and use some macros for each char to convert.
Is there any posibility to change the symbol by just using sprintf ??
THX
Timen
|
|
|
|
|
tbrake wrote: change the symbol
I'm not sure what symbol is referring to.
tbrake wrote: now i convert as hex to string
On a side note, "hex" is not a number, it is a radix for representing the number value in some base or number system. You can view a number using any radix you desire. Whether you choose to look at it in base-2, 10, 16, 32 does not change the number.
Anyway, if possible, please clarify your question.
|
|
|
|
|
hallo
OK radix ... will look up this just after this mail..
I mean Displaying Hex as String measn unsing the symbols
0 1 2 3 4 5 6 7 8 9 A B C D E F
Now i need
0 1 2 3 4 5 6 7 8 9 : ; < = > ?
I know this is strange but i have some old hardware - this is only able to understand these symbols no hex !!! and the second problem is i need a very fast calculation.
THX
|
|
|
|
|
Wait a minute, one an earlier thread today you stated...
tbrake wrote:
Hallo
1. Well at least it makes sence. cause i have to controll some hardware. To calculate the needed commands the shortes way is to interprete int as Hex bit shift this and the result is the needed command.
I apologize but this is making no sense. I would love to help but I've been burned by questions that didn't describe the problem correctly. I would spend my valuable time working out a solution to help out a fellow CP member only to find out later on that the problem context was different enough to warrant a totally different solution thus rendering my code snippets useless. Are you sure you need a character translation for the hex representation of a number?
|
|
|
|
|
does the solution require that you send the indivdual characters representing the number or sending the number itself?
|
|
|
|
|
I am not sure but i think i need the numeric interpretation.
The controller is a GPIB card (16 BIT connector) - to the receiver there is an initialisation string send to as char "N00,TH0,V0123456789:;<=>?\n" changing anything here will end up in errors.
...
ah i think i can do this like :
<br />
int hex = 0x2ABCDEF;<br />
cmd[0] = ((hex & 0x0F000000)>>24)+48;<br />
cmd[1] = ((hex & 0x00F00000)>>20)+48;<br />
cmd[2] = ((hex & 0x000F0000)>>16)+48;<br />
cmd[3] = ((hex & 0x0000F000)>>12)+48;<br />
...<br />
OK i try this
THX
Timen
|
|
|
|
|
a rgn, for easy, lets say a rect (10,10,100,100)
I hope all lines drawn are inside the rect with any thickness of pen.
FrameRgn works fine for the purpose on screen, but it is so ugly on printer.
My Q:
how to ensue Polygon() draws lines inside the rect with any thickness of pen?
|
|
|
|
|
Here's some code to get the wheels turning. I used a couple of different things and meshed them together.
For what it's worth...
CPen pen;
CPen* pOldPen;
LOGBRUSH logBrush;
logBrush.lbStyle=BS_SOLID;
logBrush.lbColor=RGB(255,0,0);
logBrush.lbHatch=NULL;
if (pDC->BeginPath()) { // Start defining Path
CRect rect(0,0,150,150);
pDC->Rectangle(&rect); // Define the shape for the path
if (pDC->EndPath()) { // Finish defining path
CRgn rgn;
rgn.CreateFromPath(pDC);
if (pDC->SelectClipRgn(&rgn,RGN_COPY)) { // New clipping region
for (int i=0;i<150;i+=15) {
pen.CreatePen(PS_SOLID|PS_ENDCAP_SQUARE|PS_GEOMETRIC,(i/15),&logBrush,0,NULL);
pOldPen=pDC->SelectObject(&pen);
pDC->MoveTo(CPoint(i,150));
pDC->LineTo(CPoint(i+150,0));
pDC->SelectObject(pOldPen);
pen.DeleteObject();
}
}
}
}
|
|
|
|
|
I hope nothing to be clipped.
|
|
|
|