The solution to the image drawing of Thunderbolt bolt is not clear

Source: Internet
Author: User

The effect of the image stretching in the Thunderbolt Bolt Library is more severe, and is often caused by aliasing:

1, in the use of Imageobject, DrawMode for 1 stretch mode;

2, using the stretch function of bitmap class to stretch the image;

Although Imageobject has the AntiAlias attribute to support anti-aliasing, there is no particularly significant optimization effect after setup.

The way to solve the aliasing is to write the tensile function in C + +, you can refer to the processing function I wrote:

int Cxluacimpl::stretchbitmap (lua_state* luastate) {XL_BITMAP_HANDLE HXLBitmap = Null;if (Xlue_checkbitmap (luastate, 2, &hxlbitmap)) {int nwidth = Lua_tointeger (luastate,3); int nheight = Lua_ Tointeger (luastate,4); CImage oldimage; CImage NewImage; Hbitmap hbitmap = Transparentimage (Xlgp_convertxlbitmaptodib (Hxlbitmap, +)); Oldimage.attach (HBITMAP); if (! Newimage.createex (nwidth, nheight, Bi_rgb)) {Oldimage.detach (); return 0;} int npremode =:: Setstretchbltmode (NEWIMAGE.GETDC (), halftone); Newimage.releasedc (); Oldimage.draw (NewImage.GetDC () , 0, 0, nwidth, nheight, 0, 0, oldimage.getwidth (), Oldimage.getheight ()); Newimage.releasedc ();:: Setbrushorgex ( NEWIMAGE.GETDC (), 0, 0, NULL); Newimage.releasedc ();:: Setstretchbltmode (Newimage.getdc (), Npremode); Newimage.releasedc (); OldImage.Detach (); Hxlbitmap = Xlgp_convertddbtoxlbitmap (CClientDC (NULL), Newimage.detach (), XLGRAPHIC_CT_ARGB32); Xlue_pushbitmap (Luastate,hxlbitmap); return 1;} return 0;} 

The function does not use a professional processing algorithm, but the sawtooth is obviously improved to meet the daily needs.

Record, for the better of myself!

The solution to the image drawing of Thunderbolt bolt is not clear

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.