Click here to Skip to main content
15,921,989 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
QuestionRe: There is a kind of tiff image(wang tiff),and photoshop can not open it.what is this? Pin
Mark Salsbery27-Mar-07 7:33
Mark Salsbery27-Mar-07 7:33 
AnswerRe: There is a kind of tiff image(wang tiff),and photoshop can not open it.what is this? Pin
leo-zhang28-Mar-07 4:04
leo-zhang28-Mar-07 4:04 
GeneralRe: There is a kind of tiff image(wang tiff),and photoshop can not open it.what is this? Pin
Mark Salsbery28-Mar-07 6:43
Mark Salsbery28-Mar-07 6:43 
GeneralRe: There is a kind of tiff image(wang tiff),and photoshop can not open it.what is this? Pin
leo-zhang28-Mar-07 20:12
leo-zhang28-Mar-07 20:12 
QuestionQuery about strsafe.h and afxv_32.h Pin
gan_esh26-Mar-07 21:29
gan_esh26-Mar-07 21:29 
AnswerRe: Query about strsafe.h and afxv_32.h Pin
Steve S28-Mar-07 2:55
Steve S28-Mar-07 2:55 
GeneralRe: Query about strsafe.h and afxv_32.h Pin
gan_esh28-Mar-07 22:48
gan_esh28-Mar-07 22:48 
QuestionOptimizing the Code Pin
narayanagvs26-Mar-07 20:45
narayanagvs26-Mar-07 20:45 
Hi,

I Select an Image on to a CompatibleDC .I get each Pixel and check to see whether Red,Green,Blue of that Pixel are same or not.If so I perform Some Operations and change the color of that Pixel Using SetPixel.
and then Finally I Stretchblt it on to my ClientDC.

HBITMAP hBmpObjSmpl = imgObjSample.GetBMP();
	bmpSample.Attach(hBmpObjSmpl);	
	
	CDC dcMem;
	dcMem.CreateCompatibleDC(pDC);
	HBITMAP hOldBitmap=(HBITMAP)dcMem.SelectObject(bmpSample);
	
	//Get the bitmap info
	BITMAP bm;
	bmpSample.GetBitmap(&bm);
	
//Render the object with Sample color
for(int i=0;i < bm.bmWidth ; i++)
for(int j=0;j < bm.bmHeight ; j++)
	{
			COLORREF clr = dcMem.GetPixel(i,j);
			int R = GetRValue(clr);
			int G = GetGValue(clr);
			int B = GetBValue(clr);
			if( (R == G) && (G == B))
			{
				R = (R-nMaxRGB)  + dblSampleRGB[0];
				G = (G -nMaxRGB) + dblSampleRGB[1];
				B = ( B -nMaxRGB ) + dblSampleRGB[2];
				R=R*dblillumination;
				G=G*dblillumination;
				B=B*dblillumination;
				if(R>255)
					R=255;
				if(R<0)
					R=0;
				if(G>255)
					G=255;
				if(G<0)
					G=0;
				if(B>255)
					B=255;
				if(B<0)
					B=0;
				dcMem.SetPixel(i,j,RGB(R,G,B));
			}
		}
		
		pDC->SetStretchBltMode(HALFTONE);
		pDC->StretchBlt(rcSample.left,rcSample.top,rcSample.right-rcSample.left,rcSample.bottom - rcSample.top,&dcMem,0,0,bm.bmWidth,bm.bmHeight,SRCCOPY);

		// Perform the clean-up
		dcMem.SelectObject((HBITMAP)hOldBitmap);
		bmpSample.DeleteObject();
		dcMem.DeleteDC();


As I need to Perform the same Operation 16 times in my OnPaint() to view the picture 16 times in 4x4 row matrix its becoming very slow.I could see each row painting and its taking around 3 secs .

Each time the Operation is Performed only these values dblSampleRGB[0],dblSampleRGB[1],dblSampleRGB[2] in code logic vary.

I want the whole OnPaint Operation to be Performed Instantaneously. So any suggetions to Optimize my code would be helpful.

Thanks
Satya



Today is a gift, that's why it is called the present.

AnswerRe: Optimizing the Code Pin
Nibu babu thomas26-Mar-07 23:38
Nibu babu thomas26-Mar-07 23:38 
AnswerRe: Optimizing the Code Pin
Mark Salsbery27-Mar-07 7:40
Mark Salsbery27-Mar-07 7:40 
QuestionHow to get the drives name and type? Pin
PS@Codeproj26-Mar-07 19:44
PS@Codeproj26-Mar-07 19:44 
AnswerRe: How to get the drives name and type? [modified] Pin
Programm3r26-Mar-07 21:22
Programm3r26-Mar-07 21:22 
AnswerRe: How to get the drives name and type? Pin
PS@Codeproj27-Mar-07 2:03
PS@Codeproj27-Mar-07 2:03 
AnswerRe: How to get the drives name and type? Pin
David Crow27-Mar-07 3:15
David Crow27-Mar-07 3:15 
Questionthrow() Pin
vibindia26-Mar-07 19:14
vibindia26-Mar-07 19:14 
AnswerRe: throw() [modified] Pin
prasad_som26-Mar-07 19:33
prasad_som26-Mar-07 19:33 
GeneralRe: throw() Pin
Stephen Hewitt26-Mar-07 19:46
Stephen Hewitt26-Mar-07 19:46 
GeneralRe: throw() Pin
prasad_som26-Mar-07 19:52
prasad_som26-Mar-07 19:52 
GeneralRe: throw() Pin
vibindia26-Mar-07 19:55
vibindia26-Mar-07 19:55 
AnswerRe: throw() Pin
Stephen Hewitt26-Mar-07 19:48
Stephen Hewitt26-Mar-07 19:48 
AnswerRe: throw() Pin
Nemanja Trifunovic27-Mar-07 2:04
Nemanja Trifunovic27-Mar-07 2:04 
QuestionHow to load error icon on DialogBox at run time? Pin
Atul2326-Mar-07 19:06
Atul2326-Mar-07 19:06 
AnswerRe: How to load error icon on DialogBox at run time? Pin
prasad_som26-Mar-07 19:24
prasad_som26-Mar-07 19:24 
GeneralRe: How to load error icon on DialogBox at run time? Pin
Atul2326-Mar-07 21:38
Atul2326-Mar-07 21:38 
AnswerRe: How to load error icon on DialogBox at run time? Pin
prasad_som27-Mar-07 0:15
prasad_som27-Mar-07 0:15 

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.