|
Oh, I see. But a still a problem. I can not save this 32 bit bmp file in to Jpeg file. It said the program only support 8 bits and 24 bits bmp files. Thanx
|
|
|
|
|
Yes, You are right. I can save it to 24 bit now. But if I want to save a ture color bitmap to JPEG, how could I? You really gave me great helps. Thanx
|
|
|
|
|
Yes, You are right. I can save it to 24 bit now. But if I want to save a ture color bitmap to JPEG, how could I? You really gave me great helps. Thanx
|
|
|
|
|
The source code is in the full paintlib distribution ( actually, it's in the extra code you need to download, linked from the paintlib site ). The .lib and .dll are not distributed, you actually build them from the source you download from paintlib.
Christian
#include "std_disclaimer.h"
People who love sausage and respect the law should never watch either one being made.
The things that come to those who wait are usually the things left by those who got there first.
|
|
|
|
|
If use the following codes, after write DIB to BMP file, it is 32 bit file. But I need 24 bit BMP file.
CBitmap bitmap;
CClientDC dc(pWnd);
CDC memDC;
CRect rect;
memDC.CreateCompatibleDC(&dc);
pWnd->GetClientRect(rect);
bitmap.CreateCompatibleBitmap(&dc, rect.Width() , rect.Height() );
CBitmap* pOldBitmap = memDC.SelectObject(&bitmap);
memDC.BitBlt(0, 0, rect.Width(), rect.Height(), &dc, 0, 0, SRCCOPY);
So I changed the codes to these to save to the 24 bit file. But I got nothing.
CBitmap bitmap;
CClientDC dc(pWnd);
CDC memDC;
CRect rect;
memDC.CreateCompatibleDC(&dc);
pWnd->GetClientRect(rect);
bitmap.CreateBitmap( rect.Width(), rect.Height(), 1, 24, NULL );
CBitmap* pOldBitmap = memDC.SelectObject(&bitmap);
memDC.BitBlt(0, 0, rect.Width(), rect.Height(), &dc, 2, 27, SRCCOPY);
|
|
|
|
|
You can't select a bitmap of different depth to your DC. To select an image of the depth you want into any DC, use a DIBSection. The above would work if your screen was in 24 bit mode, but the way to make it work always is to create a CDIBSection ( a paintlib class ) and make it 24 bit, then select into your DC.
Christian
#include "std_disclaimer.h"
People who love sausage and respect the law should never watch either one being made.
The things that come to those who wait are usually the things left by those who got there first.
|
|
|
|
|
Hello, Christian
I am trying to install the paintlib. But after I extracted the paintlib23a.zip, I did not find the directorys of bin, lib and obj which listed in the directory structure in the document. And did I must download the PaintX and extract it to the paintlib fold? Sorry for so many problems. But I do need your help. Thanx
|
|
|
|
|
You don't need PaintX. If you follow the detailed instructions on the paintlib page, you'll find you need to move and rename some files and then when you do a build you will end up with the bin, lib and obj files. You'll get compilation errors, you can probably ignore them. Also, I change the project to call the debug version paintlibd.lib, otherwise you get trouble with your link paths later on.
Christian
#include "std_disclaimer.h"
People who love sausage and respect the law should never watch either one being made.
The things that come to those who wait are usually the things left by those who got there first.
|
|
|
|
|
Oh, After compliling, I found these directory. But so many errors
|
|
|
|
|
Assuming you renamed the files according to the instructions on the web site, the errors are to do with VC parsing stuff inside #ifdef's, which don't get compiled because they are for other compilers/OS. You should still have the .lib files, which means it compiled OK. Try the diblook sample to see.
Christian
#include "std_disclaimer.h"
People who love sausage and respect the law should never watch either one being made.
The things that come to those who wait are usually the things left by those who got there first.
|
|
|
|
|
Such as E:\Downloaded Application\Extracted\Paintlib\paintlib\otherlib\libjpeg\jinclude.h(60): Could not find the file strings.h.
E:\Downloaded Application\Extracted\Paintlib\paintlib\Otherlib\libjpeg\jmemsys.h(133): Could not find the file Files.h.
Build : warning : failed to (or don't know how to) build 'E:\Downloaded Application\Extracted\Paintlib\paintlib\otherlib\zLib\zutil.c'
Build : warning : failed to (or don't know how to) build 'E:\Downloaded Application\Extracted\Paintlib\paintlib\Otherlib\Libtiff\libtiff\tif_zip.c'
Does that mean I have to download all the other libs such as zLib and Libtiff although I need only libjpeg.
|
|
|
|
|
Ah.... Yes, you need to download them, or there is a spot where you can set some #defines which turn off support for different formats. I can't remember where, but that is probably what you want to find.
Christian
#include "std_disclaimer.h"
People who love sausage and respect the law should never watch either one being made.
The things that come to those who wait are usually the things left by those who got there first.
|
|
|
|
|
Hello,
I am running the lib now. But don't know how to use the function
CWinBmp::Bmp.Draw( HDC hDC, int x, int y, DWORD rop = SRCCOPY );
Because I don't know how to get a HDC.
|
|
|
|
|
A CDC or CPaintDC casts to a HDC by itself, a pointer will need to be dereferenced.
Christian
#include "std_disclaimer.h"
People who love sausage and respect the law should never watch either one being made.
The things that come to those who wait are usually the things left by those who got there first.
|
|
|
|
|
Hello, Christian
In fact, my project is on the way now and I think I can finish it today. This is the first project I did in VC++. Because of your help, I went in the right way. So please accept my thanks: You really give me great helps Hope I can become an expert like you in the future.
Best Rgds,
Kidd;;)
|
|
|
|
|
Aw, shucks.....
I'm glad I could help - I'm sure you'll pick all this stuff up in no time - the trick is just to keep asking questions and expermenting.
Good luck.
Christian
#include "std_disclaimer.h"
People who love sausage and respect the law should never watch either one being made.
The things that come to those who wait are usually the things left by those who got there first.
|
|
|
|
|
Hello, Christian
My program is running now. But there is still a problem. If I use Win32 Release but not Win32 Debug to build the program. It will give some "unresolved external symbol" errors as the following. Can you give me some ideas in the errors and how to solve them? Thanx.
VizMarineViewView.obj : error LNK2001: unresolved external symbol "public: virtual __thiscall CAnyPicDecoder::~CAnyPicDecoder(void)" (??1CAnyPicDecoder@@UAE@XZ)
VizMarineViewView.obj : error LNK2001: unresolved external symbol "public: virtual __thiscall CWinBmp::~CWinBmp(void)" (??1CWinBmp@@UAE@XZ)
VizMarineViewView.obj : error LNK2001: unresolved external symbol "public: virtual __thiscall CJPEGEncoder::~CJPEGEncoder(void)" (??1CJPEGEncoder@@UAE@XZ)
VizMarineViewView.obj : error LNK2001: unresolved external symbol "public: virtual void __thiscall CPicEncoder::MakeFileFromBmp(char const *,class CBmp *)" (?MakeFileFromBmp@CPicEncoder@@UAEXPBDPAVCBmp@@@Z)
VizMarineViewView.obj : error LNK2001: unresolved external symbol "public: __thiscall CJPEGEncoder::CJPEGEncoder(void)" (??0CJPEGEncoder@@QAE@XZ)
VizMarineViewView.obj : error LNK2001: unresolved external symbol "public: virtual void __thiscall CPicDecoder::MakeBmpFromFile(char const *,class CBmp *,int,class IProgressNotification *)" (?MakeBmpFromFile@CPicDecoder@@UAEXPBDPAVCBmp@@HPAVIProgres
sNotification@@@Z)
VizMarineViewView.obj : error LNK2001: unresolved external symbol "public: __thiscall CWinBmp::CWinBmp(void)" (??0CWinBmp@@QAE@XZ)
VizMarineViewView.obj : error LNK2001: unresolved external symbol "public: __thiscall CAnyPicDecoder::CAnyPicDecoder(void)" (??0CAnyPicDecoder@@QAE@XZ)
Release/VizMarine Pro.exe : fatal error LNK1120: 8 unresolved externals
|
|
|
|
|
You didn't take my advice and make sure the debug version of Paintlib is called paintlibd.lib. So now the release version is trying to link to the debug version of paintlib. Just make the path to the release version of paintlib higher in your include paths ( i.e. in the tools/options menu not in your code ) and it will link to that instead.
Christian
#include "std_disclaimer.h"
People who love sausage and respect the law should never watch either one being made.
The things that come to those who wait are usually the things left by those who got there first.
|
|
|
|
|
I used MFC Wizard to create a exe project and added the following codes in OnDraw() function to save a BMP file to a JPG file. It is OK. I can get a new.jpg file from the snapshot1.bmp.
CAnyPicDecoder Decoder;
CWinBmp Bmp;
Decoder.MakeBmpFromFile( "C:\\snapshot1.bmp", &Bmp );
CJPEGEncoder Encoder;
Encoder.MakeFileFromBmp( "C:\\new.jpg", &Bmp );
But when I added the same codes to another project which I want to save a JPG file from the memory or BMP file. The project can be built with no error. But when I run the program, it gave me a dialog to say:
Debug Error!
Program D:\VizMarine\VizMarineView\Debug\VizMarineView.exe
abnormal program termination
Press Retry to debug the application
If I choose Retry option, I found the program will meet problem in the function jpeg_start_compress( j_compress_ptr cinfo, boolean write_all_tables ) ( ...\libjpeg\jcapistd.c ). I traced into the jinit_compress_master( j_compress_ptr cinfo ) function. And found when the program run to function jinit_color_converter(cinfo) ( ...\libjpeg\jcinit.c ), some errors catched.
Don't know why. But the same library run correctly in other applications. I have asked some friends to debug for me. But they have no idea about this. So sad.
|
|
|
|
|
Dear Sir:
I am now using the Parallel Port to read & edit the
EEPROM(24C08 IC/Via I2C bus)data from our device.And I
use the 25Pin-9Pin cable to do this.(To connect the
cable to our device directly).How can I program it with
TC/VC++6.0 language?Would you please give me some
advice?(Steps?)Need I have to write the Device Driver?
TKS! Waiting for your reply.
***
We are making progress everyday!
At XiaoYu Workshop.
***
|
|
|
|
|
It would be helpful if you were stating on what OS you are developing.
Apparently, you are driving an I²C bus by toggling some I/O lines at the PC's parallel port.
Windows NT/2000/XP would certainly need a device driver to allow such a thing.
Windows 95 (or any of it's reincarnations) is slightly more relaxed here.
That you are trying to connect your device via a 25-pin to 9-pin adapter makes me wonder; such adapters are intended for serial ports and won't match to parallel ports.
I'd recommend getting a firm knowledge about I²C, trying to locate an I²C driver for the OS of your choice, and only _then_ start to implement hardware for it.
Whatever, good luck.
|
|
|
|
|
Dear Sir:
Thank you for your reply.The situation is:I have a DOS program to read/Edit the data from 24C08(EEPROM IC),no source code.It uses the 25Pin-9Pin cable to do this.I want to re-write the program with VC++6.0,a Win32 application in Windows95/98.There is no any small boards.Only one cable.I have no the I2C-Bus driver.Maybe I will simulate the I2C-Bus protocol.How is the detailed step?
Thanks in advance!
***
We are making progress everyday!
At XiaoYu Workshop.
***
|
|
|
|
|
Does someone konw how to remove the scrollbar on th CWebBrowser ?
I have tried ModifyStyle, ModifyStyleEx and ShowScrollBar on the contorl and also on all its childs. Nothing works !!!
Thanks
Olivier
|
|
|
|
|
hi,
In the body tag put SCROLL=no.
Good luck,
Dror
|
|
|
|
|
Hello all,
I've got a CEdit (read-only) in which continuously lines are added at the end (debugging stuff). Of course... if I do nothing, its memory usage will grow and grow (64k Max for Win9x, 'unlimitted' for WinNT/2k). What I want to do is to delete the first line when it passed a predefined maximum amount of lines.
But... CEdit doesn't implement a 'delete-line' method. The only way I've found out was:
-First select the line(s), than replace the selection with nothing.
This sounds CPU-consuming to me...
Does anyone knows an efficient way to do this?
Thanks in advanced,
EiSl
|
|
|
|