Discussion:
VGA, SVGA, and System.Drawing
Adam Shumann
2012-02-27 20:04:39 UTC
Permalink
Hello, I am wanting to port a C# GUI library to Cosmos, (
http://code.google.com/p/gwen-dotnet/).
Is there any basic implementation of System.Drawing already? All the GUI
library uses is Rectangle, Point, and Color. It also uses the cursor class
from System.Windows.Forms but that should be easy to change.
The Library is renderer and input independent, that includes fonts and
images. The renderer implementation takes care of Font data format and
image format so images could be stored in a format thats easier to transfer
to video ram either directly or via setPixel (Which would be slow...)

Also, besides 320x200x8 mode, is the VMWare SVGA driver working or usable?
I'm not afraid of having to set the memory data directly, The main thing is
I need to be able to initialize to a resolution. Last time I worked with
VGAScreen I had used it to intialize the VGA adapter to a specific textmode
resolution then managed the memory directly.

Any thoughts? Should I wait for the compiler changes or continue? Also, it
uses a few Generic Collections, how hard would it be to implement a fixed
collection that would work? (Dictionary and List are the only ones used
from the code I have went through).

Thanks,
Adam
Matheus Salvia
2012-02-27 20:10:11 UTC
Permalink
I dont know about the System.Drawing, but i think List<> is implemented,
and if that is the case, I have a pretty good Dictionary<,> implementation,
I can send it to you.
Adam Shumann
2012-02-27 20:13:17 UTC
Permalink
Ok, That would help a lot, thanks :)

Is there anything against using Mono code? Or should i implement the Color,
Rectangle, and Point classes myself?

Adam
Post by Matheus Salvia
**
I dont know about the System.Drawing, but i think List<> is implemented,
and if that is the case, I have a pretty good Dictionary<,> implementation,
I can send it to you.
Adam Shumann
2012-02-27 20:22:51 UTC
Permalink
It seems List<> isnt completely implemented either :/ I get compiler error
if I try using List.Contains() which is used in the libary code :/

Error 292 Natie code encountered, plug required. Please see
http://cosmos.codeplex.com/wikipage?title=Plugs). System.Object
System.RuntimeTypeHandle.CreateInstanceForAnotherGenericParameter(System.RuntimeType,
System.RuntimeType).
Called from :
System.Collections.Generic.EqualityComparer`1[System.String]
CreateComparer()
System.Collections.Generic.EqualityComparer`1[System.String] get_Default()
Boolean Contains(System.String)
Void BeforeRun()
Void BeforeRun()

at Cosmos.IL2CPU.ILScanner.ScanMethod(MethodBase aMethod, Boolean
aIsPlug, Object sourceItem) in
c:\programming\cosmos-84844\source2\IL2CPU\Cosmos.IL2CPU\ILScanner.cs:line
815
at Cosmos.IL2CPU.ILScanner.ScanQueue() in
c:\programming\cosmos-84844\source2\IL2CPU\Cosmos.IL2CPU\ILScanner.cs:line
955
at Cosmos.IL2CPU.ILScanner.Execute(MethodBase aStartMethod) in
c:\programming\cosmos-84844\source2\IL2CPU\Cosmos.IL2CPU\ILScanner.cs:line
316
at Cosmos.Build.MSBuild.IL2CPUTask.Execute() in
c:\programming\cosmos-84844\source2\Build\Cosmos.Build.MSBuild\IL2CPUTask.cs:line
249 C:\Program Files (x86)\MSBuild\Cosmos\Cosmos.targets 32 10
GwenPortBoot
Post by Adam Shumann
Ok, That would help a lot, thanks :)
Is there anything against using Mono code? Or should i implement the
Color, Rectangle, and Point classes myself?
Adam
Post by Matheus Salvia
**
I dont know about the System.Drawing, but i think List<> is implemented,
and if that is the case, I have a pretty good Dictionary<,> implementation,
I can send it to you.
Matheus Salvia
2012-02-27 20:30:46 UTC
Permalink
I guess I could implement comparing systems and List<>. I can reuse lots of
code from my Dictionary class.
Adam Shumann
2012-02-27 20:33:09 UTC
Permalink
Contains() should be easy, it can be implemented as 'return (IndexOf(value)
=0);' but indexOf isnt implemented either. ;/ Which project has the code
for List<> ?
**
I guess I could implement comparing systems and List<>. I can reuse lots
of code from my Dictionary class.
Orvid King
2012-02-28 00:39:09 UTC
Permalink
Well, my Orvid.Graphics code is probably the closest thing to a working
setup for it, but it's by no means compatible with System.Drawing. For
one, Fonts are just barely supported (I am working on a TrueType renderer,
and I have the glyphs loading, just need to get the VM setup for Font
Hinting). Secondly, It's designed completely independent of
System.Drawing, and as such, uses a very different style of drawing. It
also only supports single pixel wide lines atm. (though that's mostly
because I haven't had a need for thicker lines).
Post by Adam Shumann
Contains() should be easy, it can be implemented as 'return
(IndexOf(value)
=0);' but indexOf isnt implemented either. ;/ Which project has the code
for List<> ?
On Mon, Feb 27, 2012 at 2:30 PM, Matheus Salvia
**
I guess I could implement comparing systems and List<>. I can reuse lots
of code from my Dictionary class.
------------------------------------

--------------------------------------------------
More things to join for Cosmos!

1) Cosmos chat room:
http://tinyurl.com/pc7bds

