本文整理汇总了C#中MatterHackers.Agg.Image.ImageBuffer.InvertLightness方法的典型用法代码示例。如果您正苦于以下问题:C# ImageBuffer.InvertLightness方法的具体用法?C# ImageBuffer.InvertLightness怎么用?C# ImageBuffer.InvertLightness使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类MatterHackers.Agg.Image.ImageBuffer
的用法示例。
在下文中一共展示了ImageBuffer.InvertLightness方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Generate
public Button Generate(ImageBuffer normalImage, ImageBuffer hoverImage, ImageBuffer pressedImage = null, ImageBuffer disabledImage = null)
{
if(hoverImage == null)
{
hoverImage = normalImage;
}
if (pressedImage == null)
{
pressedImage = hoverImage;
}
if (disabledImage == null)
{
disabledImage = normalImage;
}
if (!ActiveTheme.Instance.IsDarkTheme && InvertImageColor)
{
normalImage.InvertLightness();
pressedImage.InvertLightness();
hoverImage.InvertLightness();
disabledImage.InvertLightness();
}
ButtonViewStates buttonViewWidget = new ButtonViewStates(
new ImageWidget(normalImage),
new ImageWidget(hoverImage),
new ImageWidget(pressedImage),
new ImageWidget(disabledImage)
);
//Create button based on view container widget
Button imageButton = new Button(0, 0, buttonViewWidget);
imageButton.Margin = new BorderDouble(0);
imageButton.Padding = new BorderDouble(0);
return imageButton;
}
示例2: getCheckBoxButtonView
private CheckBoxViewStates getCheckBoxButtonView(string label, ImageBuffer normalImage = null,
ImageBuffer pressedImage = null,
ImageBuffer normalToPressedImage = null,
ImageBuffer pressedToNormalImage = null,
string pressedLabel = null)
{
string pressedText = pressedLabel;
if (pressedLabel == null)
{
pressedText = label;
}
if (normalImage != null)
{
if (!ActiveTheme.Instance.IsDarkTheme && AllowThemeToAdjustImage)
{
normalImage.InvertLightness();
}
}
if (pressedImage != null)
{
if (!ActiveTheme.Instance.IsDarkTheme && AllowThemeToAdjustImage)
{
pressedImage.InvertLightness();
}
}
if (normalToPressedImage != null)
{
if (!ActiveTheme.Instance.IsDarkTheme && AllowThemeToAdjustImage)
{
normalToPressedImage.InvertLightness();
}
}
if (pressedToNormalImage != null)
{
if (!ActiveTheme.Instance.IsDarkTheme && AllowThemeToAdjustImage)
{
pressedToNormalImage.InvertLightness();
}
}
if (invertImageLocation)
{
flowDirection = FlowDirection.RightToLeft;
}
else
{
flowDirection = FlowDirection.LeftToRight;
}
//Create the multi-state button view
GuiWidget normal = new TextImageWidget(label, normalFillColor, normalBorderColor, normalTextColor, borderWidth, Margin, normalImage, flowDirection: flowDirection, fontSize: this.fontSize, height: this.FixedHeight);
GuiWidget normalHover = new TextImageWidget(label, hoverFillColor, normalBorderColor, hoverTextColor, borderWidth, Margin, normalImage, flowDirection: flowDirection, fontSize: this.fontSize, height: this.FixedHeight);
GuiWidget switchNormalToPressed = new TextImageWidget(label, pressedFillColor, normalBorderColor, pressedTextColor, borderWidth, Margin, normalToPressedImage, flowDirection: flowDirection, fontSize: this.fontSize, height: this.FixedHeight);
GuiWidget pressed = new TextImageWidget(pressedText, pressedFillColor, pressedBorderColor, pressedTextColor, borderWidth, Margin, pressedImage, flowDirection: flowDirection, fontSize: this.fontSize, height: this.FixedHeight);
GuiWidget pressedHover = new TextImageWidget(label, hoverFillColor, pressedBorderColor, hoverTextColor, borderWidth, Margin, pressedImage, flowDirection: flowDirection, fontSize: this.fontSize, height: this.FixedHeight);
GuiWidget switchPressedToNormal = new TextImageWidget(label, normalFillColor, pressedBorderColor, normalTextColor, borderWidth, Margin, pressedToNormalImage, flowDirection: flowDirection, fontSize: this.fontSize, height: this.FixedHeight);
GuiWidget disabled = new TextImageWidget(label, disabledFillColor, disabledBorderColor, disabledTextColor, borderWidth, Margin, normalImage, flowDirection: flowDirection, fontSize: this.fontSize, height: this.FixedHeight);
CheckBoxViewStates checkBoxButtonViewWidget = new CheckBoxViewStates(normal, normalHover, switchNormalToPressed, pressed, pressedHover, switchPressedToNormal, disabled);
return checkBoxButtonViewWidget;
}
示例3: GenerateRadioButton
public RadioButton GenerateRadioButton(string label, ImageBuffer iconImage)
{
if (iconImage != null )
{
iconImage.InvertLightness();
if (ActiveTheme.Instance.IsDarkTheme
&& AllowThemeToAdjustImage)
{
iconImage.InvertLightness();
}
}
BorderDouble internalMargin = new BorderDouble(0);
TextImageWidget nomalState = new TextImageWidget(label, normalFillColor, normalBorderColor, normalTextColor, borderWidth, internalMargin, iconImage, flowDirection: flowDirection, fontSize: this.fontSize, height: this.FixedHeight, width: this.FixedWidth, centerText: true);
TextImageWidget hoverState = new TextImageWidget(label, hoverFillColor, hoverBorderColor, hoverTextColor, borderWidth, internalMargin, iconImage, flowDirection: flowDirection, fontSize: this.fontSize, height: this.FixedHeight, width: this.FixedWidth, centerText: true);
TextImageWidget checkingState = new TextImageWidget(label, hoverFillColor, checkedBorderColor, hoverTextColor, borderWidth, internalMargin, iconImage, flowDirection: flowDirection, fontSize: this.fontSize, height: this.FixedHeight, width: this.FixedWidth, centerText: true);
TextImageWidget checkedState = new TextImageWidget(label, pressedFillColor, checkedBorderColor, pressedTextColor, borderWidth, internalMargin, iconImage, flowDirection: flowDirection, fontSize: this.fontSize, height: this.FixedHeight, width: this.FixedWidth, centerText: true);
TextImageWidget disabledState = new TextImageWidget(label, disabledFillColor, disabledBorderColor, disabledTextColor, borderWidth, internalMargin, iconImage, flowDirection: flowDirection, fontSize: this.fontSize, height: this.FixedHeight, width: this.FixedWidth, centerText: true);
RadioButtonViewStates checkBoxButtonViewWidget = new RadioButtonViewStates(nomalState, hoverState, checkingState, checkedState, disabledState);
RadioButton radioButton = new RadioButton(checkBoxButtonViewWidget);
radioButton.Margin = Margin;
return radioButton;
}
示例4: getButtonView
private ButtonViewStates getButtonView(string label, ImageBuffer normalImage = null, ImageBuffer hoverImage = null, ImageBuffer pressedImage = null, ImageBuffer disabledImage = null, bool centerText = false)
{
if (hoverImage == null && normalImage != null)
{
hoverImage = new ImageBuffer(normalImage);
}
if (pressedImage == null && hoverImage != null)
{
pressedImage = new ImageBuffer(hoverImage);
}
if (disabledImage == null && normalImage != null)
{
disabledImage = new ImageBuffer(normalImage);
}
if (ActiveTheme.Instance.IsDarkTheme
&& AllowThemeToAdjustImage)
{
if (normalImage != null)
{
// make copies so we don't change source data
normalImage = new ImageBuffer(normalImage);
normalImage.InvertLightness();
}
if (pressedImage != null)
{
pressedImage.InvertLightness();
pressedImage = new ImageBuffer(pressedImage);
}
if (hoverImage != null)
{
hoverImage = new ImageBuffer(hoverImage);
hoverImage.InvertLightness();
}
if (disabledImage != null)
{
disabledImage = new ImageBuffer(disabledImage);
disabledImage.InvertLightness();
}
}
if (invertImageLocation)
{
flowDirection = FlowDirection.RightToLeft;
}
else
{
flowDirection = FlowDirection.LeftToRight;
}
//Create the multi-state button view
ButtonViewStates buttonViewWidget = new ButtonViewStates(
new TextImageWidget(label, normalFillColor, normalBorderColor, normalTextColor, borderWidth, Margin, normalImage, flowDirection: flowDirection, fontSize: this.fontSize, height: this.FixedHeight, centerText: centerText, imageSpacing: ImageSpacing),
new TextImageWidget(label, hoverFillColor, hoverBorderColor, hoverTextColor, borderWidth, Margin, hoverImage, flowDirection: flowDirection, fontSize: this.fontSize, height: this.FixedHeight, centerText: centerText, imageSpacing: ImageSpacing),
new TextImageWidget(label, pressedFillColor, pressedBorderColor, pressedTextColor, borderWidth, Margin, pressedImage, flowDirection: flowDirection, fontSize: this.fontSize, height: this.FixedHeight, centerText: centerText, imageSpacing: ImageSpacing),
new TextImageWidget(label, disabledFillColor, disabledBorderColor, disabledTextColor, borderWidth, Margin, disabledImage, flowDirection: flowDirection, fontSize: this.fontSize, height: this.FixedHeight, centerText: centerText, imageSpacing: ImageSpacing)
);
return buttonViewWidget;
}