Using VC + + to develop ASP image processing components (2)

Source: Internet
Author: User

Interface design of COM components

Before we enter the text, in the program to create a device context, the input text to calculate and output the specified file name of the bitmap file, in this design, we use the JPEG compressed format to store files in order to reduce network transmission time, because the JPEG compression method of the discussion is beyond the scope of this article, so no longer Repeating.

In order for other languages to call this interface, we publish this program as a COM component, which can be called by vb,delphi,pb,asp and other programs, the following gives the design method of COM components, the General COM component is created and compiled beyond the scope of this article, so no longer explain.

To clear the method in the assembly:

STDMETHOD(OutTextImg) (/*[out, retval]*/ long *pVal);ltvalue(500)] long lWeight,
[in,optional,defaultvalue(0)] long l3D);

And

STDMETHOD(OutImg) (BSTR bstrFileName, long lDelFile);

The processing file is saved as an image and the image is exported to the user's browser respectively. The implementation code is as follows:

STDMETHODIMP CAspImage::OutImgFromText(BSTR bstrFilePath,
          BSTR bstrText,
          BSTR bstrBgImg,
          long lCSet,
          BSTR bstrFont,
          long lWidth,
          long lHeight,
          long lLeft,
          long lTop,
          long llfHeight,
          long lWeight,
          long l3D)
{
   CImg img;
   try{
     if(0 == img.OutImgFromText(
       bstrFilePath,
       bstrText,
       bstrBgImg,
       lCSet,
      bstrFont,
       lWidth,
       lHeight,
       lLeft,
       lTop,
       llfHeight,
       lWeight,
       l3D))
     {
       return S_OK;
     }
     else
     {
       return S_FALSE;
     }
   }
   catch(...)
   {
     return S_FALSE;
   }

   return S_OK;
   /**/

}

Related Article

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.