Click here to Skip to main content
15,887,175 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
AnswerRe: border of the childframe Pin
Code-o-mat8-Apr-09 2:52
Code-o-mat8-Apr-09 2:52 
GeneralRe: border of the childframe Pin
prithaa8-Apr-09 3:09
prithaa8-Apr-09 3:09 
QuestionHelp with how to add/mix RGBA values Pin
spiffen8-Apr-09 1:17
spiffen8-Apr-09 1:17 
AnswerRe: Help with how to add/mix RGBA values Pin
Iain Clarke, Warrior Programmer8-Apr-09 1:24
Iain Clarke, Warrior Programmer8-Apr-09 1:24 
GeneralRe: Help with how to add/mix RGBA values Pin
spiffen8-Apr-09 2:22
spiffen8-Apr-09 2:22 
GeneralRe: Help with how to add/mix RGBA values Pin
Iain Clarke, Warrior Programmer8-Apr-09 2:32
Iain Clarke, Warrior Programmer8-Apr-09 2:32 
GeneralRe: Help with how to add/mix RGBA values Pin
spiffen8-Apr-09 4:16
spiffen8-Apr-09 4:16 
GeneralRe: Help with how to add/mix RGBA values Pin
Iain Clarke, Warrior Programmer8-Apr-09 6:00
Iain Clarke, Warrior Programmer8-Apr-09 6:00 
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;  // 128 is half if 256, and is the equivalent of adding 0.5 before rounding a number to
   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!

GeneralRe: Help with how to add/mix RGBA values Pin
Iain Clarke, Warrior Programmer8-Apr-09 2:34
Iain Clarke, Warrior Programmer8-Apr-09 2:34 
GeneralRe: Help with how to add/mix RGBA values Pin
CPallini8-Apr-09 7:19
mveCPallini8-Apr-09 7:19 
QuestionHow to convert LZW type tiff file to PDF c++? Pin
raesa8-Apr-09 0:58
raesa8-Apr-09 0:58 
AnswerRe: How to convert LZW type tiff file to PDF c++? Pin
Rajesh R Subramanian8-Apr-09 1:07
professionalRajesh R Subramanian8-Apr-09 1:07 
AnswerRe: How to convert LZW type tiff file to PDF c++? Pin
Jijo.Raj8-Apr-09 1:13
Jijo.Raj8-Apr-09 1:13 
GeneralRe: How to convert LZW type tiff file to PDF c++? Pin
raesa8-Apr-09 1:38
raesa8-Apr-09 1:38 
GeneralRe: How to convert LZW type tiff file to PDF c++? Pin
Rajesh R Subramanian8-Apr-09 2:02
professionalRajesh R Subramanian8-Apr-09 2:02 
GeneralRe: How to convert LZW type tiff file to PDF c++? Pin
Stuart Dootson8-Apr-09 2:40
professionalStuart Dootson8-Apr-09 2:40 
GeneralRe: How to convert LZW type tiff file to PDF c++? Pin
raesa8-Apr-09 17:40
raesa8-Apr-09 17:40 
QuestionRapi use for connect with active sync,now what can i use for connect with Mobile Device Center? Pin
Le@rner8-Apr-09 0:54
Le@rner8-Apr-09 0:54 
QuestionDouble to CString Pin
Davitor7-Apr-09 23:57
Davitor7-Apr-09 23:57 
AnswerRe: Double to CString Pin
«_Superman_»7-Apr-09 23:59
professional«_Superman_»7-Apr-09 23:59 
QuestionQuery related to DllInstall() Pin
narayanagvs7-Apr-09 23:36
narayanagvs7-Apr-09 23:36 
AnswerRe: Query related to DllInstall() Pin
Randor 8-Apr-09 1:33
professional Randor 8-Apr-09 1:33 
QuestionMenu class derived from CMenu Pin
prithaa7-Apr-09 23:30
prithaa7-Apr-09 23:30 
AnswerRe: Menu class derived from CMenu Pin
Iain Clarke, Warrior Programmer8-Apr-09 0:03
Iain Clarke, Warrior Programmer8-Apr-09 0:03 
QuestionMenu and document Pin
gopalan.kaliyamoorthy7-Apr-09 23:11
gopalan.kaliyamoorthy7-Apr-09 23:11 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.