Cheat Engine Forum Index Cheat Engine
The Official Site of Cheat Engine
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 


Picture class

 
Post new topic   Reply to topic    Cheat Engine Forum Index -> Cheat Engine Lua Scripting
View previous topic :: View next topic  
Author Message
DaSpamer
Grandmaster Cheater Supreme
Reputation: 52

Joined: 13 Sep 2011
Posts: 1578

PostPosted: Tue Aug 19, 2014 2:33 am    Post subject: Picture class Reply with quote

Hi,

How could I load image form stream into a bitmap object?

I can load without any problems to an image by using this
Code:
img.picture.loadFromStream(findTableFile('image.png').Stream);


Tried
Code:
bmp = createPicture();
bmp.loadFromStream(findTableFile('image.png').Stream);

img.Canvas.draw(0,0,bmp.getBitmap());

But It does not return the full size...


I want to re-use the same bitmap over and over to avoid bugs and glitches I occurred before by creating thousands objects in few minutes.

_________________
HEY Hitler
Do you get lazy when making trainers?
Well no more!
My CETrainer will generate it for you in seconds, so you won't get lazy! Very Happy

http://forum.cheatengine.org/viewtopic.php?t=564919
Back to top
View user's profile Send private message
mgr.inz.Player
I post too much
Reputation: 218

Joined: 07 Nov 2008
Posts: 4438
Location: W kraju nad Wisla. UTC+01:00

PostPosted: Tue Aug 19, 2014 11:00 am    Post subject: Reply with quote

Code:
img = createImage(nil)

fileStream = findTableFile('image.png').Stream
img.Picture.loadFromStream(fileStream)

-- other images
for i=1,6 do
  UDF1['CEImage'..i].Width = img.Picture.Bitmap.Width
  UDF1['CEImage'..i].Height = img.Picture.Bitmap.Height
  UDF1['CEImage'..i].setPicture(img.Picture)
end

UDF1.show()

img.destroy()


Of course you have to create UDF1 form with six CEImage objects.

_________________
Back to top
View user's profile Send private message MSN Messenger
DaSpamer
Grandmaster Cheater Supreme
Reputation: 52

Joined: 13 Sep 2011
Posts: 1578

PostPosted: Tue Aug 19, 2014 11:40 am    Post subject: Reply with quote

Well thanks as this get the work done.
_________________
HEY Hitler
Do you get lazy when making trainers?
Well no more!
My CETrainer will generate it for you in seconds, so you won't get lazy! Very Happy

http://forum.cheatengine.org/viewtopic.php?t=564919
Back to top
View user's profile Send private message
DaSpamer
Grandmaster Cheater Supreme
Reputation: 52

Joined: 13 Sep 2011
Posts: 1578

PostPosted: Wed Aug 20, 2014 6:46 am    Post subject: Reply with quote

Hey mgr.inz.Player,

It seems that I cannot draw on bitmap if I load image from stream.
I've made a script in my server that converts thumbs to rgb tables.
And based on the game there's a image as background.

Since the image as small background cannot change or will not be changed I want to load it from stream (better performance and faster start up).
So I load it up like this
Code:
image.picture.loadFromStream(findTableFile(bgr_objects[object_type]).Stream);


And then run a timer that checks if the native thread loaded and create a bitmap with the image and if it does it draws it on.

I draw it like this
Code:
image.picture.Bitmap.Canvas.draw(5,5,thumbs[id]);

But it does not seem to be visible, I can't draw even a text.

So is there any solution for it? or any option to load image from stream directly to a bitmap?

_________________
HEY Hitler
Do you get lazy when making trainers?
Well no more!
My CETrainer will generate it for you in seconds, so you won't get lazy! Very Happy

http://forum.cheatengine.org/viewtopic.php?t=564919
Back to top
View user's profile Send private message
Dark Byte
Site Admin
Reputation: 457

Joined: 09 May 2003
Posts: 25262
Location: The netherlands

PostPosted: Wed Aug 20, 2014 7:10 am    Post subject: Reply with quote

Try picture.PNG.canvas

or picture.canvas

_________________
Do not ask me about online cheats. I don't know any and wont help finding them.

Like my help? Join me on Patreon so i can keep helping
Back to top
View user's profile Send private message MSN Messenger
DaSpamer
Grandmaster Cheater Supreme
Reputation: 52

Joined: 13 Sep 2011
Posts: 1578

PostPosted: Wed Aug 20, 2014 8:18 am    Post subject: Reply with quote

Dark Byte wrote:
Try picture.PNG.canvas

or picture.canvas

It works as long as there is no transparency at all?
I've tried it first with the wanted image, it seems that everything I try (fill rect, text out and etc.) makes the affected area go transparent?

Attached a CT to demonstrate.
3 images
1. of the normal image
2. half transparent object (to show that the drawing on the image makes it go transparent and not a solid color)
3. the image where I load into the image from the stream and try to draw on it.


Well I'd rather to be able load an image from stream to a bitmap or directly to canvas (as it seems that I can only via the picture class).

EDIT:
Strange if I do this following:
UDF1 -> Edit

Execute the script, close the editor
UDF1-> show

It'll display it the way it is suppose to.



picture class.CT
 Description:

Download
 Filename:  picture class.CT
 Filesize:  114.02 KB
 Downloaded:  639 Time(s)


_________________
HEY Hitler
Do you get lazy when making trainers?
Well no more!
My CETrainer will generate it for you in seconds, so you won't get lazy! Very Happy

http://forum.cheatengine.org/viewtopic.php?t=564919
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    Cheat Engine Forum Index -> Cheat Engine Lua Scripting All times are GMT - 6 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You cannot attach files in this forum
You can download files in this forum


Powered by phpBB © 2001, 2005 phpBB Group

CE Wiki   IRC (#CEF)   Twitter
Third party websites