本文整理汇总了C#中IPalette类的典型用法代码示例。如果您正苦于以下问题:C# IPalette类的具体用法?C# IPalette怎么用?C# IPalette使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
IPalette类属于命名空间,在下文中一共展示了IPalette类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C#代码示例。
示例1: PaletteImage8
public PaletteImage8(uint Width, uint Height, IPalette Palette)
{
this.Width = Width;
this.Height = Height;
this.Palette = Palette;
Data = new byte[Width * Height];
}
开发者ID:ninjabyte,项目名称:AncientClaw.NET,代码行数:7,代码来源:PaletteImage8.cs
示例2: PaletteRedirectBreadCrumb
/// <summary>
/// Initialize a new instance of the PaletteRedirectBreadCrumb class.
/// </summary>
/// <param name="target">Initial palette target for redirection.</param>
public PaletteRedirectBreadCrumb(IPalette target)
: base(target)
{
_left = false;
_right = false;
_topBottom = true;
}
开发者ID:Cocotteseb,项目名称:Krypton,代码行数:11,代码来源:PaletteRedirectBreadCrumb.cs
示例3: PaletteRedirectRibbonDouble
/// <summary>
/// Initialize a new instance of the PaletteRedirectRibbonDouble class.
/// </summary>
/// <param name="target">Initial palette target for redirection.</param>
/// <param name="disabledBack">Redirection for back disabled state requests.</param>
/// <param name="normalBack">Redirection for back normal state requests.</param>
/// <param name="pressedBack">Redirection for back pressed state requests.</param>
/// <param name="trackingBack">Redirection for back tracking state requests.</param>
/// <param name="selectedBack">Redirection for selected states requests.</param>
/// <param name="focusOverrideBack">Redirection for back focus override state requests.</param>
/// <param name="disabledText">Redirection for text disabled state requests.</param>
/// <param name="normalText">Redirection for text normal state requests.</param>
/// <param name="pressedText">Redirection for text pressed state requests.</param>
/// <param name="trackingText">Redirection for text tracking state requests.</param>
/// <param name="selectedText">Redirection for text selected states requests.</param>
/// <param name="focusOverrideText">Redirection for text focus override state requests.</param>
public PaletteRedirectRibbonDouble(IPalette target,
IPaletteRibbonBack disabledBack,
IPaletteRibbonBack normalBack,
IPaletteRibbonBack pressedBack,
IPaletteRibbonBack trackingBack,
IPaletteRibbonBack selectedBack,
IPaletteRibbonBack focusOverrideBack,
IPaletteRibbonText disabledText,
IPaletteRibbonText normalText,
IPaletteRibbonText pressedText,
IPaletteRibbonText trackingText,
IPaletteRibbonText selectedText,
IPaletteRibbonText focusOverrideText
)
: base(target)
{
// Remember state specific inheritance
_disabledBack = disabledBack;
_normalBack = normalBack;
_pressedBack = pressedBack;
_trackingBack = trackingBack;
_selectedBack = selectedBack;
_focusOverrideBack = focusOverrideBack;
_disabledText = disabledText;
_normalText = normalText;
_pressedText = pressedText;
_trackingText = trackingText;
_selectedText = selectedText;
_focusOverrideText = focusOverrideText;
}
开发者ID:ComponentFactory,项目名称:Krypton,代码行数:46,代码来源:PaletteRedirectRibbonDouble.cs
示例4: PaletteRedirectTriple
/// <summary>
/// Initialize a new instance of the PaletteRedirectTriple class.
/// </summary>
/// <param name="target">Initial palette target for redirection.</param>
/// <param name="disabled">Redirection for disabled state requests.</param>
/// <param name="normal">Redirection for normal state requests.</param>
/// <param name="tracking">Redirection for tracking state requests.</param>
public PaletteRedirectTriple(IPalette target,
IPaletteTriple disabled,
IPaletteTriple normal,
IPaletteTriple tracking)
: this(target, disabled, normal, null, tracking, null, null, null, null, null)
{
}
开发者ID:Cocotteseb,项目名称:Krypton,代码行数:14,代码来源:PaletteRedirectTriple.cs
示例5: GetBytesForImage
public static byte[] GetBytesForImage(byte[] pixels, int width, int height, IPalette palette)
{
int overhang = 0;// (4 - ((width * 4) % 4));
int stride = (width * 4) + overhang;
byte[] imgData = new byte[stride * height];
int curPosition = 0;
for (int i = 0; i < height; i++)
{
for (int x = 0; x < width; x++)
{
byte pixel = 0;
int idx = width * i + x;
if (idx < pixels.Length) pixel = pixels[idx];
if (pixel > 0)
{
byte[] rgb = palette.GetRGBBytesForPixel(pixel);
imgData[curPosition] = rgb[2];
imgData[curPosition + 1] = rgb[1];
imgData[curPosition + 2] = rgb[0];
imgData[curPosition + 3] = 0xFF;
}
curPosition += 4;
}
curPosition += overhang;
}
return imgData;
}
开发者ID:sikora507,项目名称:OpenC1,代码行数:29,代码来源:Helpers.cs
示例6: CreatePaletteBrush
public static Brush CreatePaletteBrush(IPalette palette, int width = 256)
{
const double dpi = 96;
WriteableBitmap bmp = new WriteableBitmap(width, 1,
dpi, dpi,
PixelFormats.Bgra32, null);
int[] pixels = new int[width];
for (int i = 0; i < width; i++)
{
double ratio = i / ((double)width);
Color color = palette.GetColor(ratio);
int argb = color.ToArgb();
pixels[i] = argb;
}
bmp.WritePixels(
new Int32Rect(0, 0, width, 1),
pixels,
bmp.BackBufferStride,
0);
return new ImageBrush(bmp);
}
开发者ID:XiBeichuan,项目名称:hydronumerics,代码行数:25,代码来源:ImageHelper.cs
示例7: AppButtonMenuProvider
/// <summary>
/// Initialize a new instance of the ContextMenuProvider class.
/// </summary>
/// <param name="viewManager">View manager used to organize keyboard events.</param>
/// <param name="menuCollection">Top level set of menu items.</param>
/// <param name="viewColumns">Stack used for adding new columns.</param>
/// <param name="palette">Local palette setting to use initially.</param>
/// <param name="paletteMode">Palette mode setting to use initially.</param>
/// <param name="redirector">Redirector used for obtaining palette values.</param>
/// <param name="needPaintDelegate">Delegate used to when paint changes occur.</param>
public AppButtonMenuProvider(ViewContextMenuManager viewManager,
KryptonContextMenuItemCollection menuCollection,
ViewLayoutStack viewColumns,
IPalette palette,
PaletteMode paletteMode,
PaletteRedirect redirector,
NeedPaintHandler needPaintDelegate)
{
// Store incoming state
_viewManager = viewManager;
_menuCollection = menuCollection;
_viewColumns = viewColumns;
_palette = palette;
_paletteMode = paletteMode;
_redirector = redirector;
_needPaintDelegate = needPaintDelegate;
// Create all other state
_parent = null;
_enabled = true;
_canCloseMenu = true;
_showHorz = KryptonContextMenuPositionH.After;
_showVert = KryptonContextMenuPositionV.Top;
_stateCommon = new PaletteContextMenuRedirect(redirector, needPaintDelegate);
_stateNormal = new PaletteContextMenuItemState(_stateCommon);
_stateDisabled = new PaletteContextMenuItemState(_stateCommon);
_stateHighlight = new PaletteContextMenuItemStateHighlight(_stateCommon);
_stateChecked = new PaletteContextMenuItemStateChecked(_stateCommon);
_redirectorImages = new PaletteRedirectContextMenu(redirector, new ContextMenuImages(needPaintDelegate));
}
开发者ID:Cocotteseb,项目名称:Krypton,代码行数:40,代码来源:AppButtonMenuProvider.cs
示例8: RenderActor
public static ActorTemplate RenderActor(ActorInfo info, TileSet tileset, IPalette p)
{
var image = RenderSprites.GetImage(info);
using (var s = GlobalFileSystem.OpenWithExts(image, tileset.Extensions))
{
var shp = new ShpReader(s);
var bitmap = RenderShp(shp, p);
try
{
using (var s2 = GlobalFileSystem.OpenWithExts(image + "2", tileset.Extensions))
{
var shp2 = new ShpReader(s2);
var roofBitmap = RenderShp(shp2, p);
using (var g = System.Drawing.Graphics.FromImage(bitmap))
g.DrawImage(roofBitmap, 0, 0);
}
}
catch { }
return new ActorTemplate
{
Bitmap = bitmap,
Info = info,
Appearance = info.Traits.GetOrDefault<EditorAppearanceInfo>()
};
}
}
开发者ID:Berzeger,项目名称:OpenRA,代码行数:30,代码来源:RenderUtils.cs
示例9: PaletteRedirectRibbonTabContent
/// <summary>
/// Initialize a new instance of the PaletteRedirectRibbonDouble class.
/// </summary>
/// <param name="target">Initial palette target for redirection.</param>
public PaletteRedirectRibbonTabContent(IPalette target)
: this(target,
null, null, null, null, null, null,
null, null, null, null, null, null,
null, null, null, null, null, null)
{
}
开发者ID:Cocotteseb,项目名称:Krypton,代码行数:11,代码来源:PaletteRedirectRibbonTabContent.cs
示例10: PaletteBorderToPalette
/// <summary>
/// Initialize a new instance of the PaletteBorderToPalette class.
/// </summary>
/// <param name="palette">Source for getting all values.</param>
/// <param name="style">Style of values required.</param>
public PaletteBorderToPalette(IPalette palette,
PaletteBorderStyle style)
{
// Remember inheritance
_palette = palette;
_style = style;
}
开发者ID:Cocotteseb,项目名称:Krypton,代码行数:12,代码来源:PaletteBorderToPalette.cs
示例11: GetVisible
/// <summary>
/// Gets the button visible value.
/// </summary>
/// <param name="palette">Palette to use for inheriting values.</param>
/// <returns>Button visibiliy.</returns>
public override bool GetVisible(IPalette palette)
{
// We do not show if the custom chrome is combined with composition,
// in which case the form buttons are handled by the composition
if (KryptonForm.ApplyComposition && KryptonForm.ApplyCustomChrome)
return false;
// The minimize button is never present on tool windows
switch (KryptonForm.FormBorderStyle)
{
case FormBorderStyle.FixedToolWindow:
case FormBorderStyle.SizableToolWindow:
return false;
}
// Have all buttons been turned off?
if (!KryptonForm.ControlBox)
return false;
// Has the minimize/maximize buttons been turned off?
if (!KryptonForm.MinimizeBox && !KryptonForm.MaximizeBox)
return false;
return true;
}
开发者ID:Cocotteseb,项目名称:Krypton,代码行数:30,代码来源:ButtonSpecFormWindowMin.cs
示例12: PaletteReference
public PaletteReference(string name, int index, IPalette palette, HardwarePalette hardwarePalette)
{
Name = name;
Palette = palette;
this.index = index;
this.hardwarePalette = hardwarePalette;
}
开发者ID:Roger-luo,项目名称:OpenRA,代码行数:7,代码来源:PaletteReference.cs
示例13: RenderResourceType
public static ResourceTemplate RenderResourceType(ResourceTypeInfo info, TileSet tileset, IPalette p)
{
var image = ResolveFilename(info.EditorSprite, tileset);
using (var s = GlobalFileSystem.Open(image))
{
// TODO: Do this properly
var shp = new ShpTDSprite(s);
var frame = shp.Frames.Last();
var bitmap = new Bitmap(frame.Size.Width, frame.Size.Height, PixelFormat.Format8bppIndexed);
bitmap.Palette = p.AsSystemPalette();
var data = bitmap.LockBits(bitmap.Bounds(),
ImageLockMode.WriteOnly, PixelFormat.Format8bppIndexed);
unsafe
{
var q = (byte*)data.Scan0.ToPointer();
var stride = data.Stride;
for (var i = 0; i < frame.Size.Width; i++)
for (var j = 0; j < frame.Size.Height; j++)
q[j * stride + i] = frame.Data[i + frame.Size.Width * j];
}
bitmap.UnlockBits(data);
return new ResourceTemplate { Bitmap = bitmap, Info = info, Value = shp.Frames.Count - 1 };
}
}
开发者ID:ushardul,项目名称:OpenRA,代码行数:28,代码来源:RenderUtils.cs
示例14: ButtonSpecToContent
/// <summary>
/// Initialize a new instance of the PageToTooltipMapping class.
/// </summary>
/// <param name="palette">Palette for sourcing information.</param>
/// <param name="buttonSpec">Source button spec instance.</param>
public ButtonSpecToContent(IPalette palette,
ButtonSpec buttonSpec)
{
Debug.Assert(palette != null);
Debug.Assert(buttonSpec != null);
_palette = palette;
_buttonSpec = buttonSpec;
}
开发者ID:Cocotteseb,项目名称:Krypton,代码行数:13,代码来源:ButtonSpecToContent.cs
示例15: GetEnabled
/// <summary>
/// Gets the button enabled state.
/// </summary>
/// <param name="palette">Palette to use for inheriting values.</param>
/// <returns>Button enabled state.</returns>
public override ButtonEnabled GetEnabled(IPalette palette)
{
// Has the minimize buttons been turned off?
if (!KryptonForm.MinimizeBox)
return ButtonEnabled.False;
return ButtonEnabled.True;
}
开发者ID:Cocotteseb,项目名称:Krypton,代码行数:13,代码来源:ButtonSpecFormWindowMin.cs
示例16: KryptonProfessionalCustomKCT
/// <summary>
/// Initialize a new instance of the KryptonProfessionalCustomKCT class.
/// </summary>
/// <param name="headerColors">Set of header colors to customize with.</param>
/// <param name="colorTableColors">Set of ColorTable colors to customize with.</param>
/// <param name="useSystemColors">Should be forced to use system colors.</param>
/// <param name="palette">Associated palette instance.</param>
public KryptonProfessionalCustomKCT(Color[] headerColors,
Color[] colorTableColors,
bool useSystemColors,
IPalette palette)
: base(headerColors, useSystemColors, palette)
{
_colors = colorTableColors;
}
开发者ID:Cocotteseb,项目名称:Krypton,代码行数:15,代码来源:KryptonProfessionalCustomKCT.cs
示例17: PaletteRedirectDouble
/// <summary>
/// Initialize a new instance of the PaletteRedirectDouble class.
/// </summary>
/// <param name="target">Initial palette target for redirection.</param>
/// <param name="disabled">Redirection for disabled state requests.</param>
/// <param name="normal">Redirection for normal state requests.</param>
/// <param name="pressed">Redirection for pressed state requests.</param>
/// <param name="tracking">Redirection for tracking state requests.</param>
public PaletteRedirectDouble(IPalette target,
IPaletteDouble disabled,
IPaletteDouble normal,
IPaletteDouble pressed,
IPaletteDouble tracking)
: this(target, disabled, normal, pressed, tracking, null, null, null, null, null)
{
}
开发者ID:Cocotteseb,项目名称:Krypton,代码行数:16,代码来源:PaletteRedirectDouble.cs
示例18: PaletteRedirectContextMenu
/// <summary>
/// Initialize a new instance of the PaletteRedirectContextMenu class.
/// </summary>
/// <param name="target">Initial palette target for redirection.</param>
/// <param name="images">Reference to source of context menu images.</param>
public PaletteRedirectContextMenu(IPalette target,
ContextMenuImages images)
: base(target)
{
Debug.Assert(images != null);
// Remember incoming target
_images = images;
}
开发者ID:Cocotteseb,项目名称:Krypton,代码行数:14,代码来源:PaletteRedirectContextMenu.cs
示例19: PaletteRedirectDropDownButton
/// <summary>
/// Initialize a new instance of the PaletteRedirectDropDownButton class.
/// </summary>
/// <param name="target">Initial palette target for redirection.</param>
/// <param name="images">Reference to source of drop down button images.</param>
public PaletteRedirectDropDownButton(IPalette target,
DropDownButtonImages images)
: base(target)
{
Debug.Assert(images != null);
// Remember incoming target
_images = images;
}
开发者ID:ComponentFactory,项目名称:Krypton,代码行数:14,代码来源:PaletteRedirectDropDownButton.cs
示例20: KryptonProfessionalKCT
/// <summary>
/// Initialize a new instance of the KryptonProfessionalKCT class.
/// </summary>
/// <param name="colors">Set of colors to customize with.</param>
/// <param name="useSystemColors">Should be forced to use system colors.</param>
/// <param name="palette">Reference to associated palette.</param>
public KryptonProfessionalKCT(Color[] colors,
bool useSystemColors,
IPalette palette)
: base(palette)
{
Debug.Assert(colors != null);
_colors = colors;
UseSystemColors = useSystemColors;
}
开发者ID:Cocotteseb,项目名称:Krypton,代码行数:15,代码来源:KryptonProfessionalKCT.cs
注:本文中的IPalette类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论