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 


Load Image From ImageList

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

Joined: 10 Apr 2015
Posts: 1668

PostPosted: Wed Sep 21, 2022 11:07 pm    Post subject: Load Image From ImageList Reply with quote

As Subject. How ?

Code:
Image1.Picture = ImageList1[index].Bitmap ??


in Lazarus :
Code:
ImageList1.GetBitmap(index of imageList, Image1.Bitmap)


How in CE Lua?

_________________
Stealing Code From Stolen Code...
And Admit It.. Hmmm....Typically LOL
Back to top
View user's profile Send private message
AylinCE
Grandmaster Cheater Supreme
Reputation: 37

Joined: 16 Feb 2017
Posts: 1516

PostPosted: Thu Sep 22, 2022 2:41 am    Post subject: Reply with quote

Or create bitmap local ..
I'm not at the PC, I haven't tried the codes. Just to give an idea.

Code:

function crtPicture(link1)
ss22=createStringStream(link1)
p=createPicture()
p.loadFromStream(ss22)
ss22.destroy()
return p
end

picture1 = crtPicture("C\\mypic1.png")
picture2 = crtPicture("C\\mypic2.png")

local ImageList1 = {}

ImageList1[1] = picture1
ImageList1[2] = picture2
local rep = 1

btn1.OnClick=function()
if rep==1 then
FrmImg2.picture = ImageList1[1]
rep=2
else
FrmImg2.picture = ImageList1[2]
rep=1
end
end


-- Edit --
1) Form control ..
2) All image.bitmap
3) Table[İndex] = image.bitmap
4) Picture = Table[İndex]

_________________
Hi Hitler Different Trainer forms for you!
https://forum.cheatengine.org/viewtopic.php?t=619279
Enthusiastic people: Always one step ahead
Do not underestimate me Master: You were a beginner in the past
Back to top
View user's profile Send private message Visit poster's website MSN Messenger
Dark Byte
Site Admin
Reputation: 470

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

PostPosted: Thu Sep 22, 2022 3:59 am    Post subject: Reply with quote

you mean image1.picture.bitmap I assume

anyhow, you can use draw
e.g:
Code:

f=createForm()
f.ClientWidth=500
f.ClientHeight=500
f.BorderStyle=bsSizeable

image=createImage(f)
image.align=alClient
image.stretch=true


image.Picture.Bitmap.Width=MainForm.mfImageList.Width
image.Picture.Bitmap.Height=MainForm.mfImageList.Height
image.Picture.Bitmap.Canvas.clear()
MainForm.mfImageList.draw(image.Picture.Bitmap.Canvas,0,0,0)

_________________
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
Corroder
Grandmaster Cheater Supreme
Reputation: 75

Joined: 10 Apr 2015
Posts: 1668

PostPosted: Thu Sep 22, 2022 5:40 am    Post subject: Reply with quote

Oops.. sorry for misunderstood matter. I mean load and show image on TImage from TImageList.

Code:
if f then f.Destroy() end

f = createForm()
f.setSize(220,230)
f.Position = 'poScreenCenter'
f.Caption = 'Image List'

img = createImage(f)
img.setSize(210,190)
img.Left = 5
img.Top = 5
img.Stretch = true
--img.Picture.loadFromFile("F:\\bmp img\\img1.bmp")

cb =createCheckBox(f)
cb.Caption = 'Running'
cb.Left = (f.Width - cb.Width) / 2
cb.Top = 200
cb.Checked = false

imlFrames = createImageList(f)
imlFrames.Width = img.Width
imlFrames.Hight = img.Height
imlFrames.DrawingStyle = 'dsNormal'
imlFrames.ImageType = 'itImage'
imlFrames.AllocBy = 11

-- adding bitmap images to imageList, contains 11 bitmap images
for i = 1, 11 do
 local imgfile = 'img'..i..'.bmp'
 local p=createPicture()
  _G[imgfile]=p
 p.loadFromFile("F:\\bmp img\\"..imgfile)
 srcbmp = createBitmap()
 srcbmp = p.getBitmap()
 imlFrames.Add(srcbmp)
 img.Picture = imgfile
 p.Destroy()
 srcbmp.Destroy()
end


So, say I want load bitmap image with index no.2 from the TImageList and put the picture on TImage. How do that in CE Lua?.

in VB6, example :

Code:
img.Picture = imlFrames.ListImages(next_frame).Picture

_________________
Stealing Code From Stolen Code...
And Admit It.. Hmmm....Typically LOL
Back to top
View user's profile Send private message
Dark Byte
Site Admin
Reputation: 470

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

PostPosted: Thu Sep 22, 2022 7:15 am    Post subject: Reply with quote

Code:

image.Picture.Bitmap.Width=imlFrames.Height
image.Picture.Bitmap.Height=imlFrames.Height
image.Picture.Bitmap.Canvas.clear()
imlFrames.draw(image.Picture.Bitmap.Canvas,0,0,2)

_________________
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
Corroder
Grandmaster Cheater Supreme
Reputation: 75

Joined: 10 Apr 2015
Posts: 1668

PostPosted: Thu Sep 22, 2022 8:37 am    Post subject: Reply with quote

Done, perfect. Thanks DB
_________________
Stealing Code From Stolen Code...
And Admit It.. Hmmm....Typically LOL
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