Jump to content

Correct usage of Image class


StOneDOes
 Share

Recommended Posts

Hi guys,

Trying to get your take on the correct usage of the Image class. I'm trying to change the image of a widget using SetImage(). It seems that the documentation is incomplete, missing the Image class (unless I've missed it :S). Through trying to use this class, I've noticed that Image::Load() has been commented out in Window.win32.h (perhaps it was not finished?).

I instead tried something like:

wstring str = L"Materials/GUI/button1.tex";

Image *image = new Image();
image->Initialize( str );

Which exited my program after attempting a run, not sure why. 

Log:

Quote

The thread 0x2600 has exited with code 1 (0x1).
The thread 0x12e0 has exited with code 1 (0x1).
The thread 0x14e8 has exited with code 1 (0x1).
The thread 0x3030 has exited with code 1 (0x1).
The thread 0x382c has exited with code 1 (0x1).
The thread 0x2574 has exited with code 1 (0x1).
The thread 0x28e4 has exited with code 1 (0x1).
The thread 0x2120 has exited with code 1 (0x1).
The thread 0x53ac has exited with code 1 (0x1).
The thread 0xe58 has exited with code 1 (0x1).
The thread 0x3f0c has exited with code 1 (0x1).
Detected memory leaks!
Dumping objects ->
{122} normal block at 0x0D3BA260, 16384 bytes long.
 Data: <cccccccccccccccc> 63 63 63 63 63 63 63 63 63 63 63 63 63 63 63 63 
{120} normal block at 0x0D3B6230, 16384 bytes long.
 Data: <cccccccccccccccc> 63 63 63 63 63 63 63 63 63 63 63 63 63 63 63 63 
{119} normal block at 0x0D3E8890, 16384 bytes long.
 Data: <cccccccccccccccc> 63 63 63 63 63 63 63 63 63 63 63 63 63 63 63 63 
{118} normal block at 0x0D3E4860, 16384 bytes long.
 Data: <cccccccccccccccc> 63 63 63 63 63 63 63 63 63 63 63 63 63 63 63 63 
{112} normal block at 0x0179AF20, 16384 bytes long.
 Data: <cccccccccccccccc> 63 63 63 63 63 63 63 63 63 63 63 63 63 63 63 63 
{111} normal block at 0x12121008, 16384 bytes long.
 Data: <cccccccccccccccc> 63 63 63 63 63 63 63 63 63 63 63 63 63 63 63 63 
{110} normal block at 0x0D39FBA8, 16384 bytes long.
 Data: <cccccccccccccccc> 63 63 63 63 63 63 63 63 63 63 63 63 63 63 63 63 
{109} normal block at 0x0D3DC7B0, 32896 bytes long.
 Data: <cccccccccccccccc> 63 63 63 63 63 63 63 63 63 63 63 63 63 63 63 63 
{108} normal block at 0x121282A8, 65664 bytes long.
 Data: <cccccccccccccccc> 63 63 63 63 63 63 63 63 63 63 63 63 63 63 63 63 
{107} normal block at 0x01792E70, 32896 bytes long.
 Data: <cccccccccccccccc> 63 63 63 63 63 63 63 63 63 63 63 63 63 63 63 63 
{106} normal block at 0x12118F58, 32896 bytes long.
 Data: <cccccccccccccccc> 63 63 63 63 63 63 63 63 63 63 63 63 63 63 63 63 
{105} normal block at 0x0D397AF8, 32896 bytes long.
 Data: <cccccccccccccccc> 63 63 63 63 63 63 63 63 63 63 63 63 63 63 63 63 
{104} normal block at 0x12140928, 98368 bytes long.
 Data: <cccccccccccccccc> 63 63 63 63 63 63 63 63 63 63 63 63 63 63 63 63 
{98} normal block at 0x017A35A8, 8 bytes long.
 Data: < [z     > 04 5B 7A 01 8B 84 9D 01 
{92} normal block at 0x017A37A0, 8 bytes long.
 Data: < Zz     > 10 5A 7A 01 8B 84 9D 01 
{91} normal block at 0x017A5968, 2688 bytes long.
 Data: <cccccccccccccccc> 63 63 63 63 63 63 63 63 63 63 63 63 63 63 63 63 
{89} normal block at 0x017B9FC8, 336 bytes long.
 Data: <cccccccccccccccc> 63 63 63 63 63 63 63 63 63 63 63 63 63 63 63 63 
Object dump complete.

 

Link to comment
Share on other sites

This is not yet officially supported, but you want to use the GUI image commands.  A GUI may be created on a window (which you guys don't need, but I do to make the Leadwerks 5 editor) or on a context.  Depending on which is used, the image class will either use textures or OS commands to produce the same results.

  • Upvote 1

My job is to make tools you love, with the features you want, and performance you can't live without.

Link to comment
Share on other sites

11 hours ago, Josh said:

This is not yet officially supported, but you want to use the GUI image commands.  A GUI may be created on a window (which you guys don't need, but I do to make the Leadwerks 5 editor) or on a context.  Depending on which is used, the image class will either use textures or OS commands to produce the same results.

Okay thank you for the heads up.  Also your suggestion works fine:

Image *image = gui->LoadImageA( "Materials/GUI/button1.tex" );
widget->SetImage( image );
widget->Redraw();

The only issue I've run into now is that Leadwerks is automatically resizing my button image into multiples of 64. I also can't find a way to rescale the image. Is there a way around this?

Link to comment
Share on other sites

On 10/25/2017 at 5:46 PM, St0nedas said:

Okay thank you for the heads up.  Also your suggestion works fine:


Image *image = gui->LoadImageA( "Materials/GUI/button1.tex" );
widget->SetImage( image );
widget->Redraw();

The only issue I've run into now is that Leadwerks is automatically resizing my button image into multiples of 64. I also can't find a way to rescale the image. Is there a way around this?

In the editor, disable the mipmaps generation on that texture.

  • Upvote 1

My job is to make tools you love, with the features you want, and performance you can't live without.

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

 Share

×
×
  • Create New...