private void PerformDraw(PlayingInfo playingInfo) { byte imageSize = 2; byte textSize = 3; var result = new List <LayoutDrawElement>(); if (playingInfo.IsPlaying != _isPlaying) { _isPlaying = playingInfo.IsPlaying; _playPauseButton.ReplaceText(_isPlaying.Value?FontAwesomeRes.fa_pause:FontAwesomeRes.fa_play); } if (_previousRepresentation != playingInfo?.BitmapRepresentation) { _previousRepresentation = playingInfo?.BitmapRepresentation; using (var bitmap = new BitmapEx(LayoutContext.IconSize.Width * imageSize, LayoutContext.IconSize.Height * imageSize)) { bitmap.MakeTransparent(); if (playingInfo?.BitmapRepresentation != null) { using (BitmapEx coverBitmap = playingInfo.BitmapRepresentation.CreateBitmap()) { BitmapHelpers.ResizeBitmap(coverBitmap, bitmap); } } result.AddRange(BitmapHelpers.ExtractLayoutDrawElements(bitmap, new DeviceSize(imageSize, imageSize), 0, 0, LayoutContext)); } } using (var bitmap = new BitmapEx(LayoutContext.IconSize.Width * textSize, LayoutContext.IconSize.Height)) { var lineWidth = 0.05; bitmap.MakeTransparent(); var title = playingInfo?.Title; DefaultDrawingAlgs.DrawText(bitmap, GlobalContext.Options.Theme.FontFamily, title, LayoutContext.Options.Theme.ForegroundColor); if (playingInfo != null) { using (var graphics = bitmap.CreateGraphics()) using (var brush = new SolidBrush(GlobalContext.Options.Theme.ForegroundColor)) { var rect = new Rectangle(0, (int)(bitmap.Height * (1 - lineWidth)), (int)(bitmap.Width * playingInfo.CurrentPosition.TotalMilliseconds / playingInfo.DurationSpan.TotalMilliseconds), (int)(bitmap.Height * lineWidth)); graphics.FillRectangle(brush, rect); } } result.AddRange(BitmapHelpers.ExtractLayoutDrawElements(bitmap, new DeviceSize(textSize, 1), imageSize, 0, LayoutContext)); } using (var bitmap = new BitmapEx(LayoutContext.IconSize.Width * textSize, LayoutContext.IconSize.Height)) { bitmap.MakeTransparent(); var artist = playingInfo?.Artist ?? string.Empty; var album = playingInfo?.Album ?? string.Empty; var text = $"{artist}\n{album}"; DefaultDrawingAlgs.DrawText(bitmap, GlobalContext.Options.Theme.FontFamily, text, GlobalContext.Options.Theme.ForegroundColor); result.AddRange(BitmapHelpers.ExtractLayoutDrawElements(bitmap, new DeviceSize(textSize, 1), imageSize, 1, LayoutContext)); } DrawInvoke(result); }