Cximage + PNG image processing.

Source: Internet
Author: User

I can see that there are so many processing methods for PNG images, but I cannot figure it out. How do they use GDI + PNG for processing?

Isn't it the most efficient and best method? Is it cximage + PNG Image Processing?

To use the cximage class, you also need to download a cximage demo. These files are used in it!

Find these files and copy them to your project for configuration. Then you can use the cximage class.

Step 1: Open the project and click projects -- settings.

After the configuration is successful, check whether you have these items.

Cximage. Lib libdcr. Lib jpeg. Lib Jasper. Lib MNG. Lib PNG. Lib Tiff. Lib zlib. Lib

Are there any of these items. Check it out.

The header file is imported.

You press F5 to debug

Check if there is any problem. This is not the case yet. You have to perform a code test. Is there a problem,

You can add the header file in your cxxxxxxdlg to check whether it is recognized.

# Include "ximage. H"

Public:

Cximage * m_bgcximage;

Let's see if it succeeds. If it succeeds, we can do something. Haha.

Let's use a jpg image to test the effect. Add a background to the dialog box. Okay. First, use your Ps or other tools to save your image as JPG.

You have to add a function here. The first step is to press Ctrl + W. Click class info, click message filter, and select windows click OK.

Press Ctrl + W to add the onerasebkgnd function.

Okay, the specific code. I will post it to you. Check whether it is successful.

Bool ccximagedlg: onerasebkgnd (CDC * PDC)
{
// Todo: add your message handler code here and/or call default
// Return cdialog: onerasebkgnd (PDC );
Rect;
Getclientrect (& rect );
M_bgcximage-> tile (PDC-> getsafehdc (), & rect );
Return true;
}

Write it in oninitdialog (), and paste the jpg image.

M_bgcximage = new cximage ();
Hrsrc temp = findresource (null, "idr_jpg1", "jpg ");
If (! M_bgcximage-> loadresource (temp, cximage_format_jpg )){
Delete m_bgcximage;
M_bgcximage = NULL;
}

The effect after running is as follows.

By the way, when importing a jpg image, you must add quotation marks without prompting you to find the resource.

Thank you. Today, the network is not very good. How can I add a + PNG Image to cbutton tomorrow.

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.