[Mono-dev] System.Drawing.Graphics exceptions

Sebastien Pouliot sebastien.pouliot at gmail.com
Tue Jul 14 15:22:29 EDT 2009


Hello Jon,

The exception from your previous email* shows the problem:

        [root at localhost BTOAD]# mono RMScreenShot.exe test.jpg
        >             BTOStudio RM Client ScreenShot Utility
        < ERROR >     Fatal Error: System.NotImplementedException: 0bbp
        depth not
        supported.

So for some reason (is X running? remote access??) the current visual
returns 0bbp which is unusable to create a screenshot. 

Are you able to run GUI (e.g. SWF) apps from your terminal session ?

Sebastien

* please note that this is a mailing-list, even if you're using it like
a forum with nabble. As such it can be difficult to read your email
thread if you don't include the text from previous one.

On Tue, 2009-07-14 at 11:37 -0700, Jon James wrote:
> -bump-
> 
> Any thoughts around this problem?  I've gone through the
> system.drawing.graphics source code. I'm thinking there is an issue with
> this line:
> 
> 240: Bitmap bmp = new Bitmap (blockRegionSize.Width,
> blockRegionSize.Height);  or the visual object that is created in the
> method.  
> 
> or these lines:
> 
> 229: XVisualInfo visual = new XVisualInfo ();
> 
> /* Get XVisualInfo for this visual */
> visual.visualid = GDIPlus.XVisualIDFromVisual(defvisual);
> vPtr = GDIPlus.XGetVisualInfo (GDIPlus.Display, 0x1 /* VisualIDMask */, ref
> visual, ref nitems);
> visual = (XVisualInfo) Marshal.PtrToStructure(vPtr, typeof (XVisualInfo));
> 
> /* Sorry I do not have access to a computer with > deepth. Fell free to add
> more pixel formats */	
> image = GDIPlus.XGetImage (GDIPlus.Display, window, sourceX, sourceY,
> blockRegionSize.Width,
> 	blockRegionSize.Height, AllPlanes, 2 /* ZPixmap*/);
> 				
> Bitmap bmp = new Bitmap (blockRegionSize.Width, blockRegionSize.Height);
> 	int red, blue, green;
> 		for (int y = 0; y < blockRegionSize.Height; y++) {
> 			for (int x = 0; x < blockRegionSize.Width; x++) {
> 				pixel = GDIPlus.XGetPixel (image, x, y);
> 
> 				switch (visual.depth) {
> 					case 16: /* 16bbp pixel transformation */
> 						red = (int) ((pixel & visual.red_mask ) >> 8) & 0xff;
> 						green = (int) (((pixel & visual.green_mask ) >> 3 )) & 0xff;
> 						blue = (int) ((pixel & visual.blue_mask ) << 3 ) & 0xff;
> 						break;
> 					case 24:
> 					case 32:
> 						red = (int) ((pixel & visual.red_mask ) >> 16) & 0xff;
> 						green = (int) (((pixel & visual.green_mask ) >> 8 )) & 0xff;
> 						blue = (int) ((pixel & visual.blue_mask )) & 0xff;
> 						break;
> 					default:
> 						string text = Locale.GetText ("{0}bbp depth not supported.",
> visual.depth);
> 						throw new NotImplementedException (text);
> 				}



More information about the Mono-devel-list mailing list