• Listen to a special audio message from Bill Roper to the Hive Workshop community (Bill is a former Vice President of Blizzard Entertainment, Producer, Designer, Musician, Voice Actor) 🔗Click here to hear his message!
  • Read Evilhog's interview with Gregory Alper, the original composer of the music for WarCraft: Orcs & Humans 🔗Click here to read the full interview.

[JASS] Show Image

Status
Not open for further replies.
Level 15
Joined
Oct 18, 2008
Messages
1,591
Hey guys
I've been trying to show images via jass as you can't do it via GUI, but the thing is I managed to show an icon, but it's edge pixels got stretched to 2x more it's width/height... :( Any idea how to solve it?

JASS:
function CreateImageEx takes string imagePath, real size, real x, real y, real z, boolean showImage returns image
    local image i = CreateImage(imagePath, size, size, 0, x - (size / 2), y - (size / 2), z, 0, 0, 0, 2)
    call SetImageRenderAlways(i, true)
    call ShowImage(i, showImage)
    return i
endfunction

JASS:
function CreateImageExLoc takes string imagePath, real size, location whichLocation, real z, boolean showImage returns image
    return CreateImageEx(imagePath, size, GetLocationX(whichLocation), GetLocationY(whichLocation), z, showImage)
endfunction

  • Custom script: set udg_TempImage = CreateImageExLoc("Replaceable Textures\\Command Buttons\\BTNAvatar.blp",64,udg_TempPoint,0,true)
 
Yeah, I was just pointing him into the direction of actually creating the image so it wouldn't stretch. :D

If you want a non-leaking script, you can use something like this:
JASS:
globals
    image CreateImageEx_i
endglobals

function CreateImageEx takes string imagePath, real size, real x, real y, real z, boolean showImage returns image
    set CreateImageEx_i = CreateImage(imagePath, size, size, 0, x - (size / 2), y - (size / 2), z, 0, 0, 0, 2)
    call SetImageRenderAlways(CreateImageEx_i, true)
    call ShowImage(CreateImageEx_i, showImage)
    return CreateImageEx_i
endfunction

Or you can lookup Deaod's tutorial on wc3c.
 
Status
Not open for further replies.
Top