Configuration in cximage vc6

Source: Internet
Author: User

There are many configurations on the Internet. Here is a simple method:

 

First, let's take a look at this article:

 

Article 1:

Cximage usage experience

Cximage usage experience

(1) Installation

Open cximglib. DSW and compile it into a lib library file before use. The subsequent usage is as follows:

I. the most complex method and the best function (occupying a large space ):

"1. Copy the following directories to the same level as" my new project directory ", for example:

[Cximage] cximage. DSP

[Jasper] Jasper. DSP

[JBIG] JBIG. DSP

[JPEG] jpeg. DSP

[MNG] MNG. DSP

[PNG] PNG. DSP

[Raw] libdcr. DSP

[Tiff] Tiff. DSP

[Zlib] zlib. DSP

[My projects]"

2. Insert the DSP above into the workspace of my project (add project)

3. In the menu project \ dependencies in VC, depend on my project to another project (that is, check other projects)

4. Menu project \ setting... in VC,

C/C ++ \-code generation \-use run-time Library: Select multithreaded DLL

C/C ++ \ precompiled headers: select not using precompiled headers

C/C ++ \ code generation \ additional include directories: Input .. \ cximage"

5. Select menu project \ set active project in VC and select my project

6. Add # include "ximage. H" to the code of my project"

 

2. The simplest method of use (small footprint)

1. Copy all *. Lib files generated in the cximage project to the directory of my project:

. /Cximage. lib. /Jasper. lib. /JBIG. lib. /JPEG. lib. /libdcr. lib. /MNG. lib. /PNG. lib. /tiff. lib. /zlib. lib

Note that the setting methods of these lib libraries must be the same as those of my project, for example, both the release version and the debug version.

2. insert these lib files into the current project.

3. Copy all *. h under the cximage directory to "my project directory ".

4. Menu project \ setting... in VC,

C/C ++ \-code generation \-use run-time Library: Select multithreaded DLL

C/C ++ \ precompiled headers: select not using precompiled headers"

5. Add # include "ximage. H" to the code of my project"

 

In this way, it can be used normally in my project.

 

(2) Use

Other usage:

 

Create and delete a Class Object cximage * image;

Image = new cximage ();

Then you can perform operations such as image-> load (...).

Delete image every time you use up; // You cannot delete * image ;"

Load the image from the file to the class image. Load ("image.bmp", cximage_format_bmp );

Save the image to the image. Save ("image.jpg", cximage_format_jpg) file)

Determine whether the image in the class is valid "image. isvalid ()

// If there is no image in the class, this function returns false;

// If an image is loaded successfully, this function returns the real result. If another image fails to be loaded, the returned value is still true! Because the image in the class still exists!

 

Loading images from memory to class (Decoding)

Cximage * image;

Image = new cximage ();

Image-> decode (byte *) databuf, size, cximage_format_png );

Delete image;

// The memory address pointed to by databuf already has an image (which can be read from the image file), and the size is the image size.

// This function loads the image to the image class"

 

Save the image to memory (encoding)

Long size = "0 ";

Byte * buffer = "0 ";

Image. encode (buffer, size, image_type );

...

Image. freememory (buffer );"

 

Convert the image in the class to hbitmap handle hbitmap m_bitmap = image. makebitmap (HDC );

// An HDC is required, which can be HDC =: getdc (null); (finally: releasedc (null, HDC );)

// It can also be CDC * HDC = m_picture.getdc (); then HDC-> m_hdc is HDC (m_picture is a picture box )"

 

Convert the image in the class to handle hdib = image-> copytohandle ();

 

Article 2:

 

Compile his project to generate the corresponding. Lib, and then
.
If you use the dynamic link library cximagecrt. dll, then:

# Include "ximage. H"
# Pragma comment (Lib, "cximagecrt. lib ")

If you use a static connection method, you should:
# Include "ximage. H"
# Pragma comment (Lib, "cximage. lib ")
# Pragma comment (Lib, "Jpeg. lib ")
# Pragma comment (Lib, "PNG. lib ")
# Pragma comment (Lib, "zlib. lib ")
# Pragma comment (Lib, "Tiff. lib ")
# Pragma comment (Lib, "Jasper. lib ")
// You can or cannot include the two following.
// # Pragma comment (Lib, "j2k. lib ")
// # Pragma comment (Lib, "JBIG. lib ")

Usage: (demonstration nature)
M_imagechessboard.load (" 1.1.bmp", cximage_format_bmp );
M_imagebg.load ("bg800.jpg", cximage_format_jpg );

M_imagechessboard.draw (PDC-> getsafehdc (), m_xoffset, m_yoffset );//
// Configure //-------------------------------------------------------------------------------------

 

Finally, let me talk about my methods:

1: Download cximage. I downloaded cximage701_full and decompress it to the specified place, such as drive C;

2: Compile the cximglib. DSW project in cximage701_full;

3: Create an H folder, search for all. H files under cximage701_full, and copy them to the H folder;

Create a lib folder. The following folders are available: Debug and release. Search for all. Lib files under cximage701_full and put them under the corresponding files;

4: add the H folder and Lib folder of the header file in the VC project: Tools-> options-> directories;

5:

// If you use the dynamic link library cximagecrt. dll, then: // recommended;

# Include <ximage. h>
# Pragma comment (Lib, "cximagecrt. lib ")

/*
// If a static connection is used, it should be as follows:
# Include "ximage. H"
# Pragma comment (Lib, "cximage. lib ")
# Pragma comment (Lib, "Jpeg. lib ")
# Pragma comment (Lib, "PNG. lib ")
# Pragma comment (Lib, "zlib. lib ")
# Pragma comment (Lib, "Tiff. lib ")
# Pragma comment (Lib, "Jasper. lib ")
// You can or cannot include the two following.
// # Pragma comment (Lib, "j2k. lib ")
// # Pragma comment (Lib, "JBIG. lib ")

*/

6. Simple Example:

Cximage m_imagechessboard;
 
M_imagechessboard.load ("t.bmp", cximage_format_bmp );
 
If (m_imagechessboard.isvalid ())
{
M_imagechessboard.draw (cclientdc (this), 0, 0 );//
}

OK, so that the configuration is successful. You do not need to modify the compiling conditions in VC;

 

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.