\r
public class Canvas : Drawable\r
{\r
- public static System.Windows.Controls.Image default_buffer_frame;\r
+ //public static System.Windows.Controls.Image default_buffer_frame;\r
public static System.Windows.Controls.UserControl default_panel;\r
public static System.Windows.Controls.Canvas default_api_canvas;\r
public static WriteableBitmap default_buffer;\r
- System.Windows.Controls.Image instance;\r
+ //WriteableBitmap buffer;\r
+ //System.Windows.Controls.Image instance;\r
System.Windows.Controls.Canvas api_canvas;\r
System.Windows.Controls.UserControl panel;\r
- WriteableBitmap buffer;\r
System.Windows.Shapes.Rectangle back_panel;\r
System.Windows.Media.SolidColorBrush back_panel_color;\r
\r
{\r
panel = default_panel;\r
api_canvas = default_api_canvas;\r
- instance = default_buffer_frame;\r
+ //instance = default_buffer_frame;\r
initialize(wid, hei);\r
}\r
- public Canvas(int wid, int hei, System.Windows.Controls.Image target, System.Windows.Controls.Canvas apicnvs, System.Windows.Controls.UserControl system)\r
+ public Canvas(int wid, int hei, System.Windows.Controls.Canvas apicnvs, System.Windows.Controls.UserControl system)\r
{\r
panel = system;\r
api_canvas = apicnvs;\r
- instance = target;\r
+ //instance = target;\r
initialize(wid, hei);\r
}\r
protected void initialize(int wid, int hei)\r
{\r
- instance.Width = wid;\r
- instance.Height = hei;\r
- instance.Source = buffer;\r
+ //instance.Width = wid;\r
+ //instance.Height = hei;\r
+ //instance.Source = buffer;\r
+ //buffer = new WriteableBitmap((int)instance.Width, (int)instance.Height);\r
+ //default_buffer = buffer;\r
api_canvas.Width = wid;\r
api_canvas.Height = hei;\r
- buffer = new WriteableBitmap((int)instance.Width, (int)instance.Height);\r
api_canvas.MouseMove += Mouse.Canvas_MousePos;\r
api_canvas.MouseLeftButtonDown += Mouse.Canvas_LDown;\r
api_canvas.MouseLeftButtonUp += Mouse.Canvas_LUp;\r
panel.KeyUp += Keyboard.Canvas_KeyUp;\r
Mouse._prime = api_canvas;\r
Main.drawable = this;\r
- default_buffer = buffer;\r
\r
back_panel = new System.Windows.Shapes.Rectangle();\r
back_panel.Width = wid;\r
}\r
public Point getCenter()\r
{\r
- return new Point(instance.Width/2.0, instance.Height/2.0, 0);\r
+ return new Point(api_canvas.Width / 2.0, api_canvas.Height / 2.0, 0);\r
}\r
\r
public void clear()\r
{\r
- buffer.Clear(Color.black);\r
+ //buffer.Clear(Color.black);\r
+ clear(Color.black);\r
}\r
public void clear(Color col)\r
{\r
\r
public void pix(int x, int y, Color col)\r
{\r
- buffer.SetPixel(x, y, col);\r
+ //buffer.SetPixel(x, y, col);\r
}\r
\r
+ #region static initializer\r
+ /*\r
static System.Windows.Shapes.Line api_line;\r
static System.Windows.Shapes.Path api_curve;\r
static System.Windows.Shapes.Rectangle api_rect;\r
static System.Windows.Media.SolidColorBrush api_fill;\r
static System.Windows.Media.SolidColorBrush api_stroke;\r
static System.Windows.Media.TranslateTransform api_translation;\r
+ */\r
protected static System.Collections.Generic.Dictionary<int, System.Windows.FontWeight> FONT_WEIGHT_BRIDGE;\r
protected static System.Collections.Generic.Dictionary<Font.Style, System.Windows.FontStyle> FONT_STYLE_BRIDGE;\r
protected static System.Collections.Generic.Dictionary<Letters.HorizontalAlign, TextAlignment> LETTERS_H_ALIGN_BRIDGE;\r
LETTERS_H_ALIGN_BRIDGE.Add(Letters.HorizontalAlign.TEXT_ALIGN_RIGHT, TextAlignment.Right);\r
LETTERS_H_ALIGN_BRIDGE.Add(Letters.HorizontalAlign.NOT_SPECIFIED, TextAlignment.Left);\r
\r
+ /*\r
api_line = new System.Windows.Shapes.Line();\r
api_curve = new System.Windows.Shapes.Path();\r
api_rect = new System.Windows.Shapes.Rectangle();\r
api_fill = new System.Windows.Media.SolidColorBrush();\r
api_stroke = new System.Windows.Media.SolidColorBrush();\r
api_translation = new System.Windows.Media.TranslateTransform();\r
+ */\r
}\r
+ #endregion\r
\r
public void line(Line drawee, Color col)\r
{\r
public void var<Type>(Type val, double x, double y, Color col) { msg(val.ToString(), x, y, col); }\r
\r
\r
- public int frame;\r
public void flip()\r
{\r
- buffer.Invalidate();\r
- frame++;\r
+ //buffer.Invalidate();\r
}\r
\r
public double width { get { return api_canvas.Width; } }\r
public double height { get { return api_canvas.Height; } }\r
- }\r
\r
+ }\r
\r
}
\ No newline at end of file