2) Please add yourself to the map:
http://tinyurl.com/qhttde

3) Help publicity and join our Facebook page:
http://tinyurl.com/plrloa

--------------------------------------------------

Yahoo! Groups Links

<*> To visit your group on the web, go to:
http://groups.yahoo.com/group/Cosmos-Dev/

<*> Your email settings:
Individual Email | Traditional

<*> To change settings online go to:
http://groups.yahoo.com/group/Cosmos-Dev/join
(Yahoo! ID required)

<*> To change settings via email:
Cosmos-Dev-digest-***@public.gmane.org
Cosmos-Dev-fullfeatured-***@public.gmane.org

<*> To unsubscribe from this group, send an email to:
Cosmos-Dev-unsubscribe-***@public.gmane.org

<*> Your use of Yahoo! Groups is subject to:
http://docs.yahoo.com/info/terms/
Adam Shumann
2012-02-28 00:42:09 UTC
Permalink
Whats the stance on using Mono code? Should I try coding System.Drawing
classes myself? I've found that the portions of System.Drawing that I need
aren't tied to the rest of Mono very much, Copying the class files works
from my (limited) testing.
But if its recommended to write my own code I can easily do that for
Rectangle, Point, Size, and possibly Color.

Adam
Post by Orvid King
Well, my Orvid.Graphics code is probably the closest thing to a working
setup for it, but it's by no means compatible with System.Drawing. For
one, Fonts are just barely supported (I am working on a TrueType renderer,
and I have the glyphs loading, just need to get the VM setup for Font
Hinting). Secondly, It's designed completely independent of
System.Drawing, and as such, uses a very different style of drawing. It
also only supports single pixel wide lines atm. (though that's mostly
because I haven't had a need for thicker lines).
Post by Adam Shumann
Contains() should be easy, it can be implemented as 'return
(IndexOf(value)
=0);' but indexOf isnt implemented either. ;/ Which project has the code
for List<> ?
On Mon, Feb 27, 2012 at 2:30 PM, Matheus Salvia
**
I guess I could implement comparing systems and List<>. I can reuse lots
of code from my Dictionary class.
------------------------------------
--------------------------------------------------
More things to join for Cosmos!
http://tinyurl.com/pc7bds
http://tinyurl.com/qhttde
http://tinyurl.com/plrloa
--------------------------------------------------
Yahoo! Groups Links
Orvid King
2012-02-28 00:44:20 UTC
Permalink
The issue with it is that the actual code to do the drawing doesn't exist
in C# yet, with mono it's all passed into LibGDI+, which is native, and
thus, isn't usable from Cosmos.
Post by Adam Shumann
Whats the stance on using Mono code? Should I try coding System.Drawing
classes myself? I've found that the portions of System.Drawing that I need
aren't tied to the rest of Mono very much, Copying the class files works
from my (limited) testing.
But if its recommended to write my own code I can easily do that for
Rectangle, Point, Size, and possibly Color.
Adam
Post by Orvid King
Well, my Orvid.Graphics code is probably the closest thing to a working
setup for it, but it's by no means compatible with System.Drawing. For
one, Fonts are just barely supported (I am working on a TrueType renderer,
and I have the glyphs loading, just need to get the VM setup for Font
Hinting). Secondly, It's designed completely independent of
System.Drawing, and as such, uses a very different style of drawing. It
also only supports single pixel wide lines atm. (though that's mostly
because I haven't had a need for thicker lines).
Post by Adam Shumann
Contains() should be easy, it can be implemented as 'return
(IndexOf(value)
=0);' but indexOf isnt implemented either. ;/ Which project has the
code
Post by Adam Shumann
for List<> ?
On Mon, Feb 27, 2012 at 2:30 PM, Matheus Salvia
**
I guess I could implement comparing systems and List<>. I can reuse
lots
Post by Adam Shumann
of code from my Dictionary class.
------------------------------------
--------------------------------------------------
More things to join for Cosmos!
http://tinyurl.com/pc7bds
http://tinyurl.com/qhttde
http://tinyurl.com/plrloa
--------------------------------------------------
Yahoo! Groups Links
--
Using Opera's revolutionary email client: http://www.opera.com/mail/


------------------------------------

--------------------------------------------------
More things to join for Cosmos!

1) Cosmos chat room:
http://tinyurl.com/pc7bds

2) Please add yourself to the map:
http://tinyurl.com/qhttde

