| 12-08-2009, 07:40 AM | #1 |
Hey. I haven't done that much with images for know. I tried to use a simple ReplaceableTextures\CommandButtons\BTN$anything$.blp image from blizzard and to display it in 64px size. I know that I have to use SetImageRenderAlways, but then the image is ugly, while 1/4 of it is only the image itself and 3/4 of it ugly rendering borders. Image Creation Code: JASS:
public static method create takes player p, string s, real size, real posX, real posY, real posZ, integer imageType returns thistype
local thistype this = thistype.allocate()
local string path = ""
if GetLocalPlayer() == p then
set path = s
else
set path = ""
endif
set .Handle = CreateImage(path, size, size, size, posX, posY, posZ, 0, 0, 0, imageType)
set .PosX = posX
set .PosY = posY
set .PosZ = posZ
set .Type = imageType
set .Owner = p
set .Path = s
call SetImageRenderAlways(.Handle, true)
return this
endmethod
// Another struct
public method createImage takes player p, string s, real size, real posX, real posY, real posZ, integer imageType returns Image
local Image i = Image.create(p, s, size, posX, posY, posZ, imageType)
//: Save the image
set .ImageTable[GetHandleId(i.getHandle())] = integer(i)
return i
endmethod
// Just Another struct that extends Another struct
public method initImages takes nothing returns nothing
local integer i = 0
loop
exitwhen i >= 15
set SwitchImages[i] = .createImage(Player(i), "ReplaceableTextures\\Splats\\AuraRune9b.blp", 64., 128., 0., 0., 3)
set SwitchStates[i] = true
set i = i + 1
endloop
endmethod
Testmap: CW.v.1.02.w3x |
| 12-08-2009, 08:11 AM | #2 |
Ive had this problem too, and I think it was caused by having not fully alphaed borders in that image file. edit. Also, you should probably do it like this, in case you wanna change that images visibility for some players or something. JASS:local thistype this = thistype.allocate() set .Handle = CreateImage(s, size, size, size, posX, posY, posZ, 0, 0, 0, imageType) set .PosX = posX set .PosY = posY set .PosZ = posZ set .Type = imageType set .Owner = p set .Path = s call SetImageRenderAlways(.Handle, true) call ShowImage(.Handle,GetLocalPlayer() == p) return this |
| 12-08-2009, 08:18 AM | #3 |
So blizzards default images do not have an alpha channel? Btw thanks for the hint, it would be a bad bug. On testmap: If you click on the trackable you hide / display the image. |
