fork download
  1. using SkiaSharp;
  2. using SkiaSharp.Views.Desktop;
  3. using System;
  4. using System.Threading.Tasks;
  5. using System.Windows;
  6.  
  7. namespace WpfApp2 {
  8.  
  9. public partial class MainWindow : Window {
  10.  
  11.  
  12.  
  13. public MainWindow() {
  14. InitializeComponent();
  15.  
  16.  
  17.  
  18.  
  19. }
  20.  
  21. private int x;
  22. private int y;
  23.  
  24. private void OnPaintSample(object sender, SKPaintSurfaceEventArgs e )
  25. {
  26. Render( e.Surface.Canvas );
  27. }
  28.  
  29. public void Render(SKCanvas canvas) {
  30.  
  31. if(y == 1) {
  32. canvas.Clear();
  33. y = 0;
  34. }
  35.  
  36. SKPaint thickLinePaint = new SKPaint
  37. {
  38. Style = SKPaintStyle.Stroke,
  39. Color = SKColors.Orange,
  40. StrokeWidth = 5
  41. };
  42.  
  43.  
  44. canvas.DrawLine(x, 0, x, 500, thickLinePaint);
  45. canvas.DrawLine(0, x, x, 0, thickLinePaint);
  46. }
  47.  
  48. private async void Window_Loaded(object sender, RoutedEventArgs e) {
  49.  
  50.  
  51. while ( true ){
  52. for ( int i = 0; i <= 600; ++i ){
  53. x = i;
  54. this.skElement.InvalidateVisual();
  55. await Task.Delay(TimeSpan.FromSeconds(0.001));
  56. y = 1;
  57.  
  58. }
  59. }
  60.  
  61.  
  62. }
  63. }
  64. }
  65.  
Compilation error #stdin compilation error #stdout 0s 0KB
stdin
Standard input is empty
compilation info
prog.c:1:1: error: unknown type name ‘using’
 using SkiaSharp;
 ^~~~~
prog.c:2:1: error: unknown type name ‘using’
 using SkiaSharp.Views.Desktop;
 ^~~~~
prog.c:2:16: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘.’ token
 using SkiaSharp.Views.Desktop;
                ^
prog.c:3:1: error: unknown type name ‘using’
 using System;
 ^~~~~
prog.c:4:1: error: unknown type name ‘using’
 using System.Threading.Tasks;
 ^~~~~
prog.c:4:13: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘.’ token
 using System.Threading.Tasks;
             ^
prog.c:5:1: error: unknown type name ‘using’
 using System.Windows;
 ^~~~~
prog.c:5:13: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘.’ token
 using System.Windows;
             ^
prog.c:7:1: error: unknown type name ‘namespace’
 namespace WpfApp2 {
 ^~~~~~~~~
prog.c:7:19: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘{’ token
 namespace WpfApp2 {
                   ^
stdout
Standard output is empty