Windows Phone 7 Emulator & Fraps Color Problem

Friday, November 5, 2010
By: Jason Doucette

When screen capturing (images, not video) your Windows Phone 7 emulator with Fraps version 3.2.3, you will notice that the Red and Blue channels are swapped (a bug fixed in version 3.2.4).  An indication you have this bug is that the frame counter shows as cyan instead of yellow.  This is due to the Windows Phone 7's default GraphicsDeviceManager.PreferredBackBufferFormat of SurfaceFormat.Bgr565. In Windows (and presumably on the Xbox 360) the default is SurfaceFormat.Color, which is RGB order. Windows Phone 7 uses the Reach graphics profile, which only has BGR order.  Fraps 3.2.3 doesn't know that it's in BGR order, and thus saves the information as though it were RGB, swapping the R and the B.

How can you fix this?

The authors of Fraps know about this bug, and have it fixed for version 3.2.4 (not yet released).  Until this is released, you can fix the images using automated batch conversion in Adobe Photoshop:

Step #1. Record a Conversion Action

Open one of the images.  Open the Actions window (its tab is next to the History tab).  Click the "Create new action" button.  Name it, and specify which "set" it will be located within (I made my own "set" to distinguish my Actions from the existing ones).  Click "Record".  Now perform the following actions which will be recorded now, and later executed on each image you wish to convert:

  1. Open the Channels tab (next to the Layers tab)
  2. Click "Create new channel" icon. This will create an "Alpha 1" channel.
  3. Select the Red channel, Press Ctrl+A ("Select All"), Press Ctrl+C ("Copy")
  4. Select the Alpha 1 channel, Press Ctrl+V ("Paste").   Alpha 1 now contains Red.
  5. Select the Blue channel, Press Ctrl+A ("Select All"), Press Ctrl+C ("Copy")
  6. Select the Red channel, Press Ctrl+V ("Paste").   Red now contains Blue.
  7. Select the Alpha 1 channel, Press Ctrl+A (to "Select All"), Press Ctrl+C ("Copy")
  8. Select the Blue channel, Press Ctrl+V ("Paste").   Blue now contains Red.
  9. Select the Alpha 1 chanel, click "Delete current channel".
  10. Click "Stop playing/recording" in the "Actions" tab.

Your Action is now saved to be used in a batch conversion.  Close the image without saving since the batch conversion will handle this for you.

Step #2. Batch Convert All Images

  1. Make a copy of all images you wish to convert, in case your Action does not work, and you are (optionally) overwriting them.  Place them in a new folder.
  2. Select "File" menu --> "Automate" --> "Batch..."
  3. Select your newly created Action.
  4. Set "Source" to "Folder", and "Choose..." the folder the images are in.
  5. Set "Destination" and "Choose..." a folder for output, different than the source folder.
  6. Click "Ok".

Watch Adobe Photoshop do its thing.  It may work faster minimized, avoiding all the screen redrawing as it steps through the multiple commands in the Action for each image file.

 

 

About the Author: I am Jason Doucette of Xona Games, an award-winning indie game studio that I founded with my twin brother. We make intensified arcade-style retro games. Our business, our games, our technology, and we as competitive gamers have won prestigious awards and received worldwide press. Our business has won $190,000 in contests. Our games have ranked from #1 in Canada to #1 in Japan, have become #1 best sellers in multiple countries, have won game contests, and have held 3 of the top 5 rated spots in Japan of all Xbox LIVE indie games. Our game engines have been awarded for technical excellence. And we, the developers, have placed #1 in competitive gaming competitions -- relating to the games we make. Read about our story, our awards, our games, and view our blog.