本文整理汇总了C#中IPalette类的典型用法代码示例。如果您正苦于以下问题:C# IPalette类的具体用法?C# IPalette怎么用?C# IPalette使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
IPalette类属于命名空间,在下文中一共展示了IPalette类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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];
}
示例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;
}
示例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;
}
示例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)
{
}
示例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;
}
示例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);
}
示例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));
}
示例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>()
};
}
}
示例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)
{
}
示例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;
}
示例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;
}
示例12: PaletteReference
public PaletteReference(string name, int index, IPalette palette, HardwarePalette hardwarePalette)
{
Name = name;
Palette = palette;
this.index = index;
this.hardwarePalette = hardwarePalette;
}
示例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 };
}
}
示例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;
}
示例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;
}