In my Display software I struggled to produce thumbnails and had all sorts of horrible bodges to convert between the two for different sizes of thumbnail when what was needed was a general purpose routine that would work without modification whatever the size of the thumbnail and wherever it was on the page. I had a Eureka moment yesterday: calculate the difference between the top of the thumbnail and the top of the screen or window and apply that to the calculations! If the "thumbnail" is full screen, that difference will be zero, of course.
Call me thick if you like - and perhaps most of you have been doing this for years - but for anyone who hasn't, here's my solution:
Code: Select all
DEFPROCdrawpage(leftx%,bottomy%,width%,height%):LOCALi%,j%,col%
scale=width%/1280:REM The scale at which the slide is drawn
texty%=bottomy%+height%-20*scale:REM The starting position for text
topx%=leftx%:topy%=bottomy%+height%:REM Coordinates for the top-left corner
topdif%=@vdu%!212-topy%:REM Difference between the top of the slide and the top of the window
by%=(@vdu%!212-topdif%-height%):REM Bottom of the page for IBM coordinates
Code: Select all
REM Draws a thick line with a style (add values for start and end):
REM Line end square 1; round &12; diamond &13; arrow &14
REM Line start square &100; round &1200; diamond &1300; arrow &1400
DEFFNline(lcol%,linestyle%,thick%,slx%,sly%,X%,Y%)
LOCALn%,m%,tmp%,pen%,r%,g%,b%
slx%=topx%+slx%*scale
sly%=by%+sly%*scale
X%=topx%+X%*scale
Y%=by%+Y%*scale
SYS"GetPaletteEntries",@hpal%,lcol%,1,^rgb%
r%=rgb%AND&FF:g%=(rgb%>>8)AND&FF:b%=(rgb%>>16)AND&FF:rgb%=b%+(g%<<8)+(r%<<16)
tmp%=FN_gdipsetdc(@memhdc%)
pen%=FN_gdipcreatepen(&FF000000+rgb%,linestyle%,thick%*scale)
PROC_gdipline(pen%,slx%,sly%,X%,Y%)
PROC_gdipdeletepen(pen%)
=0