|
I know you are new to CodeProject but you won't find much support for your behavior here. If you want these people to help you (using their time freely) you better get your act together.
|
|
|
|
|
how to use TripleDES algorithm in Visual C++? I observed through the net but did not get exactly working sample using TripleDES ECB mode (2 keys)? Please help me
|
|
|
|
|
|
Hello,
I do not want the border of the childframe which is on the sides of the child window and the upper frame of the child window.But I dont see the identifier which will remove it.How do I create a childframe without borders.
CMDIFrameWnd* pFrame = STATIC_DOWNCAST(CMDIFrameWnd,AfxGetApp()->m_pMainWnd);
if(!Create(NULL, FrameName,WS_VISIBLE | WS_CHILD |
WS_OVERLAPPEDWINDOW ,CRect(0,0,0,0), pFrame, NULL))
{
TRACE0("Failed to create view window\n");
return false;
}
Priya
|
|
|
|
|
From winuser.h :
#define WS_OVERLAPPEDWINDOW (WS_OVERLAPPED | \
WS_CAPTION | \
WS_SYSMENU | \
WS_THICKFRAME | \
WS_MINIMIZEBOX | \
WS_MAXIMIZEBOX)
Note: WS_THICKFRAME is in there...
> The problem with computers is that they do what you tell them to do and not what you want them to do. <
> Life: great graphics, but the gameplay sux. <
|
|
|
|
|
Hello,
Thanks for your reply.
even with these identifiers WS_VISIBLE | WS_CHILD | WS_OVERLAPPED I am getting a thick frame
Which ones should I use?
Prithaa
|
|
|
|
|
Hi.
I'm currently working on a game where I do some simple pixel modifications when loading graphics. What I tried to do was to build a function that could take two RGBA values and add them, but I'm having real trouble with the alpha values. I know how to do it when using only RGB colors but when including alpha everything gets much trickier. I would like to have a function like this:
u32 blendPixel(u32 baseColor, u32 paintColor) {
u8 baseRed = getRed(baseColor);
u8 baseGreen = getGreen(baseColor);
u8 baseBlue = getBlue(baseColor);
u8 baseAlpha = getAlpha(baseColor);
u8 paintRed = getRed(paintColor);
u8 paintGreen = getGreen(paintColor);
u8 paintBlue = getBlue(paintColor);
u8 paintAlpha = getAlpha(paintColor);
u8 newRed = ???
u8 newGreen = ???
u8 newBlue = ???
u8 newAlpha = ???
return makecol(newRed, newGreen, newBlue, newAlpha);
}
|
|
|
|
|
Assuming 0 = no colour, 1 = lots of it, and 0=see through, and 1=opaque...
I'd say something like this:
newRed = ( baseAlpha * baseRed + paintAlpha * paintRed ) / (baseAlpha + paintAlpha);
newGreen = ...
newBlue = ...
newAlpha = 1 - (1-baseAlpha)*(1-paintAlpha);
I didn't add in a check whether both paintAlpha and baseAlpha were 0. In which case, newAlpha is also 0, and the end colour is "undefined". Or irrelevant!
I'll leave the challenge of converting my 0.0-1.0 sums to 0-255 to you!
Iain.
In the process of moving to Sweden for love (awwww).
If you're in Scandinavia and want an MVP on the payroll (or happy with a remote worker), give me a job!
|
|
|
|
|
I don't think that method is completly correct.. Calculation of new alpha seems to be right, but not the colors.
If you have a pixel with RGBA value (1, 0, 0, 1) = Red pixel 100% opaque
Then you paint it over with RBGA value (0, 1, 0, 1) = Green pixel 100% opaque
You should end up with a (0, 1, 0, 1) pixel, but you get (0.5, 0.5, 0, 1) = Semi Red/Green 100% opaque
Also tried following base color (1, 0, 0, 0.5) = Red pixel 50% opaque
Painted over with color (0, 1, 0, 0.5) = Green pixel 50% opaque
You should en up with a (0.33, 0.67, 0, 0.75) pixel, but you get (0.5, 0.5, 0, 0.75)
My reference points are from how Paint.NET and Photoshop handle pixels with alpha.
|
|
|
|
|
Ah, but he asked how to MIX the colours, not how to put one on top of the other...
If it's layering, then...
afterRed = topAlpha * topRed + (1-topAlpha) * bottomRed;
I'm not sure I agree with your 0.33 math though - but if so, I'm still wrong! The 0.75 alpha applied to my 0.5 in the above equation gives you 0.375 end colour.
(I also agree that the on-top rather than chucked-in-a-bowl-and-stirred interpretation is more likely to be correct)
Iain.
In the process of moving to Sweden for love (awwww).
If you're in Scandinavia and want an MVP on the payroll (or happy with a remote worker), give me a job!
|
|
|
|
|
Hi.
Yes this works if the bottom color has an alpha of 1.0
I guess it will work for me, since my bottom layer always have full alpha.
But still I can't figure out how it works when having opacity set on the bottom layer.
I've looked in the Paint.NET source, and I can't find anything that explains how they calculate the colors when both pixels have opacity set. Only found functions that works same as you described.
BTW, thank you for your help!
If you want to take a look at the source it is available here: http://www.afterdawn.com/software/source_codes/paint.net.cfm
In UnaryPixelOps.cs
public override ColorBgra Apply(ColorBgra color)
{
int a = blendColor.A;
int invA = 255 - a;
int r = ((color.R * invA) + (blendColor.R * a)) / 256;
int g = ((color.G * invA) + (blendColor.G * a)) / 256;
int b = ((color.B * invA) + (blendColor.B * a)) / 256;
byte a2 = ComputeAlpha(color.A, blendColor.A);
return ColorBgra.FromBgra((byte)b, (byte)g, (byte)r, a2);
}
In ColorBgra.cs
public static ColorBgra Blend(ColorBgra ca, ColorBgra cb, byte cbAlpha)
{
uint caA = (uint)Utility.FastScaleByteByByte((byte)(255 - cbAlpha), ca.A);
uint cbA = (uint)Utility.FastScaleByteByByte(cbAlpha, cb.A);
uint cbAT = caA + cbA;
uint r;
uint g;
uint b;
if (cbAT == 0)
{
r = 0;
g = 0;
b = 0;
}
else
{
r = ((ca.R * caA) + (cb.R * cbA)) / cbAT;
g = ((ca.G * caA) + (cb.G * cbA)) / cbAT;
b = ((ca.B * caA) + (cb.B * cbA)) / cbAT;
}
return ColorBgra.FromBgra((byte)b, (byte)g, (byte)r, (byte)cbAT);
}
public static int FastScaleByteByByte(byte a, byte b)
{
int r1 = a * b + 0x80;
int r2 = ((r1 >> 8) + r1) >> 8;
return (byte)r2;
}
Can't figure out what function 'FastScaleByteByByte' does and why the 3rd parameter 'cbAlpha' is required..
|
|
|
|
|
The "code" I gave you was very deliberately using 0-1 as my scale, rather than 0-255 which you actually need.
The FastScaleByteByByte function is actually:
public static int FastScaleByteByByte(byte a, byte b)
{
int r1 = a * b + 0x80;
int r2 = ((r1 >> 8) + r1) >> 8;
return (byte)r2;
}
The right shift is a very quick way of dividing by a power of 2.
So, it could be written:
public static int FastScaleByteByByte(byte a, byte b)
{
int r1 = a * b + 128;
int r2 = ((r1 / 256) + r1) / 256;
return (byte)r2;
}
They use this as a speedy way of calculating the equivalent of my alpha * XXX and (1-alpha) * YYY - but on a 255 base.
They are being sliiiightly naughty. They are dividing by 256 instead of 255. I'll forgive them a 0.4% error if this speed is increased greatly.
I'm glad to hear that great minds agree with me, and that I've been of assistance,
Iain.
In the process of moving to Sweden for love (awwww).
If you're in Scandinavia and want an MVP on the payroll (or happy with a remote worker), give me a job!
|
|
|
|
|
Also, isn't the source to Paint.NET available? You can peek at their math... and then prove me correct, obviously!
Iain.
In the process of moving to Sweden for love (awwww).
If you're in Scandinavia and want an MVP on the payroll (or happy with a remote worker), give me a job!
|
|
|
|
|
Iain Clarke wrote: You can peek at their math... and then prove me correct, obviously!
You are correct by definition (you are the "bestest ever expert", after all). He should peek at their math just if he needs to prove they're correct.
BTW-OT: Still in England?
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]
|
|
|
|
|
Hi,
Can anyone tell me how to convert a LZW compression type tiff file to PDF?
Please do help me out.
Thnx in advance.
|
|
|
|
|
There are two steps to go about it:
1. Uncompress the archive using the same library that you used to compress.
2. Given the extracted file is a tiff image, you can use a virtual pdf printer to print to PDF. Or if you are wanting to do this from your program, use a pdf library like Haru[^]
It is a crappy thing, but it's life -^ Carlo Pallini
|
|
|
|
|
|
Hi....
Thnx for the reply....
I downloaded the code and executed it on the tiff files that i have.
The code seems to execute perfectly for the tiff files that are of 'CCIT Group 4 FAX' and 'CCIT Group 3 FAX '.But for the files having compression type as 'LZW', i get a blank PDF file as output.
Please do let me know is there a way of converting the LZW type tiff files.
Thank You.
|
|
|
|
|
I don't get it. Are the tiff files compressed to an archive using LZW or the tiff compression itself uses the LZW algorithm to reduce size?
It is a crappy thing, but it's life -^ Carlo Pallini
|
|
|
|
|
Rajesh R Subramanian wrote: the tiff compression itself uses the LZW algorithm
That one. TIFF files can use many different compression formats. I remember, many, many, many years ago, writing an encoder or decoder (can't remember which) for TIFF files with CCITT group 3 compression on an IBM mainframe using PL/I. That was an experience...
Java, Basic, who cares - it's all a bunch of tree-hugging hippy cr*p
|
|
|
|
|
Hi....
Actually here i have been given a set of tiff files.Now when you go and look into each tiff file's page properties (View Menu -> Page properties), you will be able to see its compression type.My task requires the tiff files with 'LZW' type compression to be converted to PDF.Wheni execute the code that you had suggested in your previous link, i get a blank PDF file.It seems to work for the other tiff files with different compression type but for the LZW compression type it doesn't seem to work. I have no idea what to do.
Please do let me know if you have any solution.Thanks alot.
|
|
|
|
|
Hi all,
i m working on Visual Studio 2008.
i m working on Windows based mobiloe,on XP active sync ia works so i m using RAPI for connection and other functionns,but this is not working in case of Mobile device center.
because for Vista and later mobile device center in required.
so please tell me what can i use for mobile device center.
if possible please explain me with example.
thanks in advance.
To accomplish great things, we must not only act, but also dream;
not only plan, but also believe.
|
|
|
|
|
Hi All
How can i convert double to CString in vc++?Plz help me
|
|
|
|
|
double d = 12.3;<br />
CString cs;<br />
cs.Format("%f", d);<br />
«_Superman_»
I love work. It gives me something to do between weekends.
|
|
|
|
|
Hi,
I have a third party dll which I registered with /i option.
Like regsvr32 /i:"someGUID" "DllPath" .registration succeeded.
I could notice that With /i option DllInstall function is also called with DllRegisterServer.
Now for me to use this dll I should call a function of it with the "someGUID" which it compares and returns successfully.
1)I would like to know what it does internally? Where does it store the GUID for comparing?
The dll has some function which takes strings(file paths) as input.
and displays as a list when we call another function of it.
Now I close my application and register the same third party dll with another GUID to use it in another application.I have repeated the above process.
When I got the list of all strings that it has it also shows the strings which it stored from the first application.I tried to find them in registry and also for any text files in the directory where the dll resides but of know use.
2)I would like to know where else can we save strings in windows other than files and registries.
Thanks
Satya
Today is a gift, that's why it is called the present.
|
|
|
|
|