Hi there,
I looked around for a viewport circle and the closest thing I could find was Ralph's example siff for a custom viewport. While that satisfies some use cases, it ultimately requires blocking a rectangular region at the outer extremes. I want the effect to end at the outer edge of the circle. I'd like to be able to move an image across and behind a circular viewport while not affecting the layering transparency outside the circle. Think moving glare on a steam gauge face. It needs to end at the edges of the bezel and not show up on the rest of the rectangular instrument's pixels.
I know it's been requested in the past, along with a polygon viewport shape. I just wanted to add another vote for this.
Can we pretty, pretty please have something like this? I think we could make some really cool stuff with it.
viewport_circle(x , y, radius)
Thanks!
Request: viewport_circle(x,y,radius) -- EXAMPLE ADDED
Request: viewport_circle(x,y,radius) -- EXAMPLE ADDED
Last edited by Toddimus on Thu Dec 28, 2023 9:01 pm, edited 1 time in total.
Simstrumentation Instrument developer
Check us out http://www.simstrumentation.com or https://github.com/Simstrumentation/Air-Manager
Check us out http://www.simstrumentation.com or https://github.com/Simstrumentation/Air-Manager
Re: Request: viewport_circle(x,y,radius)
So I decided to see if I could replicate this effect with the tools available and it turns out that, technically yes I can... but it's not really feasible in normal use.
It's a crude, brute force way of getting a result similar to what I'm asking for. Way too processor heavy if you make the circle have nice edges with a higher "pixel" density. Check out the code to see how I did it.
It's a crude, brute force way of getting a result similar to what I'm asking for. Way too processor heavy if you make the circle have nice edges with a higher "pixel" density. Check out the code to see how I did it.
Simstrumentation Instrument developer
Check us out http://www.simstrumentation.com or https://github.com/Simstrumentation/Air-Manager
Check us out http://www.simstrumentation.com or https://github.com/Simstrumentation/Air-Manager
Re: Request: viewport_circle(x,y,radius) -- EXAMPLE ADDED
Another bump for a viewport circle or the ability to add a circular canvas which would give a similar ability is really needed. This was originally discussed back in the AM3.6 thread.
https://siminnovations.com/forums/viewt ... 667#p17667
https://siminnovations.com/forums/viewt ... 667#p17667
Air Manager panels at https://www.experimentalsimavionics.com
Youtube Channel https://www.youtube.com/channel/UC8ZqXX ... kfZMq5BKig
Air Manager API Tutorial Video Series https://youtube.com/playlist?list=PLNr0 ... baT4gJKg5D
Youtube Channel https://www.youtube.com/channel/UC8ZqXX ... kfZMq5BKig
Air Manager API Tutorial Video Series https://youtube.com/playlist?list=PLNr0 ... baT4gJKg5D
Re: Request: viewport_circle(x,y,radius) -- EXAMPLE ADDED
Agreed! Circular canvas and circular viewport would be awesome!!
Could you guys at SI have a look at feasibility? I have an immediate use case for it and it would save me a ridiculous amount of vector graphics work if it were available.
And maybe as a bonus, generalized related feature... (I think Sling mentioned this a long time ago too) ... being able to create an arbitrarily defined viewport using vectors. It would be akin to canvas_draw's _fill except that instead of filling with a color, it would make what's inside the closed vector loop visible and everything outside the loop transparent.
Thanks!!
Could you guys at SI have a look at feasibility? I have an immediate use case for it and it would save me a ridiculous amount of vector graphics work if it were available.
And maybe as a bonus, generalized related feature... (I think Sling mentioned this a long time ago too) ... being able to create an arbitrarily defined viewport using vectors. It would be akin to canvas_draw's _fill except that instead of filling with a color, it would make what's inside the closed vector loop visible and everything outside the loop transparent.
Thanks!!
Simstrumentation Instrument developer
Check us out http://www.simstrumentation.com or https://github.com/Simstrumentation/Air-Manager
Check us out http://www.simstrumentation.com or https://github.com/Simstrumentation/Air-Manager
Re: Request: viewport_circle(x,y,radius) -- EXAMPLE ADDED
Hi,
Did have a look at this couple of years ago, but unfortunately it is not something that can easily be added.
You can git somewhat of the functionality by drawing your own shape in canvas, and then do a fill_img. The image will only show up within the shape.
Corjan
Did have a look at this couple of years ago, but unfortunately it is not something that can easily be added.
You can git somewhat of the functionality by drawing your own shape in canvas, and then do a fill_img. The image will only show up within the shape.
Corjan
Re: Request: viewport_circle(x,y,radius) -- EXAMPLE ADDED
Thanks @Corjan ! The _fill_img will get me most of the way there actually, in terms of my immediate use case. For some reason, I had never noticed that method.
But, I still have a use case for the circular and arbitrary shaped viewports. I want to make glare and lighting masks move across the faces of instruments without affecting the transparent background around the instrument/panel. I hope you guys can still take a look one of these days.
But, I still have a use case for the circular and arbitrary shaped viewports. I want to make glare and lighting masks move across the faces of instruments without affecting the transparent background around the instrument/panel. I hope you guys can still take a look one of these days.
Simstrumentation Instrument developer
Check us out http://www.simstrumentation.com or https://github.com/Simstrumentation/Air-Manager
Check us out http://www.simstrumentation.com or https://github.com/Simstrumentation/Air-Manager
Re: Request: viewport_circle(x,y,radius) -- EXAMPLE ADDED
For grins, I thought I'd try to "trick" the viewport into making a circle...
This works:
my_canvas = canvas_add(0, 0, 100, 100, function()
_rect(0,0,100,100,50)
_stroke("red", 1)
end)
So I was hoping this might work:
my_image = img_add("my_image.png",0,0,100,100)
viewport_rect(my_image, 0, 0, 100, 100, 50) --- note the added "Argument id[6]", which I was hoping would be corner radius, like it is in _rect. Interestingly, it didn't error out with the added argument.
This works:
my_canvas = canvas_add(0, 0, 100, 100, function()
_rect(0,0,100,100,50)
_stroke("red", 1)
end)
So I was hoping this might work:
my_image = img_add("my_image.png",0,0,100,100)
viewport_rect(my_image, 0, 0, 100, 100, 50) --- note the added "Argument id[6]", which I was hoping would be corner radius, like it is in _rect. Interestingly, it didn't error out with the added argument.
Simstrumentation Instrument developer
Check us out http://www.simstrumentation.com or https://github.com/Simstrumentation/Air-Manager
Check us out http://www.simstrumentation.com or https://github.com/Simstrumentation/Air-Manager
- Keith Baxter
- Posts: 4748
- Joined: Wed Dec 20, 2017 11:00 am
- Location: Gauteng
Re: Request: viewport_circle(x,y,radius) -- EXAMPLE ADDED
Nice find. Will give it a try.Toddimus wrote: ↑Wed Aug 28, 2024 4:04 pm For grins, I thought I'd try to "trick" the viewport into making a circle...
This works:
my_canvas = canvas_add(0, 0, 100, 100, function()
_rect(0,0,100,100,50)
_stroke("red", 1)
end)
So I was hoping this might work:
my_image = img_add("my_image.png",0,0,100,100)
viewport_rect(my_image, 0, 0, 100, 100, 50) --- note the added "Argument id[6]", which I was hoping would be corner radius, like it is in _rect. Interestingly, it didn't error out with the added argument.
Keith
AMD RYZEN 9 5950X CPU, Corsair H80I cooler, ASUS TUF GAMING B550-PLUS AMD Ryzen Mother Board, 32Gb ram Corsair Vengeance 3000Mh, MSI GTX960 4G graphics card