public override void Draw(AdvancedDrawBatch drawBatch, DrawButtonInfo info) { Update(info.EllapsedTime, info.ButtonState); ButtonState state = info.ButtonState; Color color = ColorFromState * info.Opacity * Opacity; NinePatchImage image = _imageReleased; switch (state & ButtonState.Mask) { case ButtonState.Disabled: if (_imageDisabled != null) { image = _imageDisabled; } break; case ButtonState.Pushed: if (_imagePushed != null) { image = _imagePushed; } break; } float scale = _scaleByUnit ? (float)UiUnit.Unit : 1; Rectangle target = _margin.ComputeRect(info.Target); drawBatch.DrawNinePatchRect(image, target, color, scale * _scale); }
void IBackgroundDrawable.Draw(AdvancedDrawBatch drawBatch, Rectangle target, Color color) { float scale = _scaleByUnit ? (float)UiUnit.Unit : 1; color = GraphicsHelper.MultiplyColors(color, _color.Value); target = _margin.ComputeRect(target); drawBatch.DrawNinePatchRect(_image, target, color, scale * _scale); }