// //------------------ DOK FILE -------------------------------------------------- +Header core.2d.polygon =pkg core.2d.polygon =title core.2d.polygon =short draw polygons =desc These two functions allow the rendering of polygons. Polygons may be 'simple' or with polygonal holes inside. // // //------------------ PROTO ----------------------------------------------------- bitmapPolygons +Proto bitmapPolygons =type fun Bitmap list array array Int Int BlendFunction -> a1 =mode function =pkg core.2d.polygon =impl mcy =link =desc This function draws a composed polygon on the bitmap bmp, with a color and a blending function. Use this function when your "main" polygon contains polygonal holes, else use bitmapPolygon. Each polygon is described by an array of 2d-arrays. The bitmapPolygons function requires a list of these. bitmapPolygons (uiBuffer(), {{250, 30}, {180, 30}, {40, 300}, {60, 300}, {200, 150}, {220, 150}, {300, 180}}:: {{220, 40}, {180, 80}, {230, 50}}::nil, 0xffc000, nil); // +arg bmp =type Bitmap =desc A bitmap // +arg polygons =type list array array Int =desc A list of arrays of vertice coordinates // +arg color =type Int =desc An ARGB color // +arg blend =type BlendFunction =desc A blending function, nil for no blending // +arg result =type a1 =desc Always nil // // //------------------ PROTO ----------------------------------------------------- bitmapPolygon +Proto bitmapPolygon =type fun Bitmap array array Int Int BlendFunction -> a1 =mode function =pkg core.2d.polygon =impl mcy =link =desc This function draws a polygon on the bitmap bmp, with a color and a blending function. The vertices are provided by an array of 2d-arrays. For example: bitmapPolygon (uiBuffer(), {{350, 130}, {240, 350}, {300, 300}, {430, 350}}, 0x0040ff, nil); The vertices are provided in clockwise or counter-clockwise direction. // +arg bmp =type Bitmap =desc A bitmap // +arg vertices =type array array Int =desc An array of vertice coordinates // +arg color =type Int =desc An ARGB color // +arg blend =type BlendFunction =desc A blending function, nil for no blending // +arg result =type a1 =desc Always nil