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 


Transparent background when drawing with canvas.

 
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: 54

Joined: 13 Sep 2011
Posts: 1588

PostPosted: Wed Jun 11, 2014 5:24 am    Post subject: Transparent background when drawing with canvas. Reply with quote

Hey,

How can I set transparent on object that I draw on with the Canvas class.

For example this script.
Code:
local form = createForm();
form.Color = 0xff -- red
local image = createImage(form);
image.width = form.width - 50;
image.left = 25;
image.height = form.height - 50;
image.top = 25;

image.Canvas.Brush.Color=0xff0000; -- blue

image.Canvas.fillRect(25, 25, image.width-25, image.height-25);


There will be 3 colors: red, black, blue.
When drawing with canvas, areas that are not filled by the user, become black?
How can I force it to be transparent instead (to be red, the color of the parent object (form)).

Code:
image.Transparent = true

Isn't applying any effect.

_________________
I'm rusty and getting older, help me re-learn lua.
Back to top
View user's profile Send private message Visit poster's website
Dark Byte
Site Admin
Reputation: 471

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

PostPosted: Wed Jun 11, 2014 10:55 am    Post subject: Reply with quote

Welcome to the LCL image/picture weirdness

try something like this:
Code:

form = createForm();
form.Color = 0xff -- red
image = createImage(form);
image.width = form.width - 50;
image.left = 25;
image.height = form.height - 50;
image.top = 25;

bm=image.picture.Bitmap
bm.Width=image.Width
bm.Height=image.Height

bm.Canvas.Brush.Color=0xff0000; -- blue
bm.Canvas.fillRect(25, 25, image.width-25, image.height-25);
bm.TransparentColor=clBlack
image.Transparent=true

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

Joined: 13 Sep 2011
Posts: 1588

PostPosted: Wed Jun 11, 2014 11:26 am    Post subject: Reply with quote

Thanks for the example.

Also, RGB is reversed (BGR..?).

This cyan color (0x169EAB)
http://www.w3schools.com/tags/ref_colorpicker.asp?colorhex=%23169eab

In C.E looks like mustard
Code:
form = createForm();
form.Color = 0x169EAB


If we reverse it to 0xAB9E16, it'll produce the cyan color.
Code:
form = createForm();
form.Color = 0xAB9E16


So I'm guessing this is a bug.
(Not that it's an issue, I'm parsing colors to rgb, just thought to let you know.)


Thanks again mate!.

_________________
I'm rusty and getting older, help me re-learn lua.
Back to top
View user's profile Send private message Visit poster's website
mgr.inz.Player
I post too much
Reputation: 222

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

PostPosted: Wed Jun 11, 2014 3:52 pm    Post subject: Reply with quote

DaSpamer wrote:
Also, RGB is reversed (BGR..?).


hex values:

0xBBGGRR

or
0xABBGGRR

or
0xAABBGGRR

A is alpha



And no, this is not a bug. Open Form Designer, set Form color to R=1 G=2 B=3, look at object inspector, you will see this:



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

Joined: 13 Sep 2011
Posts: 1588

PostPosted: Wed Jun 11, 2014 8:18 pm    Post subject: Reply with quote

Thank you.
Never knew theres RGBA (ABGR).

Great stuff!.

_________________
I'm rusty and getting older, help me re-learn lua.
Back to top
View user's profile Send private message Visit poster's website
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