WVT_DrawPicture() - proportional picture and correct size

261 views
Skip to first unread message

Sergy

unread,
Jan 1, 2016, 12:55:56 PM1/1/16
to Harbour Users
Hello friends.

I need to demonstrate goods samples in app window. I call WVT_DrawPicture(1,1,MAXROW(),40,cFileName, ,.T.)

When my picture has "landscape" proportions - user can see normal image:


But, when the picture has "portrait" proportions - user can see only part of it:



I would like to use all possible app window area to show picture with right scale and full size.

Which parameters I should pass to DrawImage() do achieve this ?

Why WVT_DrawImage() ignores 3rd parameter (nRowMax) and stretches image too high ?


Thank you.


Pritpal Bedi

unread,
Jan 2, 2016, 11:20:30 AM1/2/16
to Harbour Users
Hi

This function has following parameters:

Wvt_DrawPicture( nTop, nLeft, nBottom, nRight, nSlot, aPxlOff, lDoNotScale ) -> lOk

Which library you are using to call your function? 
WVT_DrawPicture(1,1,MAXROW(),40,cFileName, ,.T.)
From where parameter <cFileName> is substituted for <nSlot> ?


Pritpal Bedi
a student of software analysis & concepts

Sergy

unread,
Jan 2, 2016, 3:48:17 PM1/2/16
to Harbour Users
Hi Pritpal

Sorry for my typo - I use Wvt_DrawImage(), not Wvt_DrawPicture(). 

My pictures stored in separate *.jpg files and I need to show those files.


Pritpal Bedi

unread,
Jan 2, 2016, 11:51:57 PM1/2/16
to Harbour Users
Hi

Can you send me a compilable code with the images which is ready for testing ?
I do not have much time but I think I know where is the issue.

Sergy

unread,
Jan 3, 2016, 4:55:59 AM1/3/16
to Harbour Users
Hi Pritpal


There are prg, hbp, exe and two jpg files - portrait and landscape.

Thank you.

Pritpal Bedi

unread,
Jan 3, 2016, 12:36:49 PM1/3/16
to Harbour Users
Hi Sergy



Thanks for the code.
Please test after this commit and report back.
2016-01-03 09:24 UTC-0800 Pritpal Bedi (bedipritpal/at/hotmail.com)

Qatan

unread,
Jan 3, 2016, 2:12:23 PM1/3/16
to harbou...@googlegroups.com
Hello Pritpal,
 
I tested it but I notice that the image disappears when I change the windows size (using the mouse).
Is it expected or is there any configuration to avoid that?
Thanks
 
Qatan
 

Pritpal Bedi

unread,
Jan 3, 2016, 2:33:38 PM1/3/16
to Harbour Users
Hi Qatan


I tested it but I notice that the image disappears when I change the windows size (using the mouse).
Is it expected or is there any configuration to avoid that?


To avoid that you have two options:

1. Follow the protocol adopted in gtwvg/tests/demowvg.*prg.
2. Use Wvg_Image() which has persistence but it also needs some more tweaks. 
    Look for example in C:\harbour\contrib\gtwvg\tests\_cuigdlg.prg. It is easy to implement.


Images are not embedded in any of the GT's as is. You need some mechanism to impose them 
on top of the GT whenever Windows issues a repaint request.

Qatan

unread,
Jan 4, 2016, 3:54:37 AM1/4/16
to harbou...@googlegroups.com
Hello Pritpal,
 
*1. Follow the protocol adopted in gtwvg/tests/demowvg.*prg.
*2. Use Wvg_Image() which has persistence but it also needs some more tweaks.
*    Look for example in C:\harbour\contrib\gtwvg\tests\_cuigdlg.prg. It is easy to implement.
*
*Images are not embedded in any of the GT's as is. You need some mechanism to impose them
*on top of the GT whenever Windows issues a repaint request.
 
 
Thanks you for answering.
I will look into it.
 
Regards,
 
Qatan
 

Sergy

unread,
Jan 4, 2016, 9:57:22 AM1/4/16
to Harbour Users
Hi Pritpal

Thank you for support.
But "my kung-fu isn't good enough" - I use "nightly builds" from here: http://sourceforge.net/projects/harbour-project/files/binaries-windows/nightly/

Just look at fresh harbour-nightly-win.7z - archive has changelog.txt with date 2016-01-02. But - the last commit is:

/*
 * $Id: cc052b94d695e20623b4f41ff1a4e6f4a7aabbf3 $
 */

/* Read doc/howtorep.txt and use this format for entry headers:
   YYYY-MM-DD HH:MM UTC[-|+]hhmm Your Full Name (your_email address)
   2013-12-31 13:59 UTC+0100 Foo Bar (foo.bar foobar.org)
   See copyright/license at the end of the file.
   Encoding: UTF-8 (No BOM)  Notation (in 5th position):
     * Change, ! Fix, % Optimization, + Addition, - Removal, ; Comment
 */

2015-12-05 10:58 UTC+0100 Przemyslaw Czerpak (druzus/at/poczta.onet.pl)
  + tests/getblock.prg
    + added test code for GET SetGet block for aliased macro variables

2015-12-05 10:05 UTC+0100 Przemyslaw Czerpak (druzus/at/poczta.onet.pl)
  * src/rtl/gtos2/gtos2.c
    ! fixed GCC builds - many thanks to David Macias
...

last month ago ???

Is it correct?

May be I do something wrong ?

WBR, Sergy.

воскресенье, 3 января 2016 г., 20:36:49 UTC+3 пользователь Pritpal Bedi написал:
Message has been deleted

Sergy

unread,
Jan 7, 2016, 7:14:52 AM1/7/16
to Harbour Users
Hi Pritpal

Sorry for delaying in answer - I sorted out with "nightly" and "daily" builds - from time I downloaded Harbour 3.2 (ver ~20150615) some stuff was changed and ready-to=use "nightly builds" doesn't updated since 2015-12-05.

In common - when I use WVT_DrawImage(1,1,MAXROW(),40,cFileName,,.T.) - seems be ok.
But then I changed parameters to (1,1,MAXROW()-1,MAXCOL()-1,cFileName,,.T.) - as I planned before to use all app screen area.
The "portrait" and "square" pictures looking good, but "landscape" - not:


I updated by old link - prg, exe and add some pics to demonstrate this behavior. 

Thank you for support.
Sergy.

воскресенье, 3 января 2016 г., 20:36:49 UTC+3 пользователь Pritpal Bedi написал:
Hi Sergy

Pritpal Bedi

unread,
Jan 7, 2016, 3:26:09 PM1/7/16
to Harbour Users
Thanks Sergy

I hope now it is fixed properly.

2016-01-07 12:16 UTC-0800 Pritpal Bedi (bedipritpal/at/hotmail.com)

Sergy

unread,
Jan 8, 2016, 10:51:29 AM1/8/16
to Harbour Users
Thank you, Pritpal.

Now WVT_DrawImage() works perfect.

WBR,
Sergy

четверг, 7 января 2016 г., 23:26:09 UTC+3 пользователь Pritpal Bedi написал:
Reply all
Reply to author
Forward
0 new messages