Agg::trans_affine Coordinate conversion

Source: Internet
Author: User

The instance code is as follows:

Ras.reset ();


Agg::ellipse ell (400,400,20,70);

Coordinate transformation

Agg::trans_affine MTX;

Mtx.scale (0.5,1); The x-axis shrinks to half the original.

Mtx.rotate (agg::d Eg2rad (30));//Rotate 30 degrees

Mtx.translate (200,200);//x,y coordinates translate 100 respectively

typedef agg::conv_transform<agg::ellipse> ELL_CT_TYPE;

Ell_ct_type Ctell (ELL,MTX); Matrix transformations



typedef agg::conv_stroke<ell_ct_type> ELL_CC_CS_TYPE;

Ell_cc_cs_type Csccell (Ctell);

Ras.add_path (Csccell);

Agg::render_scanlines_aa_solid (Ras,sl,renb,agg::rgba8 (255,0,0));

Ras.reset ();


This is one of the most classic examples of use on the web, but it does not show how the rotation is implemented and slightly modifies the code:

Mtx.rotate (agg::d Eg2rad (60));//Rotate 60 degrees

Found nothing on the interface, the ellipse is gone!! At least you should speculate on the effect of rotation, otherwise who dares to use!!!

When modified to 40, view the graphics moved to (73,848) near, not found from the Internet

Any information.


Agg::trans_affine Coordinate conversion

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.