Jump to content

dxDrawRounded using Images


Recommended Posts

  • Moderators

Hmm, you could try to generate it with a browser.

 

> browser

https://wiki.multitheftauto.com/wiki/CreateBrowser

 

> html + css

<section style="width:300px;height:100;background-color:white;border-radius: 25px;"></section>

 

> get

https://wiki.multitheftauto.com/wiki/DxGetTexturePixels

https://wiki.multitheftauto.com/wiki/DxGetPixelsSize

 

> set

https://wiki.multitheftauto.com/wiki/DxCreateTexture

https://wiki.multitheftauto.com/wiki/DxSetTexturePixels

 

(or just generate the corners, color = white = #fff is recommended)

Edited by IIYAMA
Link to comment
Just now, IIYAMA said:

Hmm, you could try to generate it with a browser.

 

> browser

https://wiki.multitheftauto.com/wiki/CreateBrowser

 

> html + css


<section style="width:300px;height:100;background-color:black;border-radius: 25px;"></section>

 

> get

https://wiki.multitheftauto.com/wiki/DxGetTexturePixels

https://wiki.multitheftauto.com/wiki/DxGetPixelsSize

 

> set

https://wiki.multitheftauto.com/wiki/DxCreateTexture

https://wiki.multitheftauto.com/wiki/DxSetTexturePixels

 

 

Yeah I know its possible with CEF, but I want to avoid that. Trying to do it through Dx, I've seen people do something with dxDrawImageSection, any idea on that?

Link to comment
  • Moderators
3 minutes ago, ℓιgнт said:

Yeah I know its possible with CEF, but I want to avoid that. Trying to do it through Dx, I've seen people do something with dxDrawImageSection, any idea on that?

This function can be used to repeat the same image, it might be possible that they use the rotation/rotationCenterOffsetX/rotationCenterOffsetY property for each new repeated image as offset.

But I have never seen anybody do that. So that is UNKNOWN territory for me.

Link to comment

Look at example: https://wiki.multitheftauto.com/wiki/DxDrawCircle

function dxDrawRoundedRectangle(x, y, rx, ry, color, radius)
    rx = rx - radius * 2
    ry = ry - radius * 2
    x = x + radius
    y = y + radius

    if (rx >= 0) and (ry >= 0) then
        dxDrawRectangle(x, y, rx, ry, color)
        dxDrawRectangle(x, y - radius, rx, radius, color)
        dxDrawRectangle(x, y + ry, rx, radius, color)
        dxDrawRectangle(x - radius, y, radius, ry, color)
        dxDrawRectangle(x + rx, y, radius, ry, color)

        dxDrawCircle(x, y, radius, 180, 270, color, color, 7)
        dxDrawCircle(x + rx, y, radius, 270, 360, color, color, 7)
        dxDrawCircle(x + rx, y + ry, radius, 0, 90, color, color, 7)
        dxDrawCircle(x, y + ry, radius, 90, 180, color, color, 7)
    end
end
dxDrawRoundedRectangle(350, 50, 100, 100, tocolor(0, 255, 0, 255), 20)
Link to comment
7 hours ago, thisdp said:

idk whether this could help you or not.

https://wiki.multitheftauto.com/wiki/DgsCreateRoundRect

I tried DGS, it's still not as smooth as I want it to be, you can see the rough edges. It's a good try though, thanks.

14 hours ago, DNL291 said:

Perfect that's what I needed.

Link to comment
  • Scripting Moderators
1 minute ago, ℓιgнт said:

I tried DGS, it's still not as smooth as I want it to be, you can see the rough edges. It's a good try though, thanks.

Perfect that's what I needed.

the rough edges is adjustable, you can make it smooth just by changing the settings. Actually the edge is smooth by default

Edited by thisdp
Link to comment

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...