Re: [Mono-dev] Patch to RotateFlip: reworks existing code and adds 1-and 4-bit support
At 10:44 PM 23/10/2005 -0600, Peter Dennis Bartok wrote: >Jonathan, > >I haven't reviewed the patch yet, but I noticed that you put the tests for >it in winforms; it'd be cool you would nunit-ify them and put them straight >under System.Drawing/Test? Maybe using GetPixel to verify it rotated >correctly. That way it could be automated. The winforms module is mostly >meant for visual test applications. > >I'll respond on the patch tomorrow, after I had a chance to review. > >Cheers, > Peter I poked around in the System.Drawing tests and found that there was already a test in place for rotation of non-indexed bitmaps, so I added a test for just 1- and 4-bit bitmaps (see attached patch). It uses Marshal.ReadByte() in conjunction with Bitmap.LockBits() to read the packed representation of the pixels. I hope this is okay :-) Sorry for adding inappropriate tests to the winforms module. If you'd like, I could hack up the tests there to display their results visually ;-) Jonathan rotate1bit4bit-test.patch.gz Description: Binary data ___ Mono-devel-list mailing list Mono-devel-list@lists.ximian.com http://lists.ximian.com/mailman/listinfo/mono-devel-list
Re: [Mono-dev] Patch to RotateFlip: reworks existing code and adds 1- and 4-bit support
Jonathan, I haven't reviewed the patch yet, but I noticed that you put the tests for it in winforms; it'd be cool you would nunit-ify them and put them straight under System.Drawing/Test? Maybe using GetPixel to verify it rotated correctly. That way it could be automated. The winforms module is mostly meant for visual test applications. I'll respond on the patch tomorrow, after I had a chance to review. Cheers, Peter -Original Message- From: "Jonathan Gilbert" <[EMAIL PROTECTED]> To: Date: 23 October, 2005 17:22 Subject: [Mono-dev] Patch to RotateFlip: reworks existing code and adds 1- and 4-bit support >Hi, > >I've been working on RotateFlip for an application of mine, as it was >causing mono to crash. I eventually did locate the source of the crash, but >not before rewriting large parts of the RotateFlip code, which I found to >be somewhat splayed and repetitive, into one comprehensive loop that >handles all varieties of rotation & flipping. (Separate flipping functions >are still available.) I also added error handling, since rotation allocates >a new buffer for the result. > >I also realized that the original code had been put together before my >large indexed Bitmap support patch; it could not possibly handle images >with more than one pixel per byte. Using the "pixel streams" which I also >added in the aforementioned patch, I put together a parallel function to >handle rotation/flipping of these types of Bitmaps. I have already >committed a test case for this, which requires the patch attached to this >e-mail to run, as 'winforms/rotate1bit4bit'. (Type 'make test' to build & >run the test.) Since support for 1- and 4-bit images could be seen as >conceptually separate from the fix for 8-bit and up Bitmaps crashing after >being rotated, I have also submitted separate test in a very similar vein >under simply 'winforms/rotate'. > >I submit this patch for approval by anyone with interest in RotateFlip. It >is fully tested and known to work, but feel free to submit it to whatever >scrutiny you feel is necessary. I can commit it if nobody finds issue with >the patch :-) > >Thanks, > >Jonathan Gilbert ___ Mono-devel-list mailing list Mono-devel-list@lists.ximian.com http://lists.ximian.com/mailman/listinfo/mono-devel-list
[Mono-dev] Patch to RotateFlip: reworks existing code and adds 1- and 4-bit support
Hi, I've been working on RotateFlip for an application of mine, as it was causing mono to crash. I eventually did locate the source of the crash, but not before rewriting large parts of the RotateFlip code, which I found to be somewhat splayed and repetitive, into one comprehensive loop that handles all varieties of rotation & flipping. (Separate flipping functions are still available.) I also added error handling, since rotation allocates a new buffer for the result. I also realized that the original code had been put together before my large indexed Bitmap support patch; it could not possibly handle images with more than one pixel per byte. Using the "pixel streams" which I also added in the aforementioned patch, I put together a parallel function to handle rotation/flipping of these types of Bitmaps. I have already committed a test case for this, which requires the patch attached to this e-mail to run, as 'winforms/rotate1bit4bit'. (Type 'make test' to build & run the test.) Since support for 1- and 4-bit images could be seen as conceptually separate from the fix for 8-bit and up Bitmaps crashing after being rotated, I have also submitted separate test in a very similar vein under simply 'winforms/rotate'. I submit this patch for approval by anyone with interest in RotateFlip. It is fully tested and known to work, but feel free to submit it to whatever scrutiny you feel is necessary. I can commit it if nobody finds issue with the patch :-) Thanks, Jonathan Gilbert rotate1bit4bit.patch.gz Description: Binary data ___ Mono-devel-list mailing list Mono-devel-list@lists.ximian.com http://lists.ximian.com/mailman/listinfo/mono-devel-list