|
I have a 32bit bitmap with alpha channnel . I am drawing it using gdi+ . but I am not getting the transparency . How to get the transparency usnig gdi+
Rajesh
|
|
|
|
|
How are you drawing it? Do you have any code you can share? (small piece)
|
|
|
|
|
Graphics graphics(hdc);//Handle to the device context
//Load the image from a file
Image image(L"test.bmp",FALSE); // test.bmp is 32bit with alpha channels for transparency
graphics.DrawImage(&image,0,0,image.GetWidth(),image.GetHeight());
Rajesh
|
|
|
|
|
You have to specify Colormatrix and load it via ImageAttributes'
SetColorMatrix() before using DrawImage()
Regards,
Spk
|
|
|
|
|
What will be color matrix values ???
Rajesh
|
|
|
|
|
Thats based upon your requirement... if you need to convert 80% of the bitmap alpha values use this sample one...
ColorMatrix colorMatrix = {1.0f, 0.0f, 0.0f, 0.0f, 0.0f,
0.0f, 1.0f, 0.0f, 0.0f, 0.0f,
0.0f, 0.0f, 1.0f, 0.0f, 0.0f,
0.0f, 0.0f, 0.0f, 0.8f, 0.0f,
0.0f, 0.0f, 0.0f, 0.0f, 1.0f};
ImageAttributes imageAtt;
imageAtt.SetColorMatrix(&colorMatrix, ColorMatrixFlagsDefault,
ColorAdjustTypeBitmap);
Regards,
Spk
|
|
|
|
|
you understand wrong . I have 32bit bmp and talking about the alpha channel tranparency . not opacity of image .
Rajesh
modified on Friday, July 23, 2010 7:50 AM
|
|
|
|
|
If you call GetPixelFormat() on a 32-bit bitmap (.bmp) loaded with Image, it will return PixelFormat32bppRGB.
I've found that using PNG images works.
|
|
|
|
|
Can you share with some piece of code for help me
Rajesh
|
|
|
|
|
It's exactly the same, just load a .PNG file that has an alpha channel.
|
|
|
|
|
bResult = AddPrinterDriver(NULL, 3, (LPBYTE) &di3);
TRACE("%d", (int) GetLastError());
if (!bResult)
return FALSE;
The call to AddPrinterDriver fails returning FALSE, and GetLastError() returns ERROR_IO_PENDING. The Error Lookup tool shows for this error "Overlapped I/O operation is in progress."
What does this mean, and what should I do to work around this problem?
There is sufficient light for those who desire to see, and there is sufficient darkness for those of a contrary disposition.
Blaise Pascal
|
|
|
|
|
If i check out the documentation of AddPrinterFriver[^], it doesn't mention anywhere that it sets the last error code in case of an error, are you sure you are not getting the error code of something called before AddPrinterDriver OR maybe something that was called inside AddPrinterDriver but doesn't really contain much of information about the problem?
> The problem with computers is that they do what you tell them to do and not what you want them to do. <
> "It doesn't work, fix it" does not qualify as a bug report. <
> Amazing what new features none of the programmers working on the project ever heard of you can learn about when reading what the marketing guys wrote about it. <
|
|
|
|
|
Strange, it used to say:
If the function fails, the return value is zero. To get extended error information, call GetLastError() .
"One man's wage rise is another man's price increase." - Harold Wilson
"Fireproof doesn't mean the fire will never come. It means when the fire comes that you will be able to withstand it." - Michael Simmons
"Man who follows car will be exhausted." - Confucius
|
|
|
|
|
Hi all,
I am trying to read a file from a device connected to a serial port. I am using CreateFile() and ReadFile() methods to read the file. But my problem is when i am not using FILE_FLAG_OVERLAPPED parameter my processing becomes slow. I wanted to know why this is happening??
Can anybody help me in this?
Thanks in advance
|
|
|
|
|
I think that is quite hard to guess without actually seeing what you do and how you do it. My guess is that without overlapping your program blocks on the read operatin until there's data available to be read so the processing becomes "blocky". Do you know the difference between overlapped and non-overlapped IO?
> The problem with computers is that they do what you tell them to do and not what you want them to do. <
> "It doesn't work, fix it" does not qualify as a bug report. <
> Amazing what new features none of the programmers working on the project ever heard of you can learn about when reading what the marketing guys wrote about it. <
|
|
|
|
|
If you have not read it before you MUST read: http://www.flounder.com/serial.htm[^]
You'd think working with a serial port be easy, but it's far from.
Good luck,
Iain.
I am one of "those foreigners coming over here and stealing our jobs". Yay me!
|
|
|
|
|
I would like to address several bytes of memory but different bits from different locations. The program I am using is on an embedded system and I need access to different pieces of the peripherals. Specifically when dealing with ports where something connected crosses multiple ports and I need a modular way to access them through a simple 'maskport = value' and you only need to modify some macros or a enum to change things instead of each functions code.
IS this even allowed or am I out to lunch? (I am using GCC)
For example: (this doesn't work btw but it was my attempt)
struct bits {
uint8_t b0:1;
uint8_t b1:1;
uint8_t b2:1;
uint8_t b3:1;
uint8_t b4:1;
uint8_t b5:1;
uint8_t b6:1;
uint8_t b7:1;
} __attribute__((__packed__));
#define SBIT(port,pin) ((*(volatile struct bits*)&port).b##pin)
struct FIELD {
uint8_t b0:1;
uint8_t b1:1;
uint8_t b2:1;
uint8_t b3:1;
uint8_t b4:1;
uint8_t b5:1;
uint8_t b6:1;
uint8_t b7:1;
};
struct FIELD test;
test.b0 = SBIT(0xE2, 0);
test.b1 = SBIT(0xE2, 4);
test.b2 = SBIT(0xE2, 7);
test.b3 = SBIT(0xEF, 2);
test.b4 = SBIT(0xEF, 3);
test.b5 = SBIT(0x07, 1);
test.b6 = SBIT(0x07, 5);
test.b7 = SBIT(0x07, 6);
test = 0x7A;
That way by assigning a value to test:
<br />
test = 0x7A;
0xE2:
<br />
0001 0000<br />
0xEF:
<br />
0000 1100<br />
0x07:
<br />
0010 0010<br />
|
|
|
|
|
If I understood, you can try with a union:
union FIELDEX
{
struct FIELD
{
uint8_t b0:1;
uint8_t b1:1;
uint8_t b2:1;
uint8_t b3:1;
uint8_t b4:1;
uint8_t b5:1;
uint8_t b6:1;
uint8_t b7:1;
} fld;
uint8_t val;
};
FIELDEX test;
test.val = 0x7A; // 0111 1010
test.fld.b0 = 1; // set bit 0
|
|
|
|
|
I would still have the problem of setting separate address bits, however your example would make a good compact bitfield definition.
I am trying to take bits from separate registers and create my own 'masked register' so when I write to my register it sends each bit to its specified bits in other registers.
test.b0 = SBIT(0xE2, 0);
test.b1 = SBIT(0xE2, 4);
test.b2 = SBIT(0xE2, 7);
test.b3 = SBIT(0xEF, 2);
test.b4 = SBIT(0xEF, 3);
test.b5 = SBIT(0x07, 1);
test.b6 = SBIT(0x07, 5);
test.b7 = SBIT(0x07, 6);
Hopefully this will show more clearly what I am after:
test = 0x7A;
|
|
|
|
|
Hi All
If I can delete a memory using delete keyword for memory allocated on heap using new keyword.
class A
{
} ;
A &a1 = * (new A ) ;
How to release memory which is holded by a reference.
|
|
|
|
|
This looks very ugly. Why do you need to have something like that ? I guess you need to revise your design a bit.
Anyway, did you try to delete the address of the reference: delete &a1; ? I never done this myself so I don't know if this works but it looks like the obvious solution.
|
|
|
|
|
delete &a1 is exactly what he has to do. It works perfectly.
It may sound unorthodox, but depends how a1 is used: if a1 participate into arithmetic expression of overloaded operators inside generic code, it cannot be a pointer, and *a1 may be not suitable for template function expecting references.
Generic programming changes a lot the "traditional rules".
(Note: you can also have a nullable reference as *(A*)0 that can be checked as !&a ).
2 bugs found.
> recompile ...
65534 bugs found.
|
|
|
|
|
|
Hi all,
i have an long string which displayed in Static text control but its not fully displayed,i want to display it in muliline if string is too long and not contain any new line or space.
please help me for this.
thanks in advance.
|
|
|
|
|
The default property of a 'static control' is to support text wrapping. Set the 'No Wrap' property to 'False' if it is set as True by mistake.
|
|
|
|