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

C / C++ / MFC

 
AnswerRe: Handling KeyBoard messages/accelerators handling in MFC dialog based applications Pin
Richard MacCutchan30-Jul-21 4:56
mveRichard MacCutchan30-Jul-21 4:56 
GeneralRe: Handling KeyBoard messages/accelerators handling in MFC dialog based applications Pin
ForNow30-Jul-21 5:11
ForNow30-Jul-21 5:11 
GeneralRe: Handling KeyBoard messages/accelerators handling in MFC dialog based applications Pin
Richard MacCutchan30-Jul-21 5:28
mveRichard MacCutchan30-Jul-21 5:28 
GeneralRe: Handling KeyBoard messages/accelerators handling in MFC dialog based applications Pin
Dave Kreskowiak30-Jul-21 6:10
mveDave Kreskowiak30-Jul-21 6:10 
GeneralRe: Handling KeyBoard messages/accelerators handling in MFC dialog based applications Pin
Richard MacCutchan30-Jul-21 6:15
mveRichard MacCutchan30-Jul-21 6:15 
QuestionDynamically creating CToolBar Pin
Benjamin Bruno30-Jul-21 3:54
Benjamin Bruno30-Jul-21 3:54 
AnswerRe: Dynamically creating CToolBar Pin
Richard MacCutchan30-Jul-21 4:52
mveRichard MacCutchan30-Jul-21 4:52 
QuestionRGB image to CMYK gdi+ Pin
Gopi Nath15-Jul-21 22:25
Gopi Nath15-Jul-21 22:25 
Hello,

I am trying to adjust the color balance (CYMK) of an image like this is in photoshop or some other applications.

From examples, i tried changing the current RGB to CMYK (for each pixel) using the below code.

for (int i = 0; i < width; i++)
	{
		for (int j = 0; j < height; j++)
		{
			tmpbmp->GetPixel(i, j, &clr);

			R = clr.GetR();
			G = clr.GetG();
			B = clr.GetB();

			c = _cyanclr / 255.0; // _cyanclr - user input in %
			m = _magentaclr / 255.0;
			y = _yellowclr / 255.0;
			k = _blackclr / 255.0;

			rr = c * (1.0 - k) + k;
			gg = m * (1.0 - k) + k;
			bb = y * (1.0 - k) + k;

			rr = (1.0 - rr) * 255.0 + 0.5;
			gg = (1.0 - gg) * 255.0 + 0.5;
			bb = (1.0 - bb) * 255.0 + 0.5;
			
           // here i dont know how to adjust new RGB with old one
			R += rr;
			G += gg;
			B += bb;

			R = R < 0 ? 0 : (R > 255) ? 255 : R;
			G = G < 0 ? 0 : (G > 255) ? 255 : G;
			B = B < 0 ? 0 : (B > 255) ? 255 : B;			

			output->SetPixel(i, j, Gdiplus::Color(R, G, B));
		}
	}


With this code, i am not getting the same result like in photoshop and other applications.

I am not sure whether I am doing in right method or not.

Please suggest.

I am using C++ and gdi+.


Regards,
Gopinath.
AnswerRe: RGB image to CMYK gdi+ Pin
Richard MacCutchan17-Jul-21 6:15
mveRichard MacCutchan17-Jul-21 6:15 
AnswerRe: RGB image to CMYK gdi+ Pin
RedDk16-Oct-21 8:24
RedDk16-Oct-21 8:24 
QuestionException handler Pin
Drugodrf14-Jul-21 6:39
Drugodrf14-Jul-21 6:39 
AnswerRe: Exception handler Pin
Greg Utas14-Jul-21 9:15
professionalGreg Utas14-Jul-21 9:15 
AnswerRe: Exception handler Pin
SeeSharp214-Jul-21 10:31
SeeSharp214-Jul-21 10:31 
GeneralRe: Exception handler Pin
Drugodrf15-Jul-21 6:15
Drugodrf15-Jul-21 6:15 
GeneralRe: Exception handler Pin
Victor Nijegorodov15-Jul-21 9:25
Victor Nijegorodov15-Jul-21 9:25 
GeneralRe: Exception handler Pin
jschell17-Jul-21 9:38
jschell17-Jul-21 9:38 
GeneralRe: Exception handler Pin
Victor Nijegorodov17-Jul-21 9:51
Victor Nijegorodov17-Jul-21 9:51 
GeneralRe: Exception handler Pin
Richard MacCutchan17-Jul-21 21:08
mveRichard MacCutchan17-Jul-21 21:08 
QuestionC++ Pin
Member 152817338-Jul-21 8:52
Member 152817338-Jul-21 8:52 
AnswerRe: C++ Pin
OriginalGriff8-Jul-21 8:56
mveOriginalGriff8-Jul-21 8:56 
QuestionRe: C++ Pin
David Crow8-Jul-21 12:19
David Crow8-Jul-21 12:19 
AnswerRe: C++ Pin
Richard MacCutchan8-Jul-21 21:10
mveRichard MacCutchan8-Jul-21 21:10 
GeneralRe: C++ Pin
charlieg17-Aug-21 11:38
charlieg17-Aug-21 11:38 
QuestionHelp me to convert all to C++ (stdio.h) Pin
WEI SHEN KOK7-Jul-21 3:47
WEI SHEN KOK7-Jul-21 3:47 
AnswerRe: Help me to convert all to C++ (stdio.h) Pin
Victor Nijegorodov7-Jul-21 4:30
Victor Nijegorodov7-Jul-21 4:30 

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.