Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revisionPrevious revision
users:shilo:extensions:shblendmodes [2012/08/21 00:27] – [Data entry] 67.181.243.216users:shilo:extensions:shblendmodes [2013/03/05 10:19] (current) – external edit 127.0.0.1
Line 1: Line 1:
 +====== SHBlendModes ======
 +---- dataentry extension ----
 +type          : extension
 +author_mail   : shilo86@gmail.com Shilo White
 +description   : A category that allows blend modes via presets or custom blends.
 +lastupdate_dt : 2012-03-11
 +compatible    : v1.X
 +depends       : 
 +tags          : blend, blending, mode, blend mode
 +homepage_url  : https://gist.github.com/2019733
 +download_url  : https://gist.github.com/gists/2019733/download
 +----
  
 +===== Properties =====
 +=== blendMode ===
 +An integer that specifies a preset blend mode. The initial value is SHBlendModeAuto.
 +<code>@property (nonatomic, assign) SHBlendMode blendMode;</code>
 +See [[shblendmodes#presets|presets]] for valid values.
 +
 +=== blendModeName ===
 +A readonly string that describes what blending mode is in use. The initial value is "auto".
 +<code>@property (nonatomic, readonly) NSString *blendModeName;</code>
 +
 +=== blendModeSourceFactor ===
 +An integer that specifies how the red, green, blue, and alpha source blending factors are computed. The following symbolic constants are accepted: GL_ZERO, GL_ONE, GL_DST_COLOR, GL_ONE_MINUS_DST_COLOR, GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA, GL_DST_ALPHA, GL_ONE_MINUS_DST_ALPHA, and GL_SRC_ALPHA_SATURATE. The initial value is GL_ZERO.
 +<code>@property (nonatomic, assign) GLenum blendModeSourceFactor;</code>
 +Changing this property will automatically set "blendMode" property to SHBlendModeCustom.
 +
 +=== blendModeDestinationFactor ===
 +An integer that specifies how the red, green, blue, and alpha destination blending factors are computed. Eight symbolic constants are accepted: GL_ZERO, GL_ONE, GL_SRC_COLOR, GL_ONE_MINUS_SRC_COLOR, GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA, GL_DST_ALPHA, and GL_ONE_MINUS_DST_ALPHA. The initial value is GL_ZERO.
 +<code>@property (nonatomic, assign) GLenum blendModeDestinationFactor;</code>
 +Changing this property will automatically set "blendMode" property to SHBlendModeCustom.
 +
 +===== Instance Methods =====
 +=== setBlendModeSourceFactor:destinationFactor:===
 +Sets the blend mode source factor and destination source factor. See [[shblendmodes#blendModeSourceFactor|blendModeSourceFactor]] and [[shblendmodes#blendModeDestinationFactor|blendModeDestinationFactor]].
 +<code>- (void)setBlendModeSourceFactor:(GLenum)blendModeSourceFactor destinationFactor:(GLenum)blendModeDestinationFactor;</code>
 +Calling this method will automatically set "blendMode" property to SHBlendModeCustom.
 +
 +===== Presets =====
 +  * **SHBlendModeAuto** - Blend mode will automatically be handled by Sparrow. (Default)
 +  * **SHBlendModeNormal** - The source and destination alpha value will blend normally.
 +  * **SHBlendModeInverseMask** - The source alpha will be 100% and the destination alpha value will be 0%. This preset is only useful for drawing an object into a SPRenderTexture.
 +  * **SHBlendModeErase** - Erases the pixels behind the object's bound, or if it is a SPImage, the pixels behind it will be erased based on the alpha value of each pixel inside the SPImage.
 +  * **SHBlendModeCustom** - Allows you to specify the blend source factor and blend destination factor manually.
 +  * More presets to come...
 +
 +===== Source Code =====
 +%gist(2019733)%
 
 
Powered by DokuWiki