Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

VO28, bBrowser 3 and FabPaint for VO28

73 views
Skip to first unread message

kdmu...@eircom.net

unread,
Nov 25, 2007, 11:31:11 AM11/25/07
to
Recently code was posted which showed how to use FabPaint to display
images in a bBrowser control, creating thumbnail files. This works
fine for me in Visual Objects 2.7 with FabPaint for VO 2.7 and
bBrowser 3.

I have downloaded the new version of FabPaint (for VO 28) from
Fabrices web site but it does not seem to work the same way as thw
previous version. I have imported the AEF which displays the bBrowser
window and calls the GetImage method to display the image in the
browser. What I get is as follows:

- First image displays ok
- Second image is flipped upside down and displayed partly behind
first image

- ResizeBilinear does not seem to resize image. An image of 128 pixels
does not seem to be scaled to fit a 100 pixel wide column.

- SaveAsJPEG does not save SaveAsTiff does work.

Has anyone else come across this? Is the problem with bBrowser or
FabPaint?

Any help would be appreciated. The methods for setting up the browser
and getting the image are shown below.

Thanks in advance.

Kevin

METHOD SetupBrowser() CLASS winImageWindow
//
// Setup browser
//
LOCAL oColumn AS bDataColumn

SELF:oDCbrwBrowser:Use( SELF:oServer, {'Name'} )

// Set up virtual column
oColumn := bDataColumn{ SELF:oDCbrwBrowser,; // owner
SELF:oServer,; // Server
{|Server, arg| arg:GetImage(Server)},; // Expression
#Expression,; // symFieldMode
SELF} // argument --> Self:GetImage()

