* * *

Author Topic: How to obtain/write to Imagecanvas, colour values for a given pixel in bitmap  (Read 789 times)

John_Nicol

  • New member
  • *
  • Posts: 6
I want to be able to provide the pixel coordinates in a picture and obtain a numerical or string definition of the colour represented by that pixel.  Can someone provide a clear, simple code which will run in Lazrus Free Pascal? Thank you.
John Nicol

Ian123

  • New member
  • *
  • Posts: 27
The OP on this thread by wjackson153 (who credits taazz) has a little program that seems to do what you are looking for (if I am understanding what you are looking for).

1) Put 3 labels on a form and a shape and a timer
2) double click the timer to create its default event handler
3) Replace all the code in the unit with what's in the OP on that thread.

BTW I don't know if you'll have this problem but I am on windows and the program wouldn't compile until I got rid of the MouseAndKeyInput entry (and its preceding comma) in the uses clause
« Last Edit: June 19, 2017, 04:55:10 pm by Ian123 »
Windows 10 64 bit *  Lazarus 1.8.0RC1 * i386-win32-win32/win64

taazz

  • Hero Member
  • *****
  • Posts: 4340
BTW I don't know if you'll have this problem but I am on windows and the program wouldn't compile until I got rid of the MouseAndKeyInput entry (and its preceding comma) in the uses clause
http://wiki.freepascal.org/MouseAndKeyInput
Good judgement is the result of experience … Experience is the result of bad judgement.

OS : Windows 7 64 bit
Laz: Lazarus 1.4.4 FPC 2.6.4 i386-win32-win32/win64

Ian123

  • New member
  • *
  • Posts: 27
BTW I don't know if you'll have this problem but I am on windows and the program wouldn't compile until I got rid of the MouseAndKeyInput entry (and its preceding comma) in the uses clause
http://wiki.freepascal.org/MouseAndKeyInput

Thanks, I should have realised that the problem occurred because I had not installed that package.
Still, the program seems to work fine without it on windows
Windows 10 64 bit *  Lazarus 1.8.0RC1 * i386-win32-win32/win64

taazz

  • Hero Member
  • *****
  • Posts: 4340
Still, the program seems to work fine without it on windows
Its not required it is a left over from the OPs previous attempts. I never noticed it.
Good judgement is the result of experience … Experience is the result of bad judgement.

OS : Windows 7 64 bit
Laz: Lazarus 1.4.4 FPC 2.6.4 i386-win32-win32/win64

Handoko

  • Hero Member
  • *****
  • Posts: 1644
  • My goal: build my own game engine using Lazarus

 

Recent

Get Lazarus at SourceForge.net. Fast, secure and Free Open Source software downloads Open Hub project report for Lazarus