public void Initalize(Color top, Color bot, double pos, bool usegamma, Blend.Mode mode) { this.top = new Color(top); this.bot = new Color(bot); this.pos = pos; this.usegamma = usegamma; this.mode = mode; }
// public void Apply(Image img, double pos, bool usegamma, Blend.Mode mode) { for (ushort y = 0; y < Height; y++) { for (ushort x = 0; x < Width; x++) { matrix[x, y] = new Chixel(Blend.Apply(img[x, y].MeshColor, matrix[x, y].MeshColor, pos, usegamma, mode)); } } }
// public static Fusion[] Explore(Color[] source, double[] pos, bool usegamma, Blend.Mode mode) { Fusion[] option = new Fusion[source.Length * source.Length * pos.Length]; // max size Fusion[] unique; ushort count = 0; // I wrote this a long time ago // this is really bad style! // I've got a way to make this twice as efficient, but it only works for ideal blend modes: b(u, v) = b(v, u) and b(u, u) = u // basically when pos = 0 OR 1, there are only L colors @ i = j; pos = 0.5, there are L(L-1)/2 colors @ i < j; else, there are L(L-1) colors @ i != j for (byte i = 0; i < source.Length; i++) { for (byte j = 0; j < source.Length; j++) { for (byte k = 0; k < pos.Length; k++) { option[count] = new Fusion(source[i], source[j], pos[k], usegamma, mode); option[count].Create(); for (ushort l = 0; l < count; l++) { if (option[l].blend.ARGB == option[count].blend.ARGB) { count--; break; } } count++; } } } // b/c count is always incremented last and is 0-indexed, it is the length of the unique colors unique = new Fusion[count]; for (ushort i = 0; i < unique.Length; i++) { unique[i] = option[i]; } return(unique); }
// public Fusion(Color top, Color bot, double pos, bool usegamma, Blend.Mode mode) { Initalize(top, bot, pos, usegamma, mode); }