Book Image

LiveCode Mobile Development Beginner's Guide (2nd Edition)

Book Image

LiveCode Mobile Development Beginner's Guide (2nd Edition)

Overview of this book

Table of Contents (15 chapters)
LiveCode Mobile Development Beginner's Guide Second Edition
Credits
About the Authors
About the Reviewers
www.PacktPub.com
Preface
Index

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:

  1. 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!

  2. 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.

  3. 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.

  4. 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 it swatch.

  5. Set graphics to default...