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 O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.