Click here to Skip to main content
15,912,400 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
GeneralRe: Socket Programming Pin
Mohammad A Gdeisat12-Feb-05 6:10
Mohammad A Gdeisat12-Feb-05 6:10 
GeneralRe: Socket Programming Pin
Member 90098716-Feb-05 18:04
Member 90098716-Feb-05 18:04 
GeneralFile Transfer Pin
Member 172633411-Feb-05 19:59
Member 172633411-Feb-05 19:59 
GeneralRe: File Transfer Pin
ThatsAlok11-Feb-05 22:30
ThatsAlok11-Feb-05 22:30 
GeneralRe: File Transfer Pin
Mohammad A Gdeisat12-Feb-05 6:15
Mohammad A Gdeisat12-Feb-05 6:15 
GeneralRe: File Transfer Pin
ThatsAlok12-Feb-05 6:47
ThatsAlok12-Feb-05 6:47 
GeneralRe: File Transfer Pin
Mohammad A Gdeisat12-Feb-05 9:16
Mohammad A Gdeisat12-Feb-05 9:16 
GeneralProblem with GDI+ in Visual C++ 6.0 Pin
uus9911-Feb-05 17:50
uus9911-Feb-05 17:50 
Hello there,
I'm using Visual C++ 6 with Platform SDK and trying to create a imaging program. The program is simple, where i the user can draw lines on a TIFF image.

I'm using GDI+ for this purpose, but having one problem. The problem is that GDI+ just cannot draw on gray(8-bit)/black & white TIFF images or BMP for that matter. I dont know why. A simple test code is given below,

void CGDIPlusDlg::OnButton8() <br />
{<br />
//gets current DC<br />
CDC *pDC=this->GetDC();<br />
//gets Handle to DC<br />
HDC hdc=pDC->GetSafeHdc();<br />
<br />
//Opens an image from disk<br />
Image img(L"c:\\mspaint.tif");<br />
//target rectangle at coordinate 0,0 sizwe<br />
RectF r(0, 0, 100, 100);<br />
<br />
//Set graphics, and dest<br />
Graphics gr(hdc);<br />
RectF destRect(0, 0, 100, 100);<br />
<br />
//Draw original image-works fine<br />
gr.DrawImage(&img,destRect);<br />
<br />
//Create a blackpen (A,b,g,r), thickness 3<br />
Pen blackPen(Color(255, 0, 0, 0), 3);<br />
<br />
//Start and end point<br />
PointF point1(0, 0);<br />
PointF point2(100.0f, 100.0f);<br />
<br />
//Draw line on image---doesnt work for BW images!!<br />
Graphics gr2(&img);<br />
gr2.DrawLine(&blackPen,point1,point2);<br />
<br />
RectF destRect2(100, 0, 100, 100);<br />
gr.DrawImage(&img,destRect2);<br />
}


The image is created using MSPaint. Create a 100x100 image, draw something, and save as TIF. Save again by changing the image depth to black & white from the Image->Attributes menu.

The program supposed to draw a diagonal line across the image, but it doest for the black&white version of tif.

So, my problem is how to overcome this? Or, how can i programmatically convert a BW TIFF to color and work on it using GDI+?

Oh yeah, can anyone try if this code works fine in C# or managed C++?

Thanks,
Usman
GeneralCFileDialog Issues Pin
JKallen11-Feb-05 16:15
JKallen11-Feb-05 16:15 
GeneralRe: CFileDialog Issues Pin
Bob Ciora12-Feb-05 4:08
Bob Ciora12-Feb-05 4:08 
GeneralSIMPLE: "x" in System menu Pin
JKallen11-Feb-05 11:47
JKallen11-Feb-05 11:47 
GeneralRe: SIMPLE: &quot;x&quot; in System menu Pin
David Crow11-Feb-05 12:18
David Crow11-Feb-05 12:18 
GeneralRe: SIMPLE: &quot;x&quot; in System menu Pin
JKallen11-Feb-05 13:48
JKallen11-Feb-05 13:48 
GeneralRe: SIMPLE: &quot;x&quot; in System menu Pin
David Crow12-Feb-05 14:37
David Crow12-Feb-05 14:37 
GeneralRe: SIMPLE: &quot;x&quot; in System menu Pin
Shog911-Feb-05 12:25
sitebuilderShog911-Feb-05 12:25 
GeneralRe: SIMPLE: "x" in System menu Pin
JKallen11-Feb-05 13:54
JKallen11-Feb-05 13:54 
GeneralScreen redraw.. Pin
Neil scsn11-Feb-05 10:29
Neil scsn11-Feb-05 10:29 
GeneralRe: Screen redraw.. Pin
Shog911-Feb-05 12:00
sitebuilderShog911-Feb-05 12:00 
GeneralRe: Screen redraw.. Pin
Neil scsn11-Feb-05 12:07
Neil scsn11-Feb-05 12:07 
GeneralRe: Screen redraw.. Pin
Shog911-Feb-05 12:49
sitebuilderShog911-Feb-05 12:49 
GeneralNeural Network Code Pin
bitpusher11-Feb-05 10:21
bitpusher11-Feb-05 10:21 
GeneralRe: Neural Network Code Pin
rocky_pulley11-Feb-05 14:13
rocky_pulley11-Feb-05 14:13 
GeneralRe: Neural Network Code Pin
bitpusher11-Feb-05 14:30
bitpusher11-Feb-05 14:30 
GeneralRe: Neural Network Code Pin
humps12-Feb-05 0:25
humps12-Feb-05 0:25 
GeneralRe: Neural Network Code Pin
rocky_pulley12-Feb-05 6:28
rocky_pulley12-Feb-05 6:28 

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.