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 


Anti-alias circle

 
Post new topic   Reply to topic    Cheat Engine Forum Index -> Cheat Engine Lua Scripting
View previous topic :: View next topic  
Author Message
Skyrimfus
Cheater
Reputation: 1

Joined: 17 Mar 2016
Posts: 42

PostPosted: Mon Sep 06, 2021 9:22 am    Post subject: Anti-alias circle Reply with quote

How to draw a anitialiased circle using canvas?
Back to top
View user's profile Send private message
Corroder
Grandmaster Cheater Supreme
Reputation: 75

Joined: 10 Apr 2015
Posts: 1667

PostPosted: Tue Sep 07, 2021 2:52 am    Post subject: Reply with quote

Code:
if f then f.destroy() end
f=createForm()

function setShape(str, vv)
    local vx = str.Width;
    local vy = str.Height;

    if (bm1) then bm1.destroy() end
    if (bm2) then bm2.destroy() end

    local multAmount = 10;
    local multOffset = 5;

    bm1 = createBitmap(vx * multAmount, vy * multAmount)
    bm1.Canvas.clear();
    bm1.Canvas.Pen.Width = 1;
    bm1.Canvas.AntialiasingMode = amOn;
    bm1.Canvas.roundRect(0 + multOffset, 0 + multOffset, vx * multAmount - multOffset, vy * multAmount - multOffset, vv * multAmount, vv * multAmount);

    bm2 = createBitmap(vx, vy)
    bm2.Canvas.clear();
    bm2.Canvas.Pen.Width = 1;
    bm2.Canvas.AntialiasingMode = amOn;
    bm2.Canvas.drawWithMask(0, 0, vx, vy, bm1, 0, 0, vx * multAmount, vy * multAmount);

    str.setShape(bm2);
end
for i = 1, 5 do
    p = createPanel(f);
    p.setSize(40, 40);
    p.setPosition(i * 45, 50);
    p.Color = i * 50;
    setShape(p, 100);
end


Thanks to atom0s

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

Joined: 17 Mar 2016
Posts: 42

PostPosted: Fri Sep 10, 2021 10:49 am    Post subject: Reply with quote

Corroder wrote:
Code:
if f then f.destroy() end
f=createForm()

function setShape(str, vv)
    local vx = str.Width;
    local vy = str.Height;

    if (bm1) then bm1.destroy() end
    if (bm2) then bm2.destroy() end

    local multAmount = 10;
    local multOffset = 5;

    bm1 = createBitmap(vx * multAmount, vy * multAmount)
    bm1.Canvas.clear();
    bm1.Canvas.Pen.Width = 1;
    bm1.Canvas.AntialiasingMode = amOn;
    bm1.Canvas.roundRect(0 + multOffset, 0 + multOffset, vx * multAmount - multOffset, vy * multAmount - multOffset, vv * multAmount, vv * multAmount);

    bm2 = createBitmap(vx, vy)
    bm2.Canvas.clear();
    bm2.Canvas.Pen.Width = 1;
    bm2.Canvas.AntialiasingMode = amOn;
    bm2.Canvas.drawWithMask(0, 0, vx, vy, bm1, 0, 0, vx * multAmount, vy * multAmount);

    str.setShape(bm2);
end
for i = 1, 5 do
    p = createPanel(f);
    p.setSize(40, 40);
    p.setPosition(i * 45, 50);
    p.Color = i * 50;
    setShape(p, 100);
end


Thanks to atom0s

This isn't antialiased tho
Back to top
View user's profile Send private message
atom0s
Moderator
Reputation: 198

Joined: 25 Jan 2006
Posts: 8517
Location: 127.0.0.1

PostPosted: Fri Sep 10, 2021 2:26 pm    Post subject: Reply with quote

The default canvas and bitmap objects don't adhere to the anti-alias setting.

You can try and request that DB add support for the better controls such as:
- TBGRACanvas
- TBGRABitmap

As these have much better drawing handling and do adhere to anti-alias settings.

_________________
- Retired.
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