11using System ;
2- using System . Drawing ;
3- using Pastel ;
42using System . Text ;
53
6- namespace AshConsoleGraphics
7- {
8-
9- public struct Col {
10- int R ;
11- int G ;
12- int B ;
13-
14- public Col ( int r , int g , int b ) {
15- this . R = r ;
16- this . G = g ;
17- this . B = b ;
18- }
19-
20- public Color toCol ( ) {
21- return Color . FromArgb ( this . R , this . G , this . B ) ;
22- }
23-
24- public static bool operator == ( Col a , Col b )
25- {
26- return ( ( a . R == b . R ) && ( a . G == b . G ) && ( a . B == b . B ) ) ;
27- }
28-
29- public static bool operator != ( Col a , Col b )
30- {
31- return ! ( a == b ) ;
32- }
33-
34- public override string ToString ( )
35- {
36- return string . Format ( "R: {0}; G: {1}; B: {2}" , R , G , B ) ;
37- }
4+ namespace AshConsoleGraphics ;
385
39- public override bool Equals ( object ? obj )
40- {
41- var objectToCompare = obj as Col ? ;
42- if ( objectToCompare == null )
43- return false ;
6+ internal static class FastConsole {
7+ static readonly BufferedStream str ;
448
45- return this . ToString ( ) == obj . ToString ( ) ;
46- }
9+ static FastConsole ( ) {
10+ Console . OutputEncoding = Encoding . Unicode ;
4711
48- public override int GetHashCode ( )
49- {
50- return this . ToString ( ) . GetHashCode ( ) ;
51- }
12+ str = new BufferedStream ( Console . OpenStandardOutput ( ) , 0x15000 ) ;
5213 }
53-
54- public static class FastConsole
55- {
56- static readonly BufferedStream str ;
57-
58- static FastConsole ( )
59- {
60- Console . OutputEncoding = Encoding . Unicode ;
61-
62- str = new BufferedStream ( Console . OpenStandardOutput ( ) , 0x15000 ) ;
63- }
64-
65- public static void Write ( String s )
66- {
67- var rgb = new byte [ s . Length << 1 ] ;
68- Encoding . Unicode . GetBytes ( s , 0 , s . Length , rgb , 0 ) ;
69-
70- lock ( str ) // (optional, can omit if appropriate)
71- str . Write ( rgb , 0 , rgb . Length ) ;
72- }
73-
74- public static void Flush ( ) {
75- lock ( str ) str . Flush ( ) ; }
14+
15+ public static void Write ( String s ) {
16+ var rgb = new byte [ s . Length << 1 ] ;
17+ Encoding . Unicode . GetBytes ( s , 0 , s . Length , rgb , 0 ) ;
18+
19+ lock ( str ) // (optional, can omit if appropriate)
20+ str . Write ( rgb , 0 , rgb . Length ) ;
7621 }
7722
23+ public static void Flush ( ) {
24+ lock ( str ) str . Flush ( ) ; }
25+ }
26+
27+ /// <summary>
28+ /// Elements that can work as connected lines
29+ /// </summary>
30+ public interface ILineElement {
31+ public BitBuffer GenerateBitBuffer ( ) ;
32+ }
33+
34+ /// <summary>
35+ /// The relative placement of TuiElements respect to its parent Screen
36+ /// </summary>
37+ public enum Placement {
38+ Center , TopLeft , TopRight , BottomLeft , BottomRight , CenterLeft , CenterRight , TopCenter , BottomCenter
7839}
0 commit comments