Graal Forums

Graal Forums (https://forums.graalonline.com/forums/index.php)
-   NPC Scripting (https://forums.graalonline.com/forums/forumdisplay.php?f=8)
-   -   Showimg img width & height (https://forums.graalonline.com/forums/showthread.php?t=72770)

godofwarares 03-12-2007 01:21 AM

Showimg img width & height
 
How do I show an image with showimg with the specified image width and height?

Is there a way to do this?

JkWhoSaysNi 03-12-2007 02:01 AM

You can use stretchx and stretchy to stretch the image.

To work out the size of the stretched image its easy:

image width * stretchx = displayed image width.

The other way around is fairly simple. Just:

stretchx = desired width / actual width

Googi 03-12-2007 02:05 AM

You can't do it with showimg but you should be able to with drawimagestretched.

Angel_Light 03-12-2007 02:41 AM

image.width & image.height

Rapidwolve 03-12-2007 04:35 AM

Quote:

Originally Posted by Angel_Light (Post 1287679)
image.width & image.height

Orly? Well I guess thats less on the hands then getimgwidth() or getimgheight()

godofwarares 03-12-2007 12:40 PM

Quote:

Originally Posted by Googi (Post 1287663)
You can't do it with showimg but you should be able to with drawimagestretched.

Thats for a GuiDrawingPanel.

Quote:

Originally Posted by Angel_Light (Post 1287679)
image.width & image.height

I'll try that later.

Angel_Light 03-12-2007 02:14 PM

if it's not that that it's imgheight and imgwidth

Crow 03-12-2007 03:17 PM

Quote:

Originally Posted by Angel_Light (Post 1287788)
if it's not that that it's imgheight and imgwidth

Wont really work, would have to be imgwidth(image) and imgheight(image), and thats gs1 afaik.

JkWhoSaysNi 03-12-2007 04:00 PM

in gs2 it's getimgwidth("name.png"); and you can't set the width with it.

as i said you can just use

PHP Code:

with(showimg(200,"image.png",x,y)) {
stretchx 300/getimgwidth("image.png");


Will make the image 300px wide on screen.

n.b. the only issue with this is that X and Y of the showimg will not be in the top left corner of the image any more.

Admins 03-12-2007 04:12 PM

Yes you currently need to use stretchx and stretchy to change the size. To correct the position of the image you need to do then:

PHP Code:

+= (1-zoom*stretchx)/2*getimgwidth(image);
+= (1-zoom*stretchy)/2*getimgheight(image); 

Another way is to use a polygon with an image:
PHP Code:

polygon = {x,yx+mywidth,yx+mywidth,y+myheightx,y+myheight};
image "yourimage.png"

Replace mywidth and myheight with the preferred size. This will only work if you display a full image (not using partx etc.)

The simpliest way would be to use a GuiBitmapCtrl, I am not sure where you want to display it though.

zokemon 03-12-2007 09:30 PM

Couldn't you just do new TDrawingPanel? :)

godofwarares 03-13-2007 11:05 PM

Details, Details Zokemon. I'll try various things and we'll see what works best.


All times are GMT +2. The time now is 09:37 AM.

Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2026, vBulletin Solutions Inc.
Copyright (C) 1998-2019 Toonslab All Rights Reserved.