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 


Color, Pen, Brush Mode And Style

 
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: Mon Oct 05, 2020 11:35 pm    Post subject: Color, Pen, Brush Mode And Style Reply with quote

Hi, my question (on CE 7.1)

1. Color (in Lua)
example:

Code:
form.Color = 'clRed'  --> this is not work

or

form.Color = clRed  --> this is not work

or

form.Color = 0xff  --> this is work

or

form.Color = 255 --> this is work



Why I can not use 'clRed' or clRed?. Is it a bug?
Of course, I can make reference substitution like clRed = 0xfff, clBlack = 0, etc, but I mean is to use the color name directly as provided by CE.


2. Canvas Pen and Brush
Example

Code:
Canvas.Brush.Style = 'bsSolid'  --> not work
Canvas.Brush.Style = 0  -->  work

Canvas.Brush.Color = 'clBlack'  -->  not work
Canvas.Brush.Color = clBlack   -->  not work
Canvas.Brush.Color = 0   --> work


Same question with No.1

3. Where I can find Canvas Brush and Pen Style complete Code Numbers?.
I need to know code for Pen.Mode = pmXor and Pen.Mode = pmCopy.


4. With these script

Code:
if f then f.Destroy() end
f=createForm()
f.setSize(300,300)

local down=1
local startX, startY

f.OnMouseDown=function()
  x,y = f.ScreenToClient(getMousePos())
  startX = x
  startY = y
  down=0
end

f.OnMouseUp=function()
  down=1
end

f.OnMouseMove=function()
  local x,y=f.ScreenToClient(getMousePos())
  if down==0 then
    f.caption = startX..' '..startY..' '..x..' '..y
    --f.Canvas.Clear()
    f.Canvas.Pen.Color = 0xff
    f.Canvas.Pen.Width = 1
    f.Canvas.Brush.Color = f.color
    f.Canvas.Brush.Style = 0
    f.Canvas.TransparentColor = 0
    f.Canvas.ellipse(startX, startY, x, y)

  end
end


How I can draw perfect ellipse or rectangle without clear the canvas ?.



Capture.JPG
 Description:
 Filesize:  21.27 KB
 Viewed:  1642 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
Dark Byte
Site Admin
Reputation: 471

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

PostPosted: Tue Oct 06, 2020 1:15 am    Post subject: Reply with quote

1: clRed is just an integer value. But next version will have it defined in defines.lua

2: same. Color is an integer, not a enum or typeset so no string

3: lazarus. type in pmXor , hold shift and click it
(i'll try to document it)

edit:
Code:

TFPPenMode = (pmBlack, pmWhite, pmNop, pmNot, pmCopy, pmNotCopy,
                pmMergePenNot, pmMaskPenNot, pmMergeNotPen, pmMaskNotPen, pmMerge,
                pmNotMerge, pmMask, pmNotMask, pmXor, pmNotXor);   


so:
Code:

pmBlack=0
pmWhite=1
pmNop=2
pmNot=3
pmCopy=4
pmNotCopy=5
pmMergePenNot=6
pmMaskPenNot=7
pmMergeNotPen=8
pmMaskNotPen=9
pmMerge=10
pmNotMerge=11
pmMask=12
pmNotMask=13
pmXor=14
pmNotXor=15


4: draw a blank ellipse over the last drawn one before drawing the new ellipse
or when you start dragging create a copy of the image and while moving draw the original image before you draw.
when released you can destroy the original

_________________
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: Tue Oct 06, 2020 2:05 am    Post subject: Reply with quote

Great, DB. Thanks for all information and tutorial.
So, we are waiting for new updates in next CE Version.
Good luck...

EDIT: No.4

Done, but I must set the brush color to form color.

Code:
if f then f.Destroy() end
f=createForm()
f.setSize(300,300)
f.Transparent = true
f.Position = 'poScreenCenter'
f.Caption = ''
f.Color = 0xffffff

local down=1
local startX, startY, endX, endY

f.OnMouseDown=function(sender, button, x, y)
  down=0
  startX = x
  startY = y
  endX = x
  endY = y
end

f.OnMouseUp=function(sender, button, x, y)
  down=1
end

f.OnMouseMove=function(sender, button, x, y)
  local x,y=f.ScreenToClient(getMousePos())
  if down==0 then
    f.caption = startX..' '..startY..' '..x..' '..y
    f.Canvas.Brush.Color = f.Color
    f.Canvas.TransparentColor = 0xffffff
    f.Canvas.Pen.Width = 1
    f.Canvas.Pen.Color = f.Canvas.Brush.Color
    f.Canvas.ellipse(startX, startY, endX, endY)
    f.Canvas.Pen.Color = 0xff
    f.Canvas.ellipse(startX, startY, x, y)
  end
  endX = x; endY = y
end




Capture.JPG
 Description:
 Filesize:  22.74 KB
 Viewed:  1615 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