[Mono-dev] System.Drawing.Graphics exceptions

Jon James jon_james at dell.com
Tue Jul 14 14:37:28 EDT 2009


-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);
				}
-- 
View this message in context: http://www.nabble.com/System.Drawing.Graphics-exceptions-tp24435096p24485334.html
Sent from the Mono - Dev mailing list archive at Nabble.com.



More information about the Mono-devel-list mailing list