@@ -53,7 +53,9 @@ public static Task<Bitmap> InfoGraphicAsync(this Creature creature, CreatureColl
5353 BackgroundImageResizing = Properties . Settings . Default . InfoGraphicBackgroundSizing ,
5454 widthOutlineCreature = Properties . Settings . Default . InfoGraphicCreatureOutlineWidth ,
5555 creatureOutlineBlurring = Properties . Settings . Default . InfoGraphicCreatureOutlineBlurring ,
56- creatureScaling = Properties . Settings . Default . InfoGraphicCreatureScaling
56+ creatureScaling = Properties . Settings . Default . InfoGraphicCreatureScaling ,
57+ ColorBasedOnCreature = Properties . Settings . Default . InfographicColorByCreature ,
58+ TintBackgroundImage = Properties . Settings . Default . InfographicTintBackgroundImage
5759 } ) ;
5860
5961 /// <summary>
@@ -141,19 +143,22 @@ public static async Task<Bitmap> InfoGraphicAsync(this Creature creature, Creatu
141143 g . SmoothingMode = SmoothingMode . AntiAlias ;
142144 g . TextRenderingHint = TextRenderingHint . AntiAlias ;
143145
144-
145146 var backgroundImageIsDrawn = false ;
146- if ( settings . backColor . A != 255 )
147+ if ( backColor . A != 255 )
147148 {
148149 backgroundImageIsDrawn = DrawBackgroundImage ( g , settings . backgroundImagePath , 0 , yOffsetBox ,
149150 widthBox , heightBox , settings . BackgroundImageResizing ) ;
150151 if ( settings . TintBackgroundImage )
151- ImageTools . TintImage ( bmp , Utils . ColorFromHue ( colorHue , settings . backColor . GetBrightness ( ) - .5 ) ) ;
152+ //ImageTools.TintImage(bmp, backColor);
153+ ImageTools . TintImage ( bmp , Utils . ColorFromHsv ( colorHue , settings . backColor . GetSaturation ( ) , settings . backColor . GetValue ( ) ) ) ;
152154 }
153155
154156 var currentYPosition = borderAndPaddings [ 0 ] + yOffsetBox ;
155- using ( var backgroundBrush = new SolidBrush ( backColor ) )
157+ if ( backColor . A != 0 )
158+ {
159+ using var backgroundBrush = new SolidBrush ( backColor ) ;
156160 g . FillRectangle ( backgroundBrush , 0 , yOffsetBox , widthBox , heightBox ) ;
161+ }
157162
158163 var headerText = creature . Species . Name ( creature . sex , true , true ) +
159164 ( settings . displayCreatureName ? $ " - { creature . name } " : string . Empty ) ;
@@ -623,7 +628,8 @@ private static Color GetMainColor(Creature c)
623628 r => r ? . name != null && r . name . Contains ( "body" , StringComparison . InvariantCultureIgnoreCase ) ) ;
624629 }
625630
626- if ( tintColorRegionId == - 1 ) tintColorRegionId = 0 ;
631+ if ( tintColorRegionId == - 1 ) tintColorRegionId = Array . FindIndex ( c . Species . colors , r => r ? . name != null ) ;
632+ if ( tintColorRegionId == - 1 ) return Values . V . Colors . ById ( 0 ) . Color ;
627633 return Values . V . Colors . ById ( c . colors [ tintColorRegionId ] ) . Color ;
628634 }
629635
0 commit comments