oColumn:Caption := "Photo"
oColumn:HyperLabel := HyperLabel{#PHOTO}
oColumn:ValType := "O"
oColumn:Alignment := BALIGN_CENTER
oColumn:Width := 100 // 100 pixels width
oColumn:Resizable := FALSE

SELF:oDCbrwBrowser:AddColumn( oColumn )
SELF:oDCbrwBrowser:OpenColumn( oColumn, 1 ) // make it first column
SELF:oDCbrwBrowser:RowHeight := 100
SELF:oDCbrwBrowser:Recalculate()
SELF:oDCbrwBrowser:Refresh()

RETURN NIL

METHOD GetImage( oServer ) CLASS winImageWindow
//
// Create thumbnail fr viewing
//
LOCAL oFabImage AS FabPaintLib
LOCAL cFileName AS STRING
LOCAL cThumbNailName AS STRING
LOCAL nHeight, nWidth, nNewHeight, nNewWidth AS LONG
LOCAL nMaxDim, r8Scalefactor AS REAL8
// compose thumbnail (has to be prefixed uniquely, so that other
// bBrowsers can also show images without confusing with these
thumbnails
cThumbNailName := self:cThumbDir + "PW" + NTrim(oServer:RECNO) +
'.tiff'

IF File(cThumbNailName)
// if exists it then use it
oFabImage := FabPaintLib{cThumbNailName, SELF}

ELSE
// thumbnail does not exist so create it
cFileName := AllTrim( oServer:PictPath) // Folder for images
oFabImage := FabPaintLib{ cFileName, SELF }

IF oFabImage:IsValid
nHeight := oFabImage:Height
nWidth := oFabImage:Width
nMaxDim := Max(nHeight, nWidth) // determine biggest dimension
// determine scale factor based onm size 100 pixels
r8Scalefactor := 100/nMaxDim

nNewHeight := Integer( Round( nHeight * r8Scalefactor, 0))
nNewWidth := Integer( Round( nWidth * r8Scalefactor, 0))

oFabImage:ResizeBilinear( nNewWidth, nNewHeight) // transform to
32bpp
oFabImage:SaveAsTIFF( cThumbNailName )

ENDIF
ENDIF

RETURN oFabImage

fabric...@gmail.com

unread,
Nov 25, 2007, 12:06:13 PM11/25/07
to
Hi,
wow ! it seems there is something broken with FabPaint !?
Ok, I'll take a look at this this evening and keep you informed about
what I can do : ResizeBilinear, SaveAsJPEG

Regards,
Fabrice.

fabric...@gmail.com

unread,
Nov 25, 2007, 1:08:37 PM11/25/07
to
On 25 nov, 18:06, "nos...@fabtoys.net" <fabrice.fo...@gmail.com>
wrote:

Hi,
a first quick and dirty application does the following :
ResizeBilinear works ok
SaveAsJPEG : open an image then save is ok
SaveAsJPEG : open an image, Resize then save does nothing !

Now about the upside down problem, this might be a coordinate system
problem, I will take a look at my code to see if I can do
something...not completly sure...but, will see.

Regards,
Fabrice

fabric...@gmail.com

unread,
Nov 25, 2007, 4:24:06 PM11/25/07
to
Kevin,
I've just uploaded to my homepage a new DLL V3.0.1.0 which is
correcting the SaveAsJPEG bug....sorry...my fault... :-(

Keep me informed if you still have troubles with Resize.

Cheers,
Fabrice.

kdmu...@eircom.net

unread,
Nov 26, 2007, 3:47:20 AM11/26/07
to
Fabrice,

I'm not at that machine at the moment but will give it a try when I
can and will let you know.

Thanks for the quick response.

Kevin

On Nov 25, 9:24 pm, "nos...@fabtoys.net" <fabrice.fo...@gmail.com>
wrote:

kdmu...@eircom.net

unread,
Nov 26, 2007, 1:23:38 PM11/26/07
to
Fabrice,

The image file is now created as a JPEG file. The first image also
displays within the column width.

However, the next image is still displayed upside down and partly
under the first. It also appears 'streched' when you can see it.

Kevin

On Nov 25, 9:24 pm, "nos...@fabtoys.net" <fabrice.fo...@gmail.com>
wrote:

fabric...@gmail.com

unread,
Nov 26, 2007, 2:53:38 PM11/26/07
to
Ok,
I don't have bBrowser, even if I admit this can be a miss ;-) so I
can't test code but...
Can you make a screen copy and mail it so I can see the problem.
Also, I suppose you are using a kind of OwnerDraw method for bBrowser
can you show/send me the corresponding code ?

TIA,
Fabrice

Paul D B

unread,
Nov 27, 2007, 3:10:37 AM11/27/07
to
kdmu...@eircom.net wrote:
> Recently code was posted which showed how to use FabPaint to display
> images in a bBrowser control, creating thumbnail files. This works
> fine for me in Visual Objects 2.7 with FabPaint for VO 2.7 and
> bBrowser 3.
>

>
Hi Kevin,

the code was mine (with some help of Joachim) and unfortunately I can
only confirm your findings: I've just tested with the new Fabpaint and I
have the same problem.

I've quickly debugged and the problem is the oFabimage:Isvalid which
returns False (which in its turn, seems to be because
oFabImage:CreateFromFile() is not working and not returning a valid
pointer.
I don't have time today so I will debug some more tomorrow.

PS: I've also downloaded Fabrice's demo and there I also notice some
problems. E.g. you open a big image, then you zoom it smaller. You will
then get a smaller image (all OK) but the background of the image
control stays filled with the old one (not OK).

Another problem that I see is that the support for PSD (Photoshop)
images is missing?

bye

--
Paul

Paul D B

unread,
Nov 27, 2007, 3:49:44 AM11/27/07
to
Paul D B wrote:

>
> I've quickly debugged and the problem is the oFabimage:Isvalid which
> returns False (which in its turn, seems to be because
> oFabImage:CreateFromFile() is not working and not returning a valid
> pointer.


sorry... too hasty in my conclusion... the CreateFromFile() is not the
problem

will see tomorrow

--
Paul

Paul D B

unread,
Nov 27, 2007, 4:10:44 AM11/27/07
to

Fabpaint does create the thumbnails OK on disk. Just checked. Al there
in in the correct size and rotation.
So the problem must reside in the drawing in the bBrowser.
This method did not change and always worked.
Maybe Fabrice can tell us if the ShowExDC() is behaving differently than
before?
(And now I'm leaving in a hurry, have to be in Rotterdam in 1 hour <g>)

METHOD DrawValue(oEvent) CLASS DetPag4Win

// tekent het binnengekregen FabPaintlib object in de browser ( zie ook
de GetImage methode)

LOCAL uValue AS USUAL

LOCAL srcArea AS _winRect

LOCAL oFabImage AS FabPaintLib

uValue := oEvent:Value

IF IsInstanceOfUsual(uValue, #FabPaintlib)

oFabImage := uValue

srcArea := oEvent:Area

oFabImage:ShowExDC( oEvent:DeviceContext,;

srcArea.Left,;

srcArea.Top)

ENDIF

RETURN TRUE


--
Paul

kdmu...@eircom.net

unread,
Nov 27, 2007, 4:11:21 AM11/27/07
to
Fabrice,

I will set one up and send it to you later, when I am back at the
machine I am testing it on. Will I send it to this address or another
one?

If I can do it in time I will rig up a program ot use runtime that
uses bBrowser so you can test it.

Kevin

On Nov 26, 7:53 pm, "nos...@fabtoys.net" <fabrice.fo...@gmail.com>
wrote:

kdmu...@eircom.net

unread,
Nov 27, 2007, 4:19:31 AM11/27/07
to
Paul,

I had forgotten whose code it was nnd it works well in V)27. Well done
for that.

When I used it in VO28 I did not know where the issue was. There was
no apparent changes neexded after recompiling it. I did not know if I
had missed omething in bBrowser 3 or in the new FabPaint.

Did you download the new version of the DLL Fabrice posted (3.0.1)? It
fixes the SaveAsjpeg issue as identified by Fabrice. Have to check to
be certain but I think the same resizing issue may be in the
SaveAstiff, I will check that later.

Thanks for the initial code.

Kevin

On Nov 27, 8:10 am, "Paul D B" <poll...@NOMORESPAMhnt.be> wrote:

kdmu...@eircom.net

unread,
Nov 27, 2007, 1:05:47 PM11/27/07
to
Fabrice,

The method you requested is below.
I have sene the image to the address with the subject Fabrice Image.

Kevin

On Nov 26, 7:53 pm, "nos...@fabtoys.net" <fabrice.fo...@gmail.com>
wrote:

Paul D B

unread,
Nov 28, 2007, 2:52:13 AM11/28/07
to
kdmu...@eircom.net wrote:
> Paul,

>
> Did you download the new version of the DLL Fabrice posted (3.0.1)? It
> fixes the SaveAsjpeg issue as identified by Fabrice. Have to check to
> be certain but I think the same resizing issue may be in the
> SaveAstiff, I will check that later.
>
> Thanks for the initial code.
>
> Kevin
>
Kevin,

Yes I have made the test with the new DLL. As I said the error is not in
the way Fabpaint creates the images.
As you will know my code creates thumbnail images in a temp folder, and
that are the ones that will be shown in the bBrowser. Open that folder
while the application is running and you will see that they are all
there, correctly downsized and so on.
The problem is in the drawing in the bBrowser. I've posted that code, it
is very short and has not changed. But it uses a method from Fabrice
(oFabImage:ShowExDC) and so something must have changed there.

--
Paul

fabric...@gmail.com

unread,
Nov 28, 2007, 4:11:26 AM11/28/07
to
On 28 nov, 08:52, "Paul D B" <poll...@NOMORESPAMhnt.be> wrote:

Hi Paul,
yes this one, at least ;-), has changed 'cause I'm now using FreeImae
as underlying lib and no more PaintLib, so....
I will take a deeper look at it, when my OutlookBar gives me some
times.... <vbg>....no, no, just kidding !
I hope to send you a 2003-style soon

Cheers,
Fabrice.

Paul D B

unread,
Nov 28, 2007, 5:52:30 AM11/28/07
to

Great Fabrice, I'm sure you will come up with something nice.

thanks a lot

--
Paul

kdmu...@eircom.net

unread,
Nov 28, 2007, 1:02:48 PM11/28/07
to
Paul,

I had got the impression, wrongly as it happened, that you may not
have picked up the new DLL and this is why I asked. Indeed I hadm
noticesd the thumbs were created in the foldwr with the new DLL.
Apologies if my post had been misunderstood.

Favrice, thanks for the good work on thia and your other utilities.

Kevin

On Nov 28, 7:52 am, "Paul D B" <poll...@NOMORESPAMhnt.be> wrote:

fabric...@gmail.com

unread,
Nov 29, 2007, 5:24:07 PM11/29/07
to
Kevin,
the trouble seems to comes from the ShowEx method.
In the V2.0 FabPaint, I was using the DrawDib functions which are
using the MM_TEXT mapmode ( origins are upper/left )
In the V3.0, I'm using the strechtDIBlt function which depends on the
current mapmode !
I will try to build a new version tomorrow afternoon, but in the mean
time you may try to modify the ShowEx method in VO code.
Just before the DIBShowEx call add a SetMapMode call, like :

local oldmm as long


oldmm := SetMapMode( hDC, MM_TEXT )
DIBShowEx( hDC, ..... )
SetMapMode( hDC, oldmm )

HTH,
Fabrice

kdmu...@eircom.net

unread,
Nov 30, 2007, 12:39:36 PM11/30/07
to
Fabrice,

Just to let you know the suggestion did not work. I had to change hDC
to self:pDIBObject.

Kevin

On Nov 29, 10:24 pm, "nos...@fabtoys.net" <fabrice.fo...@gmail.com>
wrote:

fabric...@gmail.com

unread,
Nov 30, 2007, 1:04:05 PM11/30/07
to
On 30 nov, 18:39, kdmur...@eircom.net wrote:
> Fabrice,
>
> Just to let you know the suggestion did not work. I had to change hDC
> to self:pDIBObject.
>
Ooops ! Sorry, I didn't have my code under hands when writing.
Ok, I will reimplant the DrawDibDraw function.
May I mail you direclty to the address you are using in the
newsgroup ?

Regards,
Fabrice.

kdmu...@eircom.net

unread,
Nov 30, 2007, 2:06:28 PM11/30/07
to
Yes you can mail me directly. I will test and reply as fast as I can.
I have a busy weekend ahead of me so it may be Monday. I will do my
best to reply faster thougn.

Kevin

On Nov 30, 6:04 pm, "nos...@fabtoys.net" <fabrice.fo...@gmail.com>
wrote:

0 new messages