C
C#ā€¢6mo ago
Podreju

C# WPF: Creating 2D Graphics

I have been tasked with writing a program similar to AutoCAD but in a more simplified version. The functionality includes creating a drawing based on geodetic points, as well as creating a building or floor plan, with the ability to have an interactive interface. I plan to develop this using C# WPF following the MVVM pattern. However, I am unsure where to start or what to use. Should I use InkCanvas? Should I use an OpenGL engine? The catch is that it must support .NET Framework 4.5. If you have had a similar experience or any thoughts on this, I would appreciate it if you could share them with me. It would be a significant advantage if this implementation could be ported to Linux, for example, through Wine.
22 Replies
canton7
canton7ā€¢6mo ago
WPF doesn't run on linux, period. Winforms can run under Wine. Something like Skia might be of interest. But to be honest, you might be better off using something like Unity
Podreju
PodrejuOPā€¢6mo ago
One person in our team managed to port the main program to Linux using Wine, although it doesn't work as well as we would like.
leowest
leowestā€¢6mo ago
Avalonia works on linux, windows, macos for desktop uses Skia you can Draw its very close to WPF in terms of dev https://github.com/AvaloniaUI/Avalonia/blob/a6e936d74accdcf7ead6b776f374defb501e4434/samples/RenderDemo/Pages/CustomSkiaPage.cs
Podreju
PodrejuOPā€¢6mo ago
No description
leowest
leowestā€¢6mo ago
well .net framework is windows only so there goes your "linux" why can't you use .net 8?
Podreju
PodrejuOPā€¢6mo ago
AvaloniaUI is a good option, thank you
leowest
leowestā€¢6mo ago
it fits all your needs specially on running natively
Podreju
PodrejuOPā€¢6mo ago
Due to the fact that there are users on windows xp šŸ’€
leowest
leowestā€¢6mo ago
:OOF: I know avalonia works on win7 but xp that is way off already well if this is for a company Avalonia offers XPF so you can develop everything in WPF and XPF makes it crossplaform
Podreju
PodrejuOPā€¢6mo ago
Well, perhaps it will be possible to convince them that support for >Win10 is unnecessary.
leowest
leowestā€¢6mo ago
I wish u gl, some companies dont like having the cost to upgrade even justifiable I know a bunch of big supermakerts that still use win xp and just wont upgrade.
Podreju
PodrejuOPā€¢6mo ago
There is some truth to this, even though we want to provide all users with a modern product, there are challenges like this one. @canton7 @leowest Thank you, for now, I will look into "Skia", and if there are any more options, I would appreciate it.
canton7
canton7ā€¢6mo ago
Except for Wine šŸ™‚
leowest
leowestā€¢6mo ago
which is a windows emulation on linux ĀÆ\_(惄)_/ĀÆ
canton7
canton7ā€¢6mo ago
I mean, you did say "so there goes your "linux"" afterwards Wine is very much linux
leowest
leowestā€¢6mo ago
its not the same thing as running natively
canton7
canton7ā€¢6mo ago
Indeed. But it does let you run Framework stuff on Linux, including winforms
Mkp
Mkpā€¢6mo ago
OpenGL, if you can muster learning it, would be an excellent application for such a program. Terms such as but in a more simplified version tell me you're not interested in making a robust product more so a product that works in the first place. At what level do you expect to work on? If you are manipulating/generating geometry then OpenGL would be extremely handy as you can render your generated meshes in a scene. Its extremely low level. Deep and complex. Silk.NET supports linux, mac, and windows as well. There is a lot of setup, since its pretty bare bones, but it could pay off. As far as support from others go the OpenGL community (graphics in general) is filled with boomers who are still on the toxic programmer 'helping' mentality instead of the just fucking help side.
Podreju
PodrejuOPā€¢6mo ago
Absolutely, I am interested in a robust product. However, given AutoCAD itself, its capabilities, and functionality, my application would require only about 20-30% of its features, as there is no urgent need for more extensive functionality. The primary focus is on cadastral applications. It's worth noting that the main tasks will involve geometry manipulation, constructing complex shapes with numerous geodetic points. Additionally, there is a need for the ability to translate "drawings" into required coordinate systems (which I am proficient at) and other related tasks. Considering my interest in a high-quality product with good optimization, I turned to the community's experience for guidance.
canton7
canton7ā€¢6mo ago
Given that AutoCAD is HUGE, 20-30% of its features is still a mammoth task Like, give me a team and a year or two, sort of scope
Podreju
PodrejuOPā€¢6mo ago
Agreed, AutoCAD is vast, perhaps I exaggerated with the percentages somewhere.
Mkp
Mkpā€¢6mo ago
Yeah opengl is the move I think it even warrants a separation of engine from business code as well The engine should probably be written as its own library
Want results from more Discord servers?
Add your server