Are there any libraries that utilize the the Canvases for Mono Android and MonoTouch? I am trying to draw node + edge network graphs and am hoping to avoid duplicating work by writing code to figure out methods for edge, node, and text placement (for labeling a node).
I'm not sure about the edge/node/text placement part of your question, but one project that's recently emerged is https://github.com/praeclarum/CrossGraphics which looks promising for sharing drawing code across the Mono mobile platforms:
Drawing commands include:
Rectangles using FillRect and DrawRect
Rounded Rectangles using FillRoundedRect and DrawRoundedRect
Ovals using FillOval and DrawOval
Lines using DrawLine and the option BeginLine and EndLine primitives
Images using DrawImage
Text using DrawString and the associated font
functions
Related
I build an application which part is also drawing into video frames. For this I am using Graphics library from System.Drawing. Drawing is working fine and is already implemented. But I also need to be able to draw straight lines with for example this kind of curvy pattern:
.
Could somebody help me how this could be achievable?
How can I get the C# winform graphics system from iTextSharp?
So that I can use DrawString(....) to draw text directly onto the existed PDF.
Unfortunately this isn't possible right now. iText, the Java-based library, subclassed the system class java.awt.Graphics2D which is a further subclass of java.awt.Graphics. This allowed them to bridge Sun/Oracle's drawing paradigms with their own. iTextSharp was ported from Java to C# but for whatever reason the system Graphics bridging code was not ported.
If I were to guess Java and .Net's version of Graphics were too dissimilar and there just wasn't enough community desire to bother with it. Also, .Net's implementation has extra abstractions like Pen and Brush so this would have made the bridge code very different between the Java and .Net version. Not to mention methods like FillPie(), MeasureString(), etc.
Right now your two main options are to either just manually draw to the PdfContentByte object which, once you get used to the inverted axis (Adobe's fault, not iText), goes pretty easy, or you can draw to a .Net image and then just embed it. If you do the latter, I'd recommend at least tripling the image resolution and then embedding it at a third of the size, effectively kicking up the DPI.
You can also try something like PDFsharp which, according to their site, has a very native feel for drawing.
I need to visualize constructive geometry in 3d using C#. And for that I want choose a library. Ideally, that library should be able to provide the following:
Rendering arbitrary polygons in 3d. Wireframe representation.
Orhtographic projection
Camera control. I need to be able to zoom-in/out, set center of rotation to turn camera around it.
Pick my polygons, edges, vertices with a mouse.
Draw text on top of vertices, edges and polygons.
Efficency isn't the priority, so it can be resonably slow if it can do these things right out of the box or provide a good high level service for it.
I tried to look at XNA. But as far as I understood it doesn't support visualization of polygons directly.
XNA does support visualization of polygons directly by providing access to the underlying Direct3D 9 GraphicsDevice object. You can also dynamically create a mesh and draw it in a managed way, however that will be slower.
See:
http://msdn.microsoft.com/en-us/library/windowsphone/develop/microsoft.xna.framework.graphics.graphicsdevice.drawprimitives.aspx
and related methods.
There's several DirectX wrappers in c#. I would avoid Managed DirectX since it's deprecated, and you have only access to direct3d9.
The two most common libraries for DirectX are:
SlimDX
SharpDX
Both work pretty well, and support latest DirectX feature set (SlimDX up to 11, SharpDX supports windows 8 and 11.1).
They both support what you need to do, it of course implies a bit of coding on your side.
I have an Image object in my application which the user can drag around. The object displays an image which is partly transparent, so the window background (which is itself a bitmap) can be seen through it.
I want to add a graphics effect to this object. Assume that I already have an algorithm for this effect — that’s not the issue. The issue is how to get this algorithm into WPF.
So I tried to look at how DropShadowEffect works, but the implementation displayed in Reflector is empty. I also tried to look at what methods from the abstract classes Effect and ShaderEffect I should override and there doesn’t seem to be anything related to actually rendering an effect.
So how do I create my own effect?
The best and fastest way is to use pixel shaders (supported starting with WPF 3.5 SP1 I think) . It will require some shader language (HLSL) knowledge, though :-)
Here is a tutorial: How Do I: Create Custom Pixel Shader Effects for WPF
a library on codeplex: Windows Presentation Foundation Pixel Shader Effects Library
an article with .NET 4 information (including Sliverlight support which has it too): SilverShader – Introduction to Silverlight and WPF Pixel Shaders
A very cool tool (and resource) is Shazzam it will help you to create the effects and it contains a nice tutorial.
I’m looking for an advanced noncommercial drawing library for C# with WPF.
My goal is to create a drawing application. Not vector graphic support is needed, only bitmap.
The most advanced non-commercial API's for drawing are going to be DirectX and OpenGL. They are both complex, but you will be able to make them do almost anything you would want. You could also roll your own design that uses an Image and just changes the various pixels manually. You can then draw the image to your window when changes occur. Here is a code example below.
http://msdn.microsoft.com/en-us/library/0t3sakh9.aspx
Is there a specific reason why you can't utilize GDI+? GDI+ is an object-oriented vector-based graphics library built into the .NET Framework. It can perform most trivial drawing tasks, including loading, drawing, and saving bitmaps (BMP, PNG, GIF, JPEG, and others), transforms, color matrix manipulation, and blending. It can also render primitives such as lines, rectangles, circles, and n-sided polygons.
It also has support for render operations, and alpha transparency. You can also draw primitives and other graphical constructs using brushes and patterns, like with GDI.
You can find more information about the classes available to you by looking at the System.Drawing namespace, where most of the GDI+ classes are contained:
http://msdn.microsoft.com/en-us/library/system.drawing.aspx
Your question is not specific, however Graphic Classes in C# has many methods and features to accomplish any Trivial and some non trivial task.. if you need any thing more than that then you have DirectX.