3) Help publicity and join our Facebook page:
http://tinyurl.com/plrloa

--------------------------------------------------

Yahoo! Groups Links

<*> To visit your group on the web, go to:
http://groups.yahoo.com/group/Cosmos-Dev/

<*> Your email settings:
Individual Email | Traditional

<*> To change settings online go to:
http://groups.yahoo.com/group/Cosmos-Dev/join
(Yahoo! ID required)

<*> To change settings via email:
Cosmos-Dev-digest-***@public.gmane.org
Cosmos-Dev-fullfeatured-***@public.gmane.org

<*> To unsubscribe from this group, send an email to:
Cosmos-Dev-unsubscribe-***@public.gmane.org

<*> Your use of Yahoo! Groups is subject to:
http://docs.yahoo.com/info/terms/
Adam Shumann
2012-02-28 00:47:55 UTC
Permalink
The only code I was planning on using was the Rectangle, Point, Size, and
Color.
The GUI Library allows any renderer to be used so I was going to implement
one over the VGAScreen interface.
I'm still trying to decide on whether to use VGAScreen.SetPixel or writing
to memory directly. Hardest part will be Fonts and the skinning. I am
planning on writing a simple line/boxx based skin for now until I get
images working.

Adam
Post by Orvid King
The issue with it is that the actual code to do the drawing doesn't exist
in C# yet, with mono it's all passed into LibGDI+, which is native, and
thus, isn't usable from Cosmos.
Post by Adam Shumann
Whats the stance on using Mono code? Should I try coding System.Drawing
classes myself? I've found that the portions of System.Drawing that I need
aren't tied to the rest of Mono very much, Copying the class files works
from my (limited) testing.
But if its recommended to write my own code I can easily do that for
Rectangle, Point, Size, and possibly Color.
Adam
Post by Orvid King
Well, my Orvid.Graphics code is probably the closest thing to a working
setup for it, but it's by no means compatible with System.Drawing. For
one, Fonts are just barely supported (I am working on a TrueType renderer,
and I have the glyphs loading, just need to get the VM setup for Font
Hinting). Secondly, It's designed completely independent of
System.Drawing, and as such, uses a very different style of drawing. It
also only supports single pixel wide lines atm. (though that's mostly
because I haven't had a need for thicker lines).
Post by Adam Shumann
Contains() should be easy, it can be implemented as 'return (IndexOf(value)
=0);' but indexOf isnt implemented either. ;/ Which project has the
code
Post by Adam Shumann
for List<> ?
On Mon, Feb 27, 2012 at 2:30 PM, Matheus Salvia
**
I guess I could implement comparing systems and List<>. I can reuse
lots
Post by Adam Shumann
of code from my Dictionary class.
------------------------------------
--------------------------------------------------
More things to join for Cosmos!
http://tinyurl.com/pc7bds
http://tinyurl.com/qhttde
http://tinyurl.com/plrloa
--------------------------------------------------
Yahoo! Groups Links
--
Using Opera's revolutionary email client: http://www.opera.com/mail/
------------------------------------
--------------------------------------------------
More things to join for Cosmos!
http://tinyurl.com/pc7bds
http://tinyurl.com/qhttde
http://tinyurl.com/plrloa
--------------------------------------------------
Yahoo! Groups Links
Adam Shumann
2012-02-28 01:07:08 UTC
Permalink
Just verified that Point, Size, and Rectangle port to Cosmos without any
extra modification. :) I did have to include the SizeF, PointF, and
RectangleF but they probably don't work... I just copied them to avoid
modifying the classes and to satisfy VS compiler.

