Time for action – testing a getPixel function
Before getting to useful examples, let's make a getPixel
function to obtain the color components of a point in the image and then complete a quick test case. The following steps will help you in this process:
- Make a new Mainstack. Click on Save to save it as ImageDataTests.
Note
We'll use the same stack to illustrate several things and at the end, we may dare to try it on a mobile device!
- Set the stack's resolution to the size of your largest test device or just try 1024 x 768 if you'll be using the iPad Simulator.
- From the File menu, navigate to Import as Control | Image and select any small image file you have, to place it in the upper-left corner of the card window. The next example, uses a LiveCode logo image that can easily be obtained from any LiveCode web page.
- Place a new
Graphic
object next to the image. It's going to show a single color, so just make it big enough so that you can easily see the color. Name...