Page 1 of 1

SDL and transparency

Posted: Mon Sep 18, 2017 12:45 pm
by Allanon
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?

Re: SDL and transparency

Posted: Mon Sep 18, 2017 7:55 pm
by airsoftsoftwair
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 :)

Re: SDL and transparency

Posted: Tue Sep 19, 2017 8:50 am
by Allanon
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 ;)

Re: SDL and transparency

Posted: Thu Sep 21, 2017 6:32 pm
by airsoftsoftwair
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.

Re: SDL and transparency

Posted: Thu Sep 21, 2017 7:25 pm
by Allanon
:cry:

Re: SDL and transparency

Posted: Thu Sep 21, 2017 9:20 pm
by airsoftsoftwair
As a workaround, you can use sdl.SetTextureAlphaMod(), though. But it needs Hollywood 7.1...

Re: SDL and transparency

Posted: Fri Sep 22, 2017 4:22 pm
by Allanon
Well, I've planned to switch to Hollywood 7.1 so it's good to hear that :)

Re: SDL and transparency

Posted: Sun Dec 24, 2017 10:39 am
by Allanon
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?

Re: SDL and transparency

Posted: Tue Dec 26, 2017 9:23 pm
by airsoftsoftwair
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.

Re: SDL and transparency

Posted: Wed Dec 27, 2017 1:33 am
by Allanon
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 :)