Picture fields
Steve Finger
steve at srptech.com
Fri Apr 24 22:45:19 EDT 2009
Hi Kelly,
Thanks,
I'll try this out.
Steve
Kelly Burgess wrote:
> Hi Steve,
>
> I do image scaling in the $print method of a positioning section that
> decides whether or not to include the picture field in that section. My
> picture field is about an inch and a half wide, half an inch tall, and I
> want it to max out at 4x4 inches, so anything bigger than 4 inches will
> be scaled, otherwise not. $noscale is kTrue, $keepaspectratio is false,
> $horz/$vertdpi are 0... So I do this...
>
>
> Do pictconvto(pictformat(fImage.IM_IMAGE),fImage.IM_IMAGE,'CS24')
> Returns picture
> Do pictsize(picture,pictWidth,pictHeight) Returns return
> If return&pictWidth<>0
> If (pictWidth/72>4.0)|(pictHeight/72>4.0)
> ; scale pictures larger than 4 inches wide or high...
> Calculate $cinst.$objs.recipeImage.$noscale as kFalse
> If pictWidth>pictHeight
> Calculate newWidth as 4.0
> Calculate newHeight as 4.0*(pictHeight/pictWidth)
> Else
> Calculate newHeight as 4.0
> Calculate newWidth as 4.0*(pictWidth/pictHeight)
> End If
> ; scaling on, set exact height and width of picture field
> Calculate $cinst.$objs.recipeImage.$height as newHeight
> Calculate $cinst.$objs.recipeImage.$width as newWidth
> Else
> ; no scaling, actual image width used regardless of what the field
> size is
> Calculate newWidth as pictWidth
> End If
> Calculate $cinst.$objs.recipeImage.$left as (7.75-newWidth)/2 ;;
> center on page
> Do default
> End If
>
> 'picture' is an instance variable, used as the $dataname of the picture
> field in the section.
>
> So I let the picture org at top/left, and rather than try to center it
> within the field I just control the left coordinate to get the whole
> thing centered on the page.
>
> Kelly
> _____________________________________________________________
> Manage your list subscriptions at http://lists.omnis-dev.com
More information about the omnisdev-en
mailing list