Direct2d (30): Relationship between geometric objects-id2d1geometry. comparewithgeometry ()

Source: Internet
Author: User
{Related constant} // d2d1_geometry_relation = type Integer; occurrence = 0; // unknown d2d1_geometry_relation_disjoint = 1; // non-intersection occurrence = 2; // belongs to d2d1_geometry_relation_contains = 3; // contains d2d1_geometry_relation_overlap = 4; // overlapping
Test Code :
Uses direct2d, d2d1; Procedure tform1.formpaint (Sender: tobject); const arr1: array [0 .. 3] of string = ('red', 'Yellow ', 'green', 'blue'); arr2: array [1 .. 4] of string = ('Do not intersect ',' belong to ',' include ',' intersection at '); arrcolor: array [0 .. 3] of tcolor = (clred, clyellow, clgreen, clblue); var CVS: tdirect2dcanvas; iellipsegeometry: id2d1ellipsegeometry; irectanglegeometrys: array [0 .. 3] of id2d1rectanglegeometry; I, H: integer; X: d2d1_geometry_relation; strarr: array [0 .. 3] of string; begin d2dfactory. createellipsegeometry (d2d1ellipse (d2d1pointf (150,150), 50, 50), iellipsegeometry); d2dfactory. createrectanglegeometry (d2d1rectf (90, 90,210,210), irectanglegeometrys [0]); d2dfactory. createrectanglegeometry (d2d1rectf (130,130,170,170), irectanglegeometrys [1]); d2dfactory. createrectanglegeometry (d2d1rectf (70,130,110,170), irectanglegeometrys [2]); d2dfactory. createrectanglegeometry (d2d1rectf (220,130,260,170), irectanglegeometrys [3]); for I: = 0 to 3 do begin iellipsegeometry. comparewithgeometry (irectanglegeometrys [I], td2dmatrix3x2f. identity, 0, x); strarr [I]: = format ('circle "% s" '# 9' % s rectangle', [arr2 [X], arr1 [I]); end; CVS: = tdirect2dcanvas. create (canvas, clientrect); CVs. begindraw; CVs. rendertarget. clear (d2d1colgrading (clwhite); for I: = 0 to 3 do begin CVs. brush. color: = arrcolor [I]; CVs. fillgeometry (irectanglegeometrys [I]); end; CVs. font. size: = 10; CVs. brush. color: = clwhite; H: = CVs. textheight (strarr [0]); for I: = 0 to 3 do CVs. textout (8, H * I + 5, strarr [I]); CVs. enddraw; CVs. free; end;
:


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.