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 


Text Shadow Trick

 
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: Fri Sep 11, 2020 9:40 am    Post subject: Text Shadow Trick Reply with quote

How I eliminate black color except on the text?.

Code:
if f then f.Destroy() end

f = createForm()
f.setSize(700, 194)
f.Position = 'poScreenCenter'
f.BorderStyle = 'bsNone'
f.OnMouseDown = function() f.dragNow() end

image1 = createImage(f)
image1.setSize(600,200)
image1.Canvas.Font.Style = 'fsBold'
image1.Canvas.Font.Size = 36
image1.Canvas.Brush.Style = 1 --bsClear
image1.Canvas.Font.Color =    9145219
image1.Canvas.TextOut(40, 40, 'hi there, how are you?')
image1.Canvas.Brush.Style = 1 --bsClear
image1.Canvas.Font.Color = 0
image1.Canvas.TransparentColor = clBlack
image1.Canvas.Transparent = true
image1.Canvas.TextOut(37, 37, 'hi there, how are you?')



Capture.JPG
 Description:
Text Shadow
 Filesize:  13.9 KB
 Viewed:  1534 Time(s)

Capture.JPG



_________________
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: 1543

PostPosted: Fri Sep 11, 2020 1:34 pm    Post subject: Reply with quote

Different idea (but I haven't tried it in Panel)
I still couldn't like "Form.OnPaint".
After a while, the form will contract and slow down.

Code:
if f then f.Destroy() end

f = createForm()
--f.setSize(700, 194)
f.Position = 'poScreenCenter'
f.BorderStyle = 'bsNone'
f.OnMouseDown = function() f.dragNow() end

local l1=createLabel(f)
--l1.Alignment="taCenter"
--l1.AutoSize=false
--l1.Height=30 l1.Width=200
l1.Left=15 l1.Top=20 l1.Font.Size=20
l1.Font.Color="0xffff00" l1.Font.Style="fsBold"

local l2=createLabel(f)
l2.Left=35 l2.Top=60 l2.Font.Size=30
l2.Font.Color="0x00ff00" l2.Font.Style="fsBold"

function shadow(lbl, lcpt, shd)

--f.Canvas.Clear()
lbl.caption=lcpt
shd=tonumber(shd)
local lft=tonumber(lbl.Left)
local ltp=tonumber(lbl.Top)
f.Canvas.Alignment=lbl.Alignment
f.Canvas.AutoSize=lbl.AutoSize
f.Canvas.Font.Style=lbl.Font.Style
f.Canvas.Font.Size=lbl.Font.Size
f.Canvas.Height=lbl.Height
f.Canvas.Width=lbl.Width
f.Canvas.Brush.Style = 1 --bsClear
f.Canvas.Font.Color=9145219
f.Canvas.TextOut(lft + shd, ltp - shd, lcpt)
end

f.OnPaint=function()
shadow(l1, "Hello Word!", 3)
shadow(l2, "Cheat  Engine", 4)
end



shadow1.JPG
 Description:
 Filesize:  71.59 KB
 Viewed:  1516 Time(s)

shadow1.JPG



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

Joined: 10 Apr 2015
Posts: 1668

PostPosted: Fri Sep 11, 2020 5:54 pm    Post subject: Reply with quote

Thanks to try for the solution. Anyhow, if the drawn text is put on a function and use OnPaint event, I don't need to create any labels or components.
Just draw the text on the canvas directly.

Code:
if f then f.Destroy() end

f = createForm()
f.setSize(550, 194)
f.Position = 'poScreenCenter'

function shadowText(frm, txt, fntSize, shdCol, shdX, shdY, txtCol, txtX, txtY)
 c = frm.Canvas
                       -- the shadow part
 c.Brush.Style = 'bsClear'
 c.Font.Size = fntSize
 c.Font.Style = 'fsBold'
 c.Font.Quality = 'fqAntialiased'
 --c.Font.Orientation = 50
 c.Font.Color = shdCol
 c.TextOut(shdX, shdY, txt)

                       -- the front text part
 --c.Font.Orientation = -50
 c.Font.Color = txtCol
 c.TextOut(txtX, txtY, txt)
end

f.OnPaint = function()
 shadowText(f, 'hi there, how are you?', 36, 9145219, 35, 30, 0, 30, 28)
 shadowText(f, 'This is Cheat Engine', 28, 9145219, 107, 107, 13464600, 110, 110)
end



What I try is using canvas image, as on first script.



Capture.JPG
 Description:
Text Shadows
 Filesize:  25.68 KB
 Viewed:  1496 Time(s)

Capture.JPG



_________________
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