canvas - Delphi FireMonkey app can not draw simple black rectangle -
just create simple firemokey hd app, put timage align=alclient on form , trying draw simple black rect:
procedure tform8.formcreate(sender: tobject); var c: tcanvas; begin image.bitmap := tbitmap.create(clientwidth, clientheight); c := image.bitmap.canvas; c.beginscene; try c.clear(clawhite); c.stroke.color := clablack; c.stroke.kind := tbrushkind.bksolid; c.drawrect( trectf.create(7,7,clientwidth-7,clientheight-7), 0,0, [], 1 ); c.endscene; end; end;
and doesn't work. color of rect not black, kind of gray. there changes of color in corners. did need set other properties or wrong here ? tried different opacity values (1,100,255,65535), picture doesn't change @ , there no information in hell option means. zoomed left-top corner:
also tried use polygons described in example. same problem - rounded corners , gray color instead of black (opacity property of image 1, properties default):
procedure tform8.button2click(sender: tobject); var p1, p2, p3, p4, p5: tpointf; mypolygon: tpolygon; begin // sets points define polygon p1.create(100, 100); p2.create(200, 100); p3.create(200, 200); p4.create(100, 200); p5.create(100, 100); // creates polygon setlength(mypolygon, 5); mypolygon[0] := p1; mypolygon[1] := p2; mypolygon[2] := p3; mypolygon[3] := p4; mypolygon[4] := p5; image.bitmap.canvas.beginscene; // draws polygon on canvas image.bitmap.canvas.drawpolygon(mypolygon, 50); image.bitmap.canvas.endscene; // updates bitmap // image.bitmap.bitmapchanged; end;
http://roman.yankovsky.me/?p=1018
if canvas.beginscene try canvas.stroke.thickness := 1.5; canvas.stroke.kind := tbrushkind.bksolid; canvas.fill.color := talphacolorrec.black; canvas.fill.kind := tbrushkind.bksolid; := 1 9 begin canvas.drawline(pointf(50 + * 25 - (canvas.stroke.thickness / 2), 0), pointf(50 + * 25 - (canvas.stroke.thickness / 2), clientheight), 1); end; canvas.endscene; end;