Manipulating a texture's pixels

In this recipe, we are going to modify a sprite by working with its pixel data directly. We are going to perform two actions on the image. First we are going to increase the transparency of every solid pixel in the image. Then we are going to surround the image with a red rectangle, as you might put around a selected character sprite or button.

Getting ready

Create a new solution, add a reference to GameEngine2D, and add a sprite object. Once again I am going to use FA-18H.png. The source for this project is available as Ch03_Example6.

How to do it...

  1. In AppMain.cs replace the existing code with the following code:
    using System; using System.Collections.Generic; using Sce.PlayStation.Core; using Sce.PlayStation.Core.Graphics; ...

Get PlayStation®Mobile Development Cookbook now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.