protected override void DrawSpriteInternal(int palette, int portraitPalette, SetPixel setPixel) { for (int i = 0; i < Pixels.Count && (i / Width) < topHeight; i++) { setPixel(i % Width, i / Width, Palettes[palette].Colors[Pixels[i] % 16]); } for (int i = (topHeight + portraintHeight) * Width; i < Pixels.Count && i / Width < (topHeight + portraintHeight + compressedHeight); i++) { setPixel(i % Width, i / Width - portraintHeight, Palettes[palette].Colors[Pixels[i] % 16]); } for (int i = Width * topHeight; i < Pixels.Count && i / Width < (topHeight + portraintHeight); i++) { setPixel(i % Width, i / Width + compressedHeight, Palettes[palette].Colors[Pixels[i] % 16]); } for (int i = Width * (topHeight + portraintHeight + compressedHeight); i < Pixels.Count && (i / Width < Height); i++) { setPixel(i % Width, i / Width, Palettes[palette].Colors[Pixels[i] % 16]); } Rectangle pRect = PortraitRectangle; for (int x = pRect.X; x < pRect.Right; x++) { for (int y = pRect.Y; y < pRect.Bottom && (x + y * Width < Pixels.Count); y++) { setPixel(x, y, Palettes[portraitPalette].Colors[Pixels[x + (y - compressedHeight) * Width] % 16]); } } }
private void SetPixel(Bitmap bmp, SetPixel setPixel) { for (int x = 0; x < LED.WIDTH; x++) { for (int y = 0; y < LED.HEIGHT; y++) { if (bmp.GetPixel(x, y).A != 0) { Console.WriteLine("x:" + x + " y:" + y); setPixel(x, y, RGB.fromColor(bmp.GetPixel(x, y))); } } } }
private void SetPixel(Bitmap bmp, SetPixel setPixel) { for (int x = 0; x < LED.WIDTH; x++) { for (int y = 0; y < LED.HEIGHT; y++) { Color pixel = bmp.GetPixel(x, y); if (pixel.A != 0 && pixel.ToArgb() != Color.Black.ToArgb()) { Console.WriteLine("x:" + x + " y:" + y); setPixel(x, y, RGB.fromColor(bmp.GetPixel(x, y))); } } } }
protected override void DrawSpriteInternal(int palette, int portraitPalette, SetPixel setPixel) { for (int i = 0; i < Pixels.Count && (i / Width) < Height; i++) { setPixel(i % Width, i / Width, Palettes[palette].Colors[Pixels[i] % 16]); } Rectangle pRect = PortraitRectangle; for (int x = pRect.X; x < pRect.Right; x++) { for (int y = pRect.Y; y < pRect.Bottom && (x + y * Width < Pixels.Count); y++) { setPixel(x, y, Palettes[portraitPalette].Colors[Pixels[x + y * Width] % 16]); } } }
protected override void DrawSpriteInternal( int palette, int portraitPalette, SetPixel setPixel ) { for ( int i = 0; i < Pixels.Count && ( i / Width ) < Height; i++ ) { setPixel( i % Width, i / Width, Palettes[palette].Colors[Pixels[i] % 16] ); } Rectangle pRect = PortraitRectangle; for ( int x = pRect.X; x < pRect.Right; x++ ) { for ( int y = pRect.Y; y < pRect.Bottom && ( x + y * Width < Pixels.Count ); y++ ) { setPixel( x, y, Palettes[portraitPalette].Colors[Pixels[x + y * Width] % 16] ); } } }
protected override void DrawSpriteInternal( int palette, int portraitPalette, SetPixel setPixel ) { for ( int i = 0; i < Pixels.Count && ( i / Width ) < topHeight; i++ ) { setPixel( i % Width, i / Width, Palettes[palette].Colors[Pixels[i] % 16] ); } for ( int i = ( topHeight + portraintHeight ) * Width; i < Pixels.Count && i / Width < ( topHeight + portraintHeight + compressedHeight ); i++ ) { setPixel( i % Width, i / Width - portraintHeight, Palettes[palette].Colors[Pixels[i] % 16] ); } for ( int i = Width * topHeight; i < Pixels.Count && i / Width < ( topHeight + portraintHeight ); i++ ) { setPixel( i % Width, i / Width + compressedHeight, Palettes[palette].Colors[Pixels[i] % 16] ); } for ( int i = Width * ( topHeight + portraintHeight + compressedHeight ); i < Pixels.Count && ( i / Width < Height ); i++ ) { setPixel( i % Width, i / Width, Palettes[palette].Colors[Pixels[i] % 16] ); } Rectangle pRect = PortraitRectangle; for ( int x = pRect.X; x < pRect.Right; x++ ) { for ( int y = pRect.Y; y < pRect.Bottom && ( x + y * Width < Pixels.Count ); y++ ) { setPixel( x, y, Palettes[portraitPalette].Colors[Pixels[x + ( y - compressedHeight ) * Width] % 16] ); } } }
protected abstract void DrawSpriteInternal(int palette, int portraitPalette, SetPixel setPixel);
protected abstract void DrawSpriteInternal( int palette, int portraitPalette, SetPixel setPixel );