delphi - How do you set the color of a pixel under the cursor on a FMX.Canvas? -


with vcl used this:

procedure movingdots(x, y: integer; acanvas: tcanvas); stdcall; begin {$r-}   inc(alooper);   acounter := acounter shl 1; // shift bit left 1   if acounter = 0     acounter := 1; // if shifts off left, reset   if (acounter , 224) > 0 // of left 3 bits set?     // fmx.canvas not have pixels     acanvas.pixels[x, y] := aselectioncolor1 // erase pixel   else     acanvas.pixels[x, y] := aselectioncolor2; // draw pixel {$r+} end; 

how can set color @ x,y fmx canvas?

according example, should work:

var   vbitmapdata : tbitmapdata;   aselectioncolor : talphacolor; ... // define aselectioncolor somewhere // write access bitmap if acanvas.bitmap.map (tmapaccess.mawrite, vbitmapdata) begin   try     vbitmapdata.setpixel (x, y, aselectioncolor); // set pixel color @ x, y       acanvas.bitmap.unmap(vbitmapdata);   end; end;  

note mapping strategy locking/unlocking bitmap introduced in fm2, i.e. delphi-xe3.


Comments

Popular posts from this blog

java.util.scanner - How to read and add only numbers to array from a text file -

rewrite - Trouble with Wordpress multiple custom querystrings -