На основании этого ответа с использованием автоматического подсчета ссылок (ARC): https://stackoverflow.com/a/8217755/881197
Добавить категорию в NSString
со следующими метод:
+ (id)stringWithFormat:(NSString *)format array:(NSArray *)arguments
{
NSRange range = NSMakeRange(0, [arguments count]);
NSMutableData *data = [NSMutableData dataWithLength:sizeof(id) * [arguments count]];
[arguments getObjects:(__unsafe_unretained id *)data.mutableBytes range:range];
NSString *result = [[NSString alloc] initWithFormat:format arguments:data.mutableBytes];
return result;
}
Get the colors from the foreground and background brushes, mix them, and create a new brush from the resulting color.
Example in C#:
Color foreground = foregroundBrush.Color;
Color background = backgroundBrush.Color;
int opacity = 25;
int r = (opacity * (foreground.R - background.R) / 100) + background.R;
int g = (opacity * (foreground.G - background.G) / 100) + background.G;
int b = (opacity * (foreground.B - background.B) / 100) + background.B;
SolidColorBrush mixedBrush = new SolidColorBrush(Color.FromArgb(r, g, b));