by johnmunro >> Wed, 1 May 2002 16:31:21 GMT
Hi guys - long time listener, first time caller
I need to do a lot of stuff to a TIFF file. Jade doesn't view multi-page TIFF's, so I've written code to take a multi-page TIFF and split it into one single page TIFF per page. This works well. I will also soon write code to put the pages back together into a multi-page TIFF for saving back to the hard drive. I can do all of the splitting/combining using Jade Binary primitives in memory, then put this into the picture property of the picturebox, so it's nice and neat.
The problem I'm having is the processing on the image that I'm going to do to the image between the loading and the saving - i.e. the major part of the application . To begin with, I need to be able to resize the image to a user-selectable zoom level and pan around it if the picture box is smaller than the image.
You'd think this would be fairly easy - stick the binary into a picturebox with stretch set to 'stretch picture to control' and then resize the picturebox relative to the amount of zoom (or use drawPictureIn, same basic result). The problem is that our application deals with scanned images - in almost all cases black and white. When you zoom out, there is a lot of distortion (see the attachment standard.png). We can get over this by using the pixels that are hidden by zooming out to modify the pixels that are visible, resulting in a much more readable image (see the attachment interpol.png).
There is a very useful API call - SetStretchBltMode, which when set to the right mode will achieve the desired effect on a bitmap which has been stretched using the StretchBlt API call. I've made a quick VB program to test this, and it does everything I want it to.
The problem (and reason for this email) is that the whole StretchBlt thing needs to operate on a DC (which I'm assuming I can get from the hWnd of the picturebox using the getDC API call) which has had a GDI bitmap selected into it using the SelectObject API call. I can't seem to get a handle to the bitmap of the picturebox. The picture property of the picturebox is a Jade Bitmap primitive type, and so is no use as a GDI bitmap.
I've tried using SetStretchBltMode on the picturebox and then using the Jade method drawPictureIn, but it didn't interpolate the missing pixels as it should.
The first thing everyone is going to say is to use an external control or DLL. I want to avoid ActiveX/DLL usage as much as possible, because of the issues with maintainability of clients and also the difficulties in moving bitmaps between Jade and ActiveX.
John Munro
Synergist Limited - Home of FileVisionT
The Bioscience Innovation Centre
Cowley Road, Cambridge, UK
CB4 0DS
Telephone: +44 (0) 1223 478200
Fax: +44 (0) 1223 477969
Email: john.munro@filevision.com
Web: http://www.filevision.com
The contents of this communication are confidential and are only intended to be read by the addressee. We apologize if you receive this communication in error and ask that you contact Synergist Limited immediately to arrange for its return. The use of any information contained in this communication by an unauthorized person is strictly prohibited. Synergist Limited cannot accept responsibility for the accuracy or completeness of this communication as it is being transmitted over a public network. If you suspect this message may have been intercepted or amended, please inform Synergist Limited.