Click here to Skip to main content
15,917,579 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
GeneralRe: Exporting Device Context to File (GIF/JPG/PNG etc) Pin
Nick Hodapp21-Jan-04 7:33
sitebuilderNick Hodapp21-Jan-04 7:33 
GeneralRe: Exporting Device Context to File (GIF/JPG/PNG etc) Pin
Miszou21-Jan-04 7:45
Miszou21-Jan-04 7:45 
GeneralRemove Pin
Anonymous21-Jan-04 6:20
Anonymous21-Jan-04 6:20 
GeneralRe: Remove Pin
David Crow21-Jan-04 6:55
David Crow21-Jan-04 6:55 
GeneralRe: Remove Pin
Anonymous21-Jan-04 7:28
Anonymous21-Jan-04 7:28 
GeneralRe: Remove Pin
David Crow21-Jan-04 7:56
David Crow21-Jan-04 7:56 
GeneralDrag and Drop from Outlook Pin
Steve Thresher21-Jan-04 5:47
Steve Thresher21-Jan-04 5:47 
GeneralShellOpen Pin
Gary Kirkham21-Jan-04 5:45
Gary Kirkham21-Jan-04 5:45 
GeneralRe: ShellOpen Pin
Antti Keskinen21-Jan-04 5:55
Antti Keskinen21-Jan-04 5:55 
GeneralRe: ShellOpen Pin
Gary Kirkham21-Jan-04 5:59
Gary Kirkham21-Jan-04 5:59 
QuestionHow to threshold an image? Pin
uus9921-Jan-04 5:41
uus9921-Jan-04 5:41 
AnswerRe: How to threshold an image? Pin
J. Eric Vaughan21-Jan-04 6:24
J. Eric Vaughan21-Jan-04 6:24 
GeneralRe: How to threshold an image? Pin
uus9921-Jan-04 23:25
uus9921-Jan-04 23:25 
GeneralRe: How to threshold an image? Pin
J. Eric Vaughan22-Jan-04 6:01
J. Eric Vaughan22-Jan-04 6:01 
GeneralRe: How to threshold an image? Pin
uus9922-Jan-04 8:42
uus9922-Jan-04 8:42 
Thanks a lot for the help. Looking at the code you gave me, seems that it would be faster than the one i just figured out, :P
i havent try your code yet, coz i just got wrote myself a working code. Here is the code that i wrote,

//the test image "bmptest.bmp" is a color bmp 360x360 pixels
------------------------------------------
CDC *pDC;
CDC memDCLoad;
CBitmap m_bmpBitmap;
pDC = this->GetDC();


CString m_sBitmap;
m_sBitmap="bmptest.bmp";

memDCLoad.CreateCompatibleDC(pDC);

HBITMAP hBitmap =(HBITMAP)::LoadImage(AfxGetInstanceHandle(),m_sBitmap,IMAGE_BITMAP,0,0,
LR_LOADFROMFILE|LR_DEFAULTCOLOR);

if(hBitmap)
{
if(m_bmpBitmap.DeleteObject())
m_bmpBitmap.Detach();
m_bmpBitmap.Attach(hBitmap);
}

memDCLoad.SelectObject(&m_bmpBitmap);

pDC->BitBlt(0,0,360,360,&memDCLoad,0,0,SRCCOPY);

BYTE test[(4*360*360)];
void* pbBits = test;// One bit per pixel
m_bmpBitmap.GetBitmapBits(4*360*360, &pbBits);

for(int i=0;i<360*360;i++)
{
//BGR=000 //black
//BGR=255,255,255//white
int temp=i*4;
//test[temp+0]=0;//blue
//test[temp+1]=0;//green
//test[temp+2]=0;//red
//test[temp+3]=255;//padding

BYTE gray= (byte)(test[temp+2]*0.299
+test[temp+1]*0.587
+test[temp+0]*0.114);
if(gray<=230)
{
test[temp+0]=0;//blue
test[temp+1]=0;//green
test[temp+2]=0;//red
}

else
{
test[temp+0]=255;//blue
test[temp+1]=255;//green
test[temp+2]=255;//red
}

}

m_bmpBitmap.SetBitmapBits(4*360*360, &pbBits);
pDC->BitBlt(360,0,360,360,&memDCLoad,0,0,SRCCOPY);
GeneralRe: How to threshold an image? Pin
J. Eric Vaughan22-Jan-04 10:58
J. Eric Vaughan22-Jan-04 10:58 
GeneralRe: How to threshold an image? Pin
uus9922-Jan-04 18:12
uus9922-Jan-04 18:12 
GeneralRe: How to threshold an image? Pin
J. Eric Vaughan23-Jan-04 3:59
J. Eric Vaughan23-Jan-04 3:59 
GeneralRe: How to threshold an image? Pin
uus9923-Jan-04 23:00
uus9923-Jan-04 23:00 
AnswerRe: How to threshold an image? Pin
John M. Drescher21-Jan-04 9:51
John M. Drescher21-Jan-04 9:51 
AnswerRe: How to threshold an image? Pin
cmk21-Jan-04 9:51
cmk21-Jan-04 9:51 
AnswerRe: How to threshold an image? Pin
uus9921-Jan-04 16:30
uus9921-Jan-04 16:30 
AnswerRe: How to threshold an image? Pin
Ryan Binns21-Jan-04 17:28
Ryan Binns21-Jan-04 17:28 
Questionthe system protect in 2k and xp ?? Pin
Anonymous21-Jan-04 4:47
Anonymous21-Jan-04 4:47 
AnswerRe: the system protect in 2k and xp ?? Pin
Matt Newman21-Jan-04 5:40
Matt Newman21-Jan-04 5:40 

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.