|
hi.
I use CImage to display *.png and *.gif, but the image don't transparent.
my code:
CImage img;
img.Load(_T("D:\\1.png"));
BOOL bIsTrans = img.IsTransparencySupported();
img.Draw(pDC->GetSafeHdc(), 20, 20);
help!
One world, one program!
|
|
|
|
|
|
I am working on Linux environment. I want convert a PGM file into PBM file.
Could you please guide me about the logic required to implement a Portable Bitmap file.
I mean how to deal in writing a hexadecimal values 0x80.
How to create a new byte.
Thank you very much in advance .
|
|
|
|
|
singh.vikas8508 wrote: I mean how to deal in writing a hexadecimal values 0x80.
What?
singh.vikas8508 wrote: How to create a new byte.
What do you mean, exactly?
If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler.
-- Alfonso the Wise, 13th Century King of Castile.
This is going on my arrogant assumptions. You may have a superb reason why I'm completely wrong.
-- Iain Clarke
[My articles]
|
|
|
|
|
Thank you very much for your reply...
I need logic to implement PBM file. I have raw data of PGM file. Now I want to convert it into Pixels of PBM.
Thats why I used 0x80.
Please send me if you have any other logic or idea.
|
|
|
|
|
Why don you use the libnetpbm library http://netpbm.sourceforge.net/doc/libnetpbm.html[^]? It looks promising.
If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler.
-- Alfonso the Wise, 13th Century King of Castile.
This is going on my arrogant assumptions. You may have a superb reason why I'm completely wrong.
-- Iain Clarke
[My articles]
|
|
|
|
|
No. we are not suppose to use built-in- libraries. We have to implement it in C language.
|
|
|
|
|
singh.vikas8508 wrote: No. we are not suppose to use built-in- libraries. We have to implement it in C language.
Is this a homework ? Because I don't see any valid reason not to use an existing library. That would be really stupid to reimplement everything yourself...
(and if you followed the link Carlo gave you, you could see that the library is written in C).
|
|
|
|
|
This is not a homework.this is a predefine formate which we have to follow. I have finished most part of this question like getting data from the PGM file , now i am looking to implement the PBM file .
|
|
|
|
|
Ok, but what forbids you to use external C libraries ? This will be much more efficient than redoing everything yourself.
On the other hand, if you really want to code everything yourself, you can simply look for the PBM file format[^]
|
|
|
|
|
|
It looks like a very simple file format. What is your trouble with?
If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler.
-- Alfonso the Wise, 13th Century King of Castile.
This is going on my arrogant assumptions. You may have a superb reason why I'm completely wrong.
-- Iain Clarke
[My articles]
|
|
|
|
|
|
if i have understood your problem correctly then it is only with writing bits and hexa values to a file.
if iam right, then please specify your task clearly. we shall attempt it.
did you mean to convert the 0x80 to bits or vice versa?
--------------------------------------------
Suggestion to the members:
Please prefix your main thread subject with [SOLVED] if it is solved.
thanks.
chandu.
|
|
|
|
|
|
please detail your problem to manipulate on bits and hexas.
like what is the input you are getting from source file and how you want it to be written to the dest. file.
an example would be apprieciated.
as Cedric Moonen said, hexa,decimal,binary are only our interpretations. the data that will be stored in memory will be any way 0s and 1s.
--------------------------------------------
Suggestion to the members:
Please prefix your main thread subject with [SOLVED] if it is solved.
thanks.
chandu.
|
|
|
|
|
|
singh.vikas8508 wrote: I am getting binary data of PGM file.
how are you getting it? i mean if you have got a byte, does it contain one pixel information or one full row(6 pixels in you 'J' example case)
singh.vikas8508 wrote: I have got height and width of this PGM file.
good
singh.vikas8508 wrote: I need to write PBM file of that data.
what should the first byte of that pbm file contain apart from header in your 'J' example case.
singh.vikas8508 wrote: I will have a threshold value on the basis of that value I can put 0 and 1 into the PBM file.
what is this threshold value again?
unless your question is very specific, it cannot be attempted. try to put your post into different words than those u used in the earlier posts.
--------------------------------------------
Suggestion to the members:
Please prefix your main thread subject with [SOLVED] if it is solved.
thanks.
chandu.
|
|
|
|
|
I think your biggest trouble comes from the fact that you don't really understand what hexadecimal notation really is. Hexadecimal is just used as a representation for data: a number can be represented in hexadecimal, deciaml, binary or whatever but the number itself is always the same (and has nothing to do with its representation). So, you don't 'write' hexadecimal data to a file, you just write data to it.
|
|
|
|
|
singh.vikas8508 wrote: 1.)I have never deal in writing a hexadecimal format. means 0x80.
You probably have to use a binary encoding. Hexadecimal , on the other hand is just a convenient number representation. For instance 0x80 is 128 or 1000000b that means the leftmost pixel ON in your image (that means you've to assign the 128 value to the first byte of your file, i.e. binary encoding).
singh.vikas8508 wrote: 2.)I need to perform logical operation with this hexadecimal formate.
You need just to manipulate byte and bits.
singh.vikas8508 wrote: 3.)How I can insert bits in this format. like this.....as an example.....01100101
As I said before, hex is a convenient numeric representation, for instance you can easily translate this bit pattern in hex (just transform 4 bits at time into an hex digit: 0110->0x6 , 0101->0x5 hence 01100101->0x65 ) that means you should write 0x65 to the file.
If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler.
-- Alfonso the Wise, 13th Century King of Castile.
This is going on my arrogant assumptions. You may have a superb reason why I'm completely wrong.
-- Iain Clarke
[My articles]
|
|
|
|
|
Well, if you must (homework, as Cédric guessed?) implement it then have a look at the documentation PBM, PGM, try to code it and ask here when you've specific question.
(Actually
singh.vikas8508 wrote: I mean how to deal in writing a hexadecimal values 0x80.
How to create a new byte.
look like specific, but, as they stands they're quite 'ununderstandable').
If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler.
-- Alfonso the Wise, 13th Century King of Castile.
This is going on my arrogant assumptions. You may have a superb reason why I'm completely wrong.
-- Iain Clarke
[My articles]
|
|
|
|
|
It seems quite clear from this article[^] that you have to select some greyscale threshold to determine how to convert greyscale to black and white - is that where the 0x80 comes from?
The 'extra value' in the second line of a file in PGM format indicates the maximum pixel value in that PGM file. I'd use 50% of that as the threshold value, rather than 0x80.
Java, Basic, who cares - it's all a bunch of tree-hugging hippy cr*p
|
|
|
|
|
singh.vikas8508 wrote: I mean how to deal in writing a hexadecimal values 0x80.
Are you referring to something like:
fprintf(file, "%#x", 0x80);
"Old age is like a bank account. You withdraw later in life what you have deposited along the way." - Unknown
"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
|
|
|
|
|
Hi All,
I have an application that should not allow the user to open the Available Networks Window (specific on Vista/Windows &). Is there an API option to do this. When the user right clicks on the Windows Network menu, this option shouldn't be displayed.
Thanks in advance.
Sunil
|
|
|
|
|
Hi,
Can someone tell me how to call window service created in VC++ 9.0 in VC++ 6.0?
|
|
|
|