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

C / C++ / MFC

 
AnswerRe: Smaller than a byte Pin
Iain Clarke, Warrior Programmer28-Sep-07 5:31
Iain Clarke, Warrior Programmer28-Sep-07 5:31 
QuestionNeed a best possible alternative?? Pin
Kiran Satish27-Sep-07 7:08
Kiran Satish27-Sep-07 7:08 
AnswerRe: Need a best possible alternative?? Pin
Mark Salsbery27-Sep-07 7:31
Mark Salsbery27-Sep-07 7:31 
GeneralRe: Need a best possible alternative?? Pin
Kiran Satish1-Oct-07 10:41
Kiran Satish1-Oct-07 10:41 
QuestionRe: Need a best possible alternative?? Pin
Mark Salsbery1-Oct-07 11:15
Mark Salsbery1-Oct-07 11:15 
AnswerRe: Need a best possible alternative?? Pin
Kiran Satish1-Oct-07 11:34
Kiran Satish1-Oct-07 11:34 
GeneralRe: Need a best possible alternative?? Pin
Mark Salsbery1-Oct-07 11:53
Mark Salsbery1-Oct-07 11:53 
GeneralRe: Need a best possible alternative?? [modified] Pin
Kiran Satish2-Oct-07 5:40
Kiran Satish2-Oct-07 5:40 
Yeh, sure DIBSection will be definitely faster than drawing pixel by pixel. But the problem is I am not sure how to convert the data that I use into usable format for this function. I will do some research and some testing to see if I can somehow change or redefine the data to go in this way. Anyway here is how the function is implemented for repainting one of the dialog boxes..

void ResImageDlg::color_AllBoxes(CWnd *ResDisp)<br />
{<br />
	double resval;<br />
	int i,j,x,y;<br />
	RECT ResRect;<br />
	COLORREF color;<br />
<br />
	CDC *ResCDC = ResDisp->GetDC();<br />
	// Retrieve resultant data for each box and apply necessary color<br />
	for(i=0; i < GRID; i++) //GRID=12<br />
	{<br />
		for(j=0; j < GRID; j++)<br />
		{<br />
			if(  (j == 0 || j == (GRID-1))   &&   (i == 0 || i == (GRID-1))  )<br />
				;	// Do nothing, eliminating corners of 12x12 grid<br />
			else<br />
			{<br />
				resval = (parent->calcfile)->FetchResData(i,j);		<br />
				ResRect.left = X_OFFSET + (i*(RES_BOX_SIZE+BOX_GAP));<br />
				ResRect.right = ResRect.left + RES_BOX_SIZE;<br />
				ResRect.top = Y_OFFSET + (j*(RES_BOX_SIZE+BOX_GAP));<br />
				ResRect.bottom = ResRect.top + RES_BOX_SIZE;<br />
				color = check_ColorLimits(resval); /*this is to find a new color corresponding to the data val*/<br />
				for(x=ResRect.left; x < ResRect.right; x++)<br />
					for(y=ResRect.top; y < ResRect.bottom; y++)<br />
						ResCDC->SetPixelV(x,y,color);<br />
			}<br />
		}<br />
	}<br />
	ResDisp->ReleaseDC(ResCDC);<br />
}


The actual data is nothing but some real numbers between 0 and 2.0; two other dialog boxes are also drawn in the same fashion, but since they are 8bit graphic type, the data is scaled to be in between 0 and 255 and uses SetPixelV to draw that pixel.

Hope I am not confusing...D'Oh! | :doh:

PKNT

GeneralRe: Need a best possible alternative?? Pin
Mark Salsbery2-Oct-07 5:48
Mark Salsbery2-Oct-07 5:48 
GeneralRe: Need a best possible alternative?? Pin
Mark Salsbery2-Oct-07 6:34
Mark Salsbery2-Oct-07 6:34 
GeneralRe: Need a best possible alternative?? Pin
Mark Salsbery2-Oct-07 7:01
Mark Salsbery2-Oct-07 7:01 
GeneralRe: Need a best possible alternative?? Pin
Kiran Satish2-Oct-07 7:42
Kiran Satish2-Oct-07 7:42 
GeneralRe: Need a best possible alternative?? Pin
Mark Salsbery2-Oct-07 8:13
Mark Salsbery2-Oct-07 8:13 
GeneralRe: Need a best possible alternative?? Pin
Kiran Satish2-Oct-07 8:21
Kiran Satish2-Oct-07 8:21 
GeneralRe: Need a best possible alternative?? Pin
Mark Salsbery2-Oct-07 8:25
Mark Salsbery2-Oct-07 8:25 
GeneralRe: Need a best possible alternative?? Pin
Kiran Satish2-Oct-07 8:41
Kiran Satish2-Oct-07 8:41 
GeneralRe: Need a best possible alternative?? Pin
Mark Salsbery2-Oct-07 9:11
Mark Salsbery2-Oct-07 9:11 
GeneralRe: Need a best possible alternative?? Pin
Kiran Satish2-Oct-07 9:45
Kiran Satish2-Oct-07 9:45 
GeneralRe: Need a best possible alternative?? Pin
Kiran Satish3-Oct-07 10:46
Kiran Satish3-Oct-07 10:46 
GeneralRe: Need a best possible alternative?? Pin
Mark Salsbery3-Oct-07 11:18
Mark Salsbery3-Oct-07 11:18 
GeneralRe: Need a best possible alternative?? [modified] Pin
Kiran Satish3-Oct-07 12:13
Kiran Satish3-Oct-07 12:13 
GeneralRe: Need a best possible alternative?? Pin
Mark Salsbery3-Oct-07 12:49
Mark Salsbery3-Oct-07 12:49 
GeneralRe: Need a best possible alternative?? Pin
Kiran Satish8-Oct-07 15:17
Kiran Satish8-Oct-07 15:17 
GeneralRe: Need a best possible alternative?? Pin
Mark Salsbery9-Oct-07 6:00
Mark Salsbery9-Oct-07 6:00 
GeneralRe: Need a best possible alternative?? [modified] Pin
Kiran Satish9-Oct-07 6:10
Kiran Satish9-Oct-07 6:10 

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.