• 🏆 Texturing Contest #33 is OPEN! Contestants must re-texture a SD unit model found in-game (Warcraft 3 Classic), recreating the unit into a peaceful NPC version. 🔗Click here to enter!
  • It's time for the first HD Modeling Contest of 2024. Join the theme discussion for Hive's HD Modeling Contest #6! Click here to post your idea!

[Solved] CreateImage size issues

Status
Not open for further replies.

Uncle

Warcraft Moderator
Level 64
Joined
Aug 10, 2018
Messages
6,543
So I'm creating a grid system for a turn based rpg and I'm running into issues with sizing some Images. The images are Arrows which will visualize the path that your unit takes when moving along the grid.

I'm already using a Grid image from this Grid System which works fine:
Lua:
    local g = CreateImage( "Gridplane.dds", 128, 128, 0, 0, 0, 0, 1, 1, 1, 1 )
    SetImagePosition( g, x, y, 0 )
    SetImageRenderAlways( g, true )

It's my own Images that are causing problems.

My ArrowStart image (as well as some other images that I left out) have the incorrect X-size:
Lua:
    local g = CreateImage( ArrowStart, 128, 128, 0, 0, 0, 0, 64, 64, 0, 1 )
    SetImagePosition( g, TileXCoord[1], TileYCoord[1], 0 )
    SetImageRenderAlways( g, true )

However, my ArrowHead image is working fine - see the "example" picture to get a better idea of what I mean:
Lua:
    local g = CreateImage( ArrowHead, 128, 128, 0, 0, 0, 0, 64, 64, 0, 1 )
    SetImagePosition( g, TileXCoord[7], TileYCoord[7], 0 )
    SetImageRenderAlways( g, true )

I attached an example picture that should help clarify things as well as the files that I'm working with. The Arrow images were all created in Photoshop with 128x128 pixel size and saved as .DDS files. The save format was DXT5 with the Alpha Channel set to Transparency.

Any ideas? I'm not really sure what I'm supposed to type in for some of the CreateImage parameters... I'm getting really weird results when messing with different values.

Also, does Z height work for Images? I can't seem to get it to work.
 

Attachments

  • example.png
    example.png
    650.2 KB · Views: 90
  • ArrowHead.dds
    16.1 KB · Views: 41
  • ArrowLong.dds
    16.1 KB · Views: 33
  • ArrowStart.dds
    16.1 KB · Views: 32
  • ArrowTurn.dds
    16.1 KB · Views: 31
Last edited:

Uncle

Warcraft Moderator
Level 64
Joined
Aug 10, 2018
Messages
6,543
So do you mean that I should "crop to selection" my image while leaving 1 pixel of emptiness around the entire thing? I'll give it a try, thanks a lot!

Edit:
Got it working using what you suggested, thanks!

And I figured out how to adjust the Z-height:
Lua:
SetImageConstantHeight(whichImage, true, height)
Wish I had found this earlier: Images in JASS - Wc3C.net
 
Last edited:
Status
Not open for further replies.
Top