Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Text in a DIB
Message
From
19/12/2000 04:03:14
 
 
General information
Forum:
Visual C++
Category:
Coding, syntax & commands
Title:
Miscellaneous
Thread ID:
00454517
Message ID:
00454950
Views:
31
Hi Neil,

Can you have a look at this please, I can't figure out why DrawText does not work.

thanks,
Hennie

void SendFile( char *sFile, char *sText ) {
CDC dc;
BYTE *dib, *jpg;
DWORD nchannels, width, height, size=1000000;
CBitmap bm, *pOldBitmap;;
CRect r;

if( DecodeJPGFileToGeneralBuffer( sFile, &width, &height, &nchannels, &dib) ) {
if( dc.CreateCompatibleDC( NULL ) ) {
if( bm.CreateCompatibleBitmap( &dc, width, height ) ) {
bm.SetBitmapBits( width * height * 3, &dib );

pOldBitmap = (CBitmap*) dc.SelectObject(bm);
r.left = 0;
r.top = 0;
r.bottom = height;
r.right = width;
// if( dc.BitBlt( 0, 0, width, height, &dc, 0, 0, SRCCOPY ) ) {
dc.DrawText( sText, -1, r, DT_CENTER );
dc.SelectObject(pOldBitmap);

if( EncodeToJPEGBuffer( dib, width, height, &jpg, &size) ) {
printf( "Content-Length: %ld", size );
printf( "\r\n\r\n" );
fwrite( jpg, sizeof( char ), size, stdout );
free( jpg );
}
// }
}
}
free( dib );
}
}
============================================================
'C' is shorthand for Confusion, 'C++' much more confusion...
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform