dropperFor those Corona developers seeking a way to get the color of a specific pixel on the screen, you’re in luck! Starting with Daily Build #2106, our engineers have implemented the display.colorSample() function for this purpose. This function is an advanced graphics feature which can only be used by Pro/Enterprise subscribers.

Syntax

Using this function is simple: just provide a pixel location (in content space) and include a reference to a listener function which will receive the color values. Here’s the basic syntax:

Then, in the listener function, gather the values from the function’s event table. For example:

As you can see, the event table sent to the listener function contains an r, g, b, and a value for your usage, along with the sampled pixel’s x and y coordinates.

Sample Project

Let’s illustrate how the function works in a quick sample project:
major-magnet

Performance Limitations

At this time, the display.colorSample() function shares similar performance limitations as display.capture(), and like that function, it shouldn’t be used in tight loops, Runtime “enterFrame” listeners, or the “moved” phase of a touch handler. However, it gives you easy access to a pixel’s color values in just a few lines of code.

Please give it a spin and provide your feedback and comments below!

Source: 

Introducing the “Color Sample” Function