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.
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
.
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; using Sce.PlayStation.Core.Imaging; using Sce.PlayStation.HighLevel.GameEngine2D; using Sce.PlayStation.HighLevel.GameEngine2D.Base; namespace Ch03_Example5 { public class AppMain { public static void Main (string[] args) { ...