Вопрос

My goal is to be able to modify a Matrix screensaver that is no longer being supported by the developers. I simply want to be able to change the color of the glyphs from green to red. From what I've read, I might need to edit the compiled .nib file. And supposedly, there are tricks to do this.

The only files I see within the .saver file are:

  • Unix Executable File
  • InfoPlist.strings
  • Matrix.nib
  • a Glyphs.png (its in grayscale, so the color affect must come from programming)
  • A Matrix.nib file in a folder entitled Japanese.lproj

I don't see any other files that I could edit that would let me achieve this, so I am looking for some guidance.

EDIT: The author posted the source code for his screensaver on his github. Now i'm just trying to figure out exactly what needs to be changed.

Это было полезно?

Решение

The modification of the source code isn't very hard. The colors are computed on the fly, so an asset can't be modified to change the color.

In line 226 of MatrixStrip.m change the 1 before the left bracket to a 0. In Line 228 Change the 0 to a 1. The column below the V in the code.

....                            V
226:    colorArray[16*i + 4*c + 0] = (cellState[i] == 0) ? 0.0 : g;
227:    // Cells which are very bright are slightly whitened
228:    colorArray[16*i + 4*c + 1] = ((g > 0.7) && (cellState[i] != 0)) ? (g - 0.6) : 0.0;

Make the same change to lines 253 and 255. You are putting the numbers in column column 34 in the inner loops in order. In the original code, reading down column 34 the numbers a 1, 0, 2, 3. This has to be done in both of the inner loops on the 4 lines I indicated. These numbers are the indices to the RGBA color.

I'm not sure if my explanation is adequate, so instead of expanding this to 1000 words, I'll include a screen shot of the diff with the relevant parts highlighted by Kaleidoscope. The original code is on the left.

enter image description here

I had to download the image to see the relevant details.

Лицензировано под: CC-BY-SA с атрибуция
Не связан с StackOverflow
scroll top