[Mono-list] Why is an X server necessary to useSystem.Drawing.Graphics?

rus rus at forgecom.co.uk
Tue Apr 25 07:59:57 EDT 2006


I have written a small command line prog in mono that rescales a
directory of images using System.Drawing and System.Drawing.Imaging, and
it doesn't require an X server to be actually running.

Maybe certain classes/methods in the namespace do, but my code uses both
the Bitmap and Image classes and runs fine with no X server running.
There is however X installed on the machine, just not necessarily
running.

On Tue, 2006-04-25 at 11:57 +0100, Dallman, John wrote:
> > I suppose my real concern is that if you want to use code to draw
> > (e.g.) CAPTCHAs or other bitmaps as part of a process, rather than for
> > the purposes of drawing UI for the user, running an X server to do it
> > could seem like overkill on a server that would ordinarily not be
> > running one. Feel free to mock my reasoning.
> 
> Have you ever written low-level drawing functions for bitmaps? Code
> that can take coordinates and a bitmap, and draw pictures without
> external assistance? It really isn't trivial, once you start getting 
> into lines with width greater than one pixel, dotted line patterns, 
> colour management, and many other things that look simple on a screen,
> but are complex to implement. 
> 
> X is a capable and well-debugged graphics system. Using it for Mono
> drawing is sensible code re-use, since any modern UNIX/Linux system 
> is capable of running X and has it available. Developing a "simpler" 
> drawing purely for off-screen drawing would grow into a project 
> nearly as complex as X, and which would inevitably have 
> inconsistencies with X. 
> 
> If you are running a server that generates stuff for web pages, 
> rather than being a simple file/print server, it's going to 
> need more support software to do those things. On MS Windows, you
> can't operate without the GUI at all; on UNIX/Linux you can do so 
> for some things, but they're fairly limited. 

-- 
------------------------------------------------
If you can't be a good example,
then you'll just have to be  a horrible warning
------------------------------------------------
rus at utonium.org.uk         http://utonium.com




More information about the Mono-list mailing list