Implementation of Greenopenpaint (vi) saving and opening of pictures

Source: Internet
Author: User
Tags bool

If just a direct picture is saved and opened, there is not much content. But I am here, the EXIF information into it, so that the image processing results can be preserved. This is very valuable. All operations are handled in the doc. I have previously summarized the operation of Exif, introduced here #include   "Exif.h"/* Read exifinfo m_exifinfo; File* hfile=fopen (Filepathname.c_str (), "RB"); if  (hfile) {memset (&m_exifinfo,0,sizeof (exifinfo)); Cexif exif (&m_exifinfo); Exif. Decodeexif (hfile); Fclose (hfile); Write cexif ceif; sprintf_s (CBUF2, "123"); Int iret = ceif. Writeexif2image (Filepathname.c_str (), PROPERTYTAGCOPYRIGHT,CBUF2); if (iret == 0) AfxMessageBox ("Write EXIF information successfully!"); else AfxMessageBox ("Write EXIF information failed!"); * * and introduced in the Open and save function in Doc. It's a very correct way to centralize the processing of files in Doc bool cgreenopenpaintdoc::onopendocument (lpctstr lpszpathname) {     if  (! Cdocument::onopendocument (lpszpathname))         return FALSE;     M_FILENAME = CT2CA (lpszPathName);     //read into file     m_image. Load (CT2CA (LpszpathnaMe));     m_fScaleFactor = ZOOM_NORMAL;     //read into Exif     file* hfile=fopen (CT2CA (LpszPathName), "RB");     if  (hfile) {        memset (&m_exifinfo , 0,sizeof (Exifinfo));         cexif exif (&m_exifinfo);         exif. Decodeexif (hfile);         fclose (hfile);         //has obtained the saved data         m_ Bitmapinfo =  m_exifinfo. CopyRight;     }     return TRUE; }//Save the file, actually did not modify the file, just modified the EXIF information Bool cgreenopenpaintdoc::onsavedocument (lpctstr lpszpathname) {     // TODO:  Add the dedicated code here and/or call the base class     cstring cstring =_t (" Greenopen ");     if  (m_filename !=   "Empty")     {         int iret = ceif. Writeexif2image (m_filename,propertytagcopyright,cstring);     }     //here FALSE     return FALSE; Note that the return of OnSaveDocument is false. This has achieved the purpose of integrating EXIF.   Greenopenpaint Summary: All along, I wanted to implement a mspaint-like program. After a few days of spring festival focused research, it should be said that the purpose is basically achieved. Implementation details in the code and Codex, reflect on a few retreats: 1, code refactoring is ongoing. Once stopped, the quest for "best" was stopped. Good programmers should continue to hone their skills; 2, MFC provides a strong foundation framework, a lot of things need to continue to study, 3, to find a solution to the problem of the basic model (such as I now build a few), is the first to solve the problem. Next, Greenopenpaint will apply to all projects that meet this type of problem, and in this process, continue to improve. The relevant information will be open at the first time. January 28, 2017  

All code:

Http://files.cnblogs.com/files/jsxyhelu/GreenOpenPaint.rar



Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.