File tree Expand file tree Collapse file tree 1 file changed +34
-0
lines changed Expand file tree Collapse file tree 1 file changed +34
-0
lines changed Original file line number Diff line number Diff line change @@ -81,6 +81,40 @@ public final class SDLTexture {
81
81
try SDL_SetTextureBlendMode ( internalPointer, SDL_BlendMode ( newValue. rawValue) ) . sdlThrow ( type: type ( of: self ) )
82
82
}
83
83
84
+ /**
85
+ Get the additional alpha value used in render copy operations.
86
+
87
+ - Note:
88
+ When this texture is rendered, during the copy operation the source alpha value is modulated by this alpha value according to the following formula:
89
+
90
+ `srcA = srcA * (alpha / 255)`
91
+
92
+ Alpha modulation is not always supported by the renderer; it will return -1 if alpha modulation is not supported.
93
+ */
94
+ public func alphaModulation( ) throws -> UInt8 {
95
+
96
+ var alpha : UInt8 = 0
97
+ try SDL_GetTextureAlphaMod ( internalPointer, & alpha) . sdlThrow ( type: type ( of: self ) )
98
+ return alpha
99
+ }
100
+
101
+ /**
102
+ Set an additional alpha value used in render copy operations.
103
+
104
+ - Parameter alpha: the source alpha value multiplied into copy operations.
105
+
106
+ - Note:
107
+ When this texture is rendered, during the copy operation the source alpha value is modulated by this alpha value according to the following formula:
108
+
109
+ `srcA = srcA * (alpha / 255)`
110
+
111
+ Alpha modulation is not always supported by the renderer; it will return -1 if alpha modulation is not supported.
112
+ */
113
+ public func setAlphaModulation( _ alpha: UInt8 ) throws {
114
+
115
+ try SDL_SetTextureAlphaMod ( internalPointer, alpha) . sdlThrow ( type: type ( of: self ) )
116
+ }
117
+
84
118
// MARK: - Methods
85
119
86
120
/// Lock a portion of the texture for write-only pixel access (only valid for streaming textures).
You can’t perform that action at this time.
0 commit comments