Board index » cppbuilder » Zoom, W95 GDI, BCB-1, TImage

Zoom, W95 GDI, BCB-1, TImage

I have a TImage on a form. I use TImage->Canvas->MoveTo, & LineTo etc to
draw vector based images on it. I want to zoom in on parts of these images.
I have done this successfully by multiplying my data by the zoom factor and
redrawing it. This is fine but W95 limits the largest draw values to -323768
to 32767 (yep..16 bit).

I have been hunting thru the WIN32SDK help looking for some from of
translation and have come across a group of functions which I am unable to
get any sense from.
They are SetMapMode, SetWindowExtEx, SetViewportExtEx, ScaleWindowExtEx,
ScaleViewportExtEx etc. All to do with Page space to Device space
transformations. The documentation is very sketchy. I have made some
attempts to get them to work but to no avail. I am using
TImage->Canvas->Handle as the HDC for the calls, I assume this is right as
it works for such GDI functions as PolyBezier etc.

My questions are as follows:-
1. Am I on the right track. I have looked at SetWorldTransform etc, but this
group of functions don't apply to W95, only NT.

2. Does anyone have an example of what I am trying to achieve, please do not
suggest plotting the lines from where they intersect the TImage boundaries
as I am using PolyBezier and this is difficult math?

3. Is it possible to achieve a zoom affect by using tis group of functions
with TImage ?

4. Is my HDC correct ?

Thanks in anticipation
Mark Aspland
mapsl...@melbpc.org.au

 

Re:Zoom, W95 GDI, BCB-1, TImage


Quote
Mark Aspland wrote:

> I have a TImage on a form. I use TImage->Canvas->MoveTo, & LineTo etc to
> draw vector based images on it. I want to zoom in on parts of these images.
> I have done this successfully by multiplying my data by the zoom factor and
> redrawing it. This is fine but W95 limits the largest draw values to -323768
> to 32767 (yep..16 bit).

Look, I may be way off beam here, but I use a VERY simple techinque to
pan and zoom bitmaps (and metafiles) just by putting the TImage down on
top of a scrollbox, set the TImage->Stretch to true, and then molest the
scroll box's HorzScrollBar->Range and VertScrollBar->Range values to
give the desired zooming...whilst setting the ->Position value fixes the
pan.

Just a thought !

Re:Zoom, W95 GDI, BCB-1, TImage


Colin,

An interesting suggestion. I suspect however this will magnify on a bitmap
(raster) basis. What I was after, and think have found, is a means to do
this on a vector basis, (refer same posting VCL group) .
Thankyou muchly for you thought

Mark

Quote
Colin Attwell wrote in message <35C0DDE1.7CDBD265@spamboozle_new.co.za>...
>Mark Aspland wrote:

>> I have a TImage on a form. I use TImage->Canvas->MoveTo, & LineTo etc to
>> draw vector based images on it. I want to zoom in on parts of these
images.
>> I have done this successfully by multiplying my data by the zoom factor
and
>> redrawing it. This is fine but W95 limits the largest draw values
to -323768
>> to 32767 (yep..16 bit).

>Look, I may be way off beam here, but I use a VERY simple techinque to
>pan and zoom bitmaps (and metafiles) just by putting the TImage down on
>top of a scrollbox, set the TImage->Stretch to true, and then molest the
>scroll box's HorzScrollBar->Range and VertScrollBar->Range values to
>give the desired zooming...whilst setting the ->Position value fixes the
>pan.

>Just a thought !

Re:Zoom, W95 GDI, BCB-1, TImage


Quote
"Mark Aspland" <mapsl...@melbpc.org.au> wrote:

>  I have a TImage on a form. I use TImage->Canvas->MoveTo, & LineTo etc to
>  draw vector based images on it. I want to zoom in on parts of these images.
>  I have done this successfully by multiplying my data by the zoom factor and
>  redrawing it. This is fine but W95 limits the largest draw values to -323768
>  to 32767 (yep..16 bit).

I think I may have a similar problem. Have you thought about clipping
the lines to the viewport. This will certainly solve the problem but
would be a problem for lines that cut rhrough the viewport. I suppose
I/you/we could only clip lines that would move outside the 16-bit
range.

Robert Chafer

Re:Zoom, W95 GDI, BCB-1, TImage


Quote
Mark Aspland wrote:

> Colin,

> An interesting suggestion. I suspect however this will magnify on a bitmap
> (raster) basis. What I was after, and think have found, is a means to do
> this on a vector basis, (refer same posting VCL group) .

Mark, what you say is true, but for my apps this was all I needed.

My images consist of building plans upon which I place bitmapped icons.
If I place an icon upon a zoomed plan, the icon also is magnified by the
same factor. It is not too much of a leap in thought to conceive of
drawing lines etc on a zoomed image and having the lines magnified too.

After thinking a bit more about your problem I was wondering how the GDI
would cope with my technique when the zoom factor became large,
potentially hitting the same wall as you have experienced. I shall
conduct some tests and see what happens.

Incidently, the same technique is works very well for WMF files (which
are vector files rather than rasters).

Other Threads