Adam
Post by Adam Shumann
The only code I was planning on using was the Rectangle, Point, Size, and
Color.
The GUI Library allows any renderer to be used so I was going to implement
one over the VGAScreen interface.
I'm still trying to decide on whether to use VGAScreen.SetPixel or writing
to memory directly. Hardest part will be Fonts and the skinning. I am
planning on writing a simple line/boxx based skin for now until I get
images working.
Adam
Post by Orvid King
The issue with it is that the actual code to do the drawing doesn't exist
in C# yet, with mono it's all passed into LibGDI+, which is native, and
thus, isn't usable from Cosmos.
Post by Adam Shumann
Whats the stance on using Mono code? Should I try coding System.Drawing
classes myself? I've found that the portions of System.Drawing that I need
aren't tied to the rest of Mono very much, Copying the class files works
from my (limited) testing.
But if its recommended to write my own code I can easily do that for
Rectangle, Point, Size, and possibly Color.
Adam
Post by Orvid King
Well, my Orvid.Graphics code is probably the closest thing to a working
setup for it, but it's by no means compatible with System.Drawing. For
one, Fonts are just barely supported (I am working on a TrueType renderer,
and I have the glyphs loading, just need to get the VM setup for Font
Hinting). Secondly, It's designed completely independent of
System.Drawing, and as such, uses a very different style of drawing. It
also only supports single pixel wide lines atm. (though that's mostly
because I haven't had a need for thicker lines).
Post by Adam Shumann
Contains() should be easy, it can be implemented as 'return (IndexOf(value)
=0);' but indexOf isnt implemented either. ;/ Which project has the
code
Post by Adam Shumann
for List<> ?
On Mon, Feb 27, 2012 at 2:30 PM, Matheus Salvia
**
I guess I could implement comparing systems and List<>. I can reuse
lots
Post by Adam Shumann
of code from my Dictionary class.
------------------------------------
--------------------------------------------------
More things to join for Cosmos!
http://tinyurl.com/pc7bds
http://tinyurl.com/qhttde
http://tinyurl.com/plrloa
--------------------------------------------------
Yahoo! Groups Links
--
Using Opera's revolutionary email client: http://www.opera.com/mail/
------------------------------------
--------------------------------------------------
More things to join for Cosmos!
http://tinyurl.com/pc7bds
http://tinyurl.com/qhttde
http://tinyurl.com/plrloa
--------------------------------------------------
Yahoo! Groups Links
Matheus Salvia
2012-02-28 02:19:04 UTC
Permalink
Adam: The best is probably to adapt the classes you got from mono to use
Orvid.Graphics.
Adam Shumann
2012-02-28 03:05:00 UTC
Permalink
One thing I noticed about the classes I got, are that they aren't dependent
on rendering code. They just store x, y, width, and height. Now I'm trying
to figure out how to put them in a plug so they will work with the
System.Drawing namespace. Or is it better to cahnge the Namespace to
Orvid.Graphics?
Post by Matheus Salvia
**
Adam: The best is probably to adapt the classes you got from mono to use
Orvid.Graphics.
Matheus Salvia
2012-02-28 03:25:29 UTC
Permalink
I thin Orvid.Graphics, because right know there is no System.Drawing.
Loading...