Xojo Conferences
MBSOct2019CologneDE

RE: Image Scaling in an Image Well (Real Studio network user group Mailinglist archive)

Back to the thread list
Previous thread: Error in thread, can't quit IDE
Next thread: Window Open complete?


Re: "I feel the need for speed" (string)   -   Jan Erik Moström <
  RE: Image Scaling in an Image Well   -   Edward Cox
   Image Scaling in an Image Well   -   Christian Miller
    Re: Image Scaling in an Image Well   -   Thomas Reed
    Re: Image Scaling in an Image Well   -   Joe Huber
    Re: Image Scaling in an Image Well   -   Mars Saxman
     Re: Image Scaling in an Image Well   -   Christian Miller
   Window Open complete?   -   Jim Wagner

RE: Image Scaling in an Image Well
Date: 09.05.02 05:32 (Thu, 9 May 2002 14:32:07 +1000 )
From: Edward Cox
Oh! Oh! Me too please.

Ed Cox - PDQ Software

-----Original Message-----
From: Christian Miller [mailto:realbasic@nc.rr.com]
Sent: Thursday, May 09, 2002 2:31 PM
To: REALbasic Network Users Group
Subject: Image Scaling in an Image Well

I have some code that allows me to drag an image into an image well.
However, when the image is dragged, I would like the image scaled
(proportionally) to the size of the image well. Any ideas on how I
might be able to do this?

Image Scaling in an Image Well
Date: 09.05.02 05:30 (Thu, 9 May 2002 00:30:49 -0400)
From: Christian Miller
I have some code that allows me to drag an image into an image well.
However, when the image is dragged, I would like the image scaled
(proportionally) to the size of the image well. Any ideas on how I
might be able to do this?

Re: Image Scaling in an Image Well
Date: 09.05.02 19:36 (Thu, 9 May 2002 13:36:31 -0500)
From: Thomas Reed
>I have some code that allows me to drag an image into an image well.
>However, when the image is dragged, I would like the image scaled

You can't. Not easily, anyway. ImageWells not only are restricted to
only certain types of image (PICT only, IIRC), but they also don't do
scaling or anything else particularly useful.

Instead, overlay a Canvas on top of your ImageWell. Draw the image
directly into the Canvas with scaling. This lets you control how the
image is displayed AND have the nice-looking frame of an ImageWell. (The
frame is about the only thing an ImageWell has in its favor, IMHO.)

-Thomas

Personal web page: http://home.earthlink.net/~thomasareed/
My shareware: http://home.earthlink.net/~thomasareed/shareware/
REALbasic page: http://home.earthlink.net/~thomasareed/realbasic/
Pixel Pen web pub. guide: http://home.earthlink.net/~thomasareed/pixelpen/

Eat a live toad in the morning and nothing worse will happen to you for
the rest of the day.

---
Subscribe to the digest:
<mailto:<email address removed>>
Unsubscribe:
<mailto:<email address removed>>

Re: Image Scaling in an Image Well
Date: 09.05.02 21:44 (Thu, 9 May 2002 13:44:04 -0700)
From: Joe Huber
At 1:36 PM -0500 5/9/02, Thomas Reed wrote:
> >I have some code that allows me to drag an image into an image well.
>>However, when the image is dragged, I would like the image scaled
>
>You can't. Not easily, anyway. ImageWells not only are restricted to
>only certain types of image (PICT only, IIRC), but they also don't do
>scaling or anything else particularly useful.
>
>Instead, overlay a Canvas on top of your ImageWell. Draw the image
>directly into the Canvas with scaling. This lets you control how the
>image is displayed AND have the nice-looking frame of an ImageWell. (The
>frame is about the only thing an ImageWell has in its favor, IMHO.)

Yes, this is exactly right, and works well on Macs. One thing to be
careful of is that on Win32 the Image Well will often overwrite a
canvas that's located over it. (Bug 81043)

Hope this helps,
Joe Huber

Re: Image Scaling in an Image Well
Date: 09.05.02 05:38 (Wed, 08 May 2002 21:38:52 -0700)
From: Mars Saxman

realbasic@nc.rr.com said:

> I have some code that allows me to drag an image into an image well.
> However, when the image is dragged, I would like the image scaled
> (proportionally) to the size of the image well. Any ideas on how I
> might be able to do this?

I have an app with a canvas that does something similar. Here's its Paint
method. Watch out for line breaks!

Mars Saxman
REAL Software

----------------

Sub Paint(g As Graphics)
Dim scaleFactor As Double
Dim minorOffset As Integer
Dim minorDimension As Integer
Dim pic As Picture
pic = GetDisplayPicture
If Not ( pic <> Nil ) Then
Return
End If
If pic.Width > pic.Height Then
' Horizontally oriented picture. Width should equal our width,
' and height should be scaled proportionally.
scaleFactor = pic.Width / me.Width
minorDimension = pic.Height / scaleFactor
minorOffset = ( me.Height - minorDimension ) / 2
g.DrawPicture pic, 0, minorOffset, me.Width, minorDimension, 0, 0,
pic.Width, pic.Height
Else
' Vertically oriented picture. Height should equal our height,
' and width should be scaled proportionally.
scaleFactor = pic.Height / me.Height
minorDimension = pic.Width / scaleFactor
minorOffset = ( me.Width - minorDimension ) / 2
g.DrawPicture pic, minorOffset, 0, minorDimension, me.Height, 0, 0,
pic.Width, pic.Height
End If
End Sub

---
Subscribe to the digest:
<mailto:<email address removed>>
Unsubscribe:
<mailto:<email address removed>>

Re: Image Scaling in an Image Well
Date: 10.05.02 04:22 (Thu, 9 May 2002 23:22:11 -0400)
From: Christian Miller
Thanks. It works great, and as other's suggested, I hid the canvas
inside the bounds of the image well and use the canvas instead.


On Thursday, May 9, 2002, at 12:38 AM, Mars Saxman wrote:

> I have an app with a canvas that does something similar. Here's its
> Paint
> method. Watch out for line breaks!
>