SDL and transparency

Discuss SDL programming with the RebelSDL plugin here
Post Reply
User avatar
Allanon
Posts: 440
Joined: Sun Feb 14, 2010 8:53 pm
Location: Italy
Contact:

SDL and transparency

Post by Allanon » Mon Sep 18, 2017 12:45 pm

Hello,
I'm having problems drawing hardware brushes with an arbitrary transparency (on WIndows).

The drawing tag "transparency" seems to be not supported while RebelSDL is used, I've also tried to use

Code: Select all

sdl.SetTextureAlphaMod(1, 100)
Where 1 is the id of my hardware brush, but it says that the object is not found.

Any hints?
----------------------------
[Allanon] Fabio Falcucci
AMC - Creative Development // Docs Site // Support Forum
Support me on Patreon for Hollywood libraries!

User avatar
airsoftsoftwair
Posts: 2558
Joined: Fri Feb 12, 2010 3:33 pm
Location: Germany
Contact:

Re: SDL and transparency

Post by airsoftsoftwair » Mon Sep 18, 2017 7:55 pm

The "Transparency" tag of @BRUSH and LoadBrush() works here with RebelSDL. Please post a code snippet if it doesn't work you and I'll take a look.

sdl.SetTextureAlphaMod() and all other RebelSDL commands which expect an identifier of a hardware brush require Hollywood 7.1, unfortunately :)

User avatar
Allanon
Posts: 440
Joined: Sun Feb 14, 2010 8:53 pm
Location: Italy
Contact:

Re: SDL and transparency

Post by Allanon » Tue Sep 19, 2017 8:50 am

Hi Andreas,

here a screenshot running on Windows 10 :
Image

and here is the snippet:

Code: Select all

; TESTING DRAWING TAGS & SDL
; --------------------------------------------------------------
@REQUIRE "rebelsdl"

LoadBrush(1, "test.png",
          { Hardware = True, Display = 1, LoadAlpha = True })
                    
                    
Local tags = 
  { ; Width = 300, Height = 300,
    ; ScaleX = 0.5, ScaleY = 0.5,
    ; Rotate = 125,ù
    ; Transform = { 1, 0.5, 0, 0.5 },
    ; SmoothScale = True,
    ; AnchorX = 0.5, AnchorY = 0.5,
    Transparency = 100
    ; Tint = 100,
    ; TintColor = #RED,
    }
    
BeginDoubleBuffer(True)

Repeat
  Cls(#RED)
  DisplayBrush(1, #CENTER, #CENTER, tags)
  Flip()
Forever
For the sdl commands, ok, I will update HW in the next weeks ;)
----------------------------
[Allanon] Fabio Falcucci
AMC - Creative Development // Docs Site // Support Forum
Support me on Patreon for Hollywood libraries!

User avatar
airsoftsoftwair
Posts: 2558
Joined: Fri Feb 12, 2010 3:33 pm
Location: Germany
Contact:

Re: SDL and transparency

Post by airsoftsoftwair » Thu Sep 21, 2017 6:32 pm

Sorry, I misread your original post. Indeed, the "Transparency" tag in DisplayBrush() et al. isn't supported by RebelSDL and GL Galore because the Hollywood SDK doesn't support this. Would be a nice addition though but before this is possible the SDK will need a new interface that supports it.

User avatar
Allanon
Posts: 440
Joined: Sun Feb 14, 2010 8:53 pm
Location: Italy
Contact:

Re: SDL and transparency

Post by Allanon » Thu Sep 21, 2017 7:25 pm

:cry:
----------------------------
[Allanon] Fabio Falcucci
AMC - Creative Development // Docs Site // Support Forum
Support me on Patreon for Hollywood libraries!

User avatar
airsoftsoftwair
Posts: 2558
Joined: Fri Feb 12, 2010 3:33 pm
Location: Germany
Contact:

Re: SDL and transparency

Post by airsoftsoftwair » Thu Sep 21, 2017 9:20 pm

As a workaround, you can use sdl.SetTextureAlphaMod(), though. But it needs Hollywood 7.1...

User avatar
Allanon
Posts: 440
Joined: Sun Feb 14, 2010 8:53 pm
Location: Italy
Contact:

Re: SDL and transparency

Post by Allanon » Fri Sep 22, 2017 4:22 pm

Well, I've planned to switch to Hollywood 7.1 so it's good to hear that :)
----------------------------
[Allanon] Fabio Falcucci
AMC - Creative Development // Docs Site // Support Forum
Support me on Patreon for Hollywood libraries!

User avatar
Allanon
Posts: 440
Joined: Sun Feb 14, 2010 8:53 pm
Location: Italy
Contact:

Re: SDL and transparency

Post by Allanon » Sun Dec 24, 2017 10:39 am

Here again to try to change the alpha of an hardware brush :)

Code: Select all

@REQUIRE "rebelsdl"

LoadBrush(1, "config/icons/arun.png", { Hardware = True, LoadAlpha = True })
sdl.SetTextureAlphaMod(1, 100)
DisplayBrush(1, 100, 100)

WaitLeftMouse()
With this snipped I'm getting this error:

Code: Select all

Requested object not found!
I think it is referring to the brush id... I'm missing something?
----------------------------
[Allanon] Fabio Falcucci
AMC - Creative Development // Docs Site // Support Forum
Support me on Patreon for Hollywood libraries!

User avatar
airsoftsoftwair
Posts: 2558
Joined: Fri Feb 12, 2010 3:33 pm
Location: Germany
Contact:

Re: SDL and transparency

Post by airsoftsoftwair » Tue Dec 26, 2017 9:23 pm

No, I'm afraid these functions need Hollywood 7.1 because they need a new SDK API which is not available in 7.0 and earlier.

User avatar
Allanon
Posts: 440
Joined: Sun Feb 14, 2010 8:53 pm
Location: Italy
Contact:

Re: SDL and transparency

Post by Allanon » Wed Dec 27, 2017 1:33 am

Ok, sorry Andreas for having asked the same question two times, reading back my first post you already answered that these functions require HW7.1
Let's hope for a quick release then :)
----------------------------
[Allanon] Fabio Falcucci
AMC - Creative Development // Docs Site // Support Forum
Support me on Patreon for Hollywood libraries!

Post Reply