How can I grayscale a emf image - grayscale

Using C# and Visual Studio 2010, how can I make a grayscaled emf from a colored one? Should I enumerate records and change color settings somehow?
As a result I want to have a new emf image.

Here is an open source emf read/write utility. I don't think it can be done with GDI+ and preserve the vector content. So this hopefully will help you, but I haven't remotely tested all possible emf cases.
https://wmf.codeplex.com/
this works for both wmf and emf formats. We can combine the Oxage.Wmf strategy with the strategy from the other post which essentially re-colors a pen or brush when it is created so that anything drawn with that pen or brush should be gray.
using Oxage.Wmf;
using Oxage.Wmf.Records;
using Oxage.Wmf.Objects;
using System;
using System.Collections.Generic;
using System.Drawing;
using System.IO;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace MetafileTest
{
public class GrayMap
{
public void GrayFile(string sourceFile, string destFile){
WmfDocument wmf = new WmfDocument();
wmf.Load(sourceFile);
foreach (var record in wmf.Records)
{
if (record is WmfCreateBrushIndirectRecord)
{
var brush = record as WmfCreateBrushIndirectRecord;
brush.Color = Gray(brush.Color);
}
else if (record is WmfCreatePenIndirectRecord)
{
var pen = record as WmfCreatePenIndirectRecord;
pen.Color = Gray(pen.Color);
}
else if (record is WmfCreatePalette) {
var pal = record as WmfCreatePalette;
foreach (PaletteEntry entry in pal.Palette.PaletteEntries) {
Color test = Color.FromArgb(entry.Red, entry.Green, entry.Blue);
Color grayTest = Gray(test);
entry.Red = grayTest.R;
entry.Green = grayTest.G;
entry.Blue = grayTest.B;
}
}
}
wmf.Save(destFile);
}
public Color Gray(Color original) {
int r = (int)(original.R*0.2989);
int g = (int)(original.G*0.5870);
int b = (int)(original.B*0.1140);
Color result = Color.FromArgb(r, g, b);
return result;
}
}
}
This was tested with the following super simple case of filling a blue rectangle, so for at least the simple cases this will work. It may not be able to handle all cases, but in such a case you can probably extend the original source to suite your needs since it is open source.
private void button1_Click(object sender, EventArgs e)
{
var wmf = new WmfDocument();
wmf.Width = 1000;
wmf.Height = 1000;
wmf.Format.Unit = 288;
wmf.AddPolyFillMode(PolyFillMode.WINDING);
wmf.AddCreateBrushIndirect(Color.Blue, BrushStyle.BS_SOLID);
wmf.AddSelectObject(0);
wmf.AddCreatePenIndirect(Color.Black, PenStyle.PS_SOLID, 1);
wmf.AddSelectObject(1);
wmf.AddRectangle(100, 100, 800, 800);
wmf.AddDeleteObject(0);
wmf.AddDeleteObject(1);
wmf.Save("D:\\test.emf");
}
private void button2_Click(object sender, EventArgs e)
{
GrayMap map = new GrayMap();
map.GrayFile("D:\\test.emf", "D:\\test2.emf");
}

Related

Can't find sgfplib.dll

I trying to capture fingerprint via my C# code. I have referenced the secugen FDx Pro SDK for windows version 2.3.3.0 and have installed the drivers. Though I can not see the sgfplib.dll among the other dll files.
when I run the code trying to initialize the SGFingerPrintManager which uses sgfplib.dll, it complains that "sgfplib.dll can not be found" I have read the previous suggestion on this platform, but none solved the problems.
Please I appreciate in advance any suggestion to solve this problem sonnest.
Thanks in advance.
a) I have downloaded FDx Pro SDK for windows and the secugen drivers version 6.7 (64).
b) Also, I tried to copying the sgfplid.dll to the bin folder of my project but problem persists.
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
using LuggageTrackingAndBillingSystem.models;
using SecuGen.FDxSDKPro.Windows;
namespace LuggageTrackingAndBillingSystem
{
public partial class TsetForSecugen : Form
{
Int32 image_width = 200;
Int32 image_height = 300;
Int32 image_dpi = 500;
public TsetForSecugen()
{
InitializeComponent();
InitializeDedive();
}
private SGFingerPrintManager m_FPM;
SGFPMDeviceName device_name = SGFPMDeviceName.DEV_FDU03;
private void InitializeDedive()
{
//Step 1
if (RuntimePolicyHelper.LegacyV2RuntimeEnabledSuccessfully)
{
// This will load a CLR 2 mixed mode assembly
m_FPM = new SGFingerPrintManager();
}
var err = m_FPM.InitEx(image_width, image_height, image_dpi);
}
private void DrawImage(Byte[] imgData, PictureBox picBox)
{
int colorval;
Bitmap bmp = new Bitmap(image_width, image_height);
picBox.Image = (Image)bmp;
for (int i = 0; i < bmp.Width; i++)
{
for (int j = 0; j < bmp.Height; j++)
{
colorval = (int)imgData[(j * image_width) + i];
bmp.SetPixel(i, j, Color.FromArgb(colorval, colorval, colorval));
}
}
picBox.Refresh();
}
private void GetImage()
{
//Capturing Finger Image Step 3
Byte[] fp_image = new Byte[image_width * image_height];
Int32 iError;
iError = m_FPM.GetImage(fp_image);
if (iError == (Int32)SGFPMError.ERROR_NONE)
{
DrawImage(fp_image, pictureBox1);
}
}
private void TsetForSecugen_Load(object sender, EventArgs e)
{
InitializeDedive();
GetDevieInfo();
}
private void GetDevieInfo()
{
#region Det Device Info step 2
//Get Device info
SGFPMDeviceInfoParam pInfo = new SGFPMDeviceInfoParam();
pInfo = new SGFPMDeviceInfoParam();
Int32 iError = m_FPM.GetDeviceInfo(pInfo);
if (iError == (Int32)SGFPMError.ERROR_NONE)
{
image_width = pInfo.ImageWidth;
image_height = pInfo.ImageHeight;
}
#endregion
}
private void button1_Click(object sender, EventArgs e)
{
GetImage();
}
}
}
Actual result:The expected result is to be able to capture fingerpring
Error Meaage: Header[FDx SDK Pro.NET] . Body[can't find sgfplib.dll]
I have solved the issue by gotten the executable file of FDx SDK Pro for windows and installed.
The problem is caused by the FDx SDK Pro For windows not being able to see the sgfplib.dll file which is automatically installed in windows/System32 and Windows/sysWOW64 directories during installation.
Thanks to all.

App for printing Dymo labels disables scalling when print

I've made a little app for printing Dymo labels and it works as intended, but when I run it on my Surface tablet it disables scalling af I've pushed the print button. If reopened the scalling is correct till print button is pushed again.
Can anybody tell me why?
The print button only runs my LabelPrinter class which has the following code:
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Dymo;
using System.Windows.Forms;
namespace LabelPrinter
{
class LabelPrinter
{
private DymoAddInClass dymoAddIn;
private DymoLabelsClass dymoLabels;
private string labelPath, classRoom;
private int labelCount;
public LabelPrinter(string labelPath, string classRoom, int labelCount)
{
dymoAddIn = new DymoAddInClass();
dymoLabels = new DymoLabelsClass();
this.labelPath = labelPath;
this.classRoom = classRoom;
this.labelCount = labelCount;
}
public void printLabels()
{
dymoAddIn.SelectPrinter(dymoAddIn.GetDymoPrinters().Split('|')[0]);
if (dymoAddIn.Open(labelPath))
{
int firstNo = StaticMethods.getNextCodeEntryWithString(classRoom), lastNo = firstNo + labelCount;
dymoAddIn.StartPrintJob();
for (int i = firstNo; i < lastNo; i++)
{
foreach (string objName in dymoLabels.GetObjectNames(true).Split('|'))
{
dymoLabels.SetField(objName, classRoom + "_" + i);
}
dymoAddIn.Print(1, false);
}
dymoAddIn.EndPrintJob();
}
}
}
}

How to unite gameobject meshes?

Because of I made my house from the unity editor I can't remove this mesh borders. I tried MeshCombiner but it just connects all of the meshes in one mesh borders still exist. I know I can make it from Blender or something like this but is there any one to remove from unity?
Screen Shot: http://imgur.com/a/1XALE
Maybe you are looking for CombineMeshes. An example is
using UnityEngine;
using System.Collections;
[RequireComponent(typeof(MeshFilter))]
[RequireComponent(typeof(MeshRenderer))]
public class ExampleClass : MonoBehaviour {
void Start() {
MeshFilter[] meshFilters = GetComponentsInChildren<MeshFilter>();
CombineInstance[] combine = new CombineInstance[meshFilters.Length];
int i = 0;
while (i < meshFilters.Length) {
combine[i].mesh = meshFilters[i].sharedMesh;
combine[i].transform = meshFilters[i].transform.localToWorldMatrix;
meshFilters[i].gameObject.active = false;
i++;
}
transform.GetComponent<MeshFilter>().mesh = new Mesh();
transform.GetComponent<MeshFilter>().mesh.CombineMeshes(combine);
transform.gameObject.active = true;
}
}

SLIMDX antialising

I try to get the high qulity antialiasing from a tuturial I found on the internet (http://www.rkoenig.eu/index.php?option=com_content&view=article&id=21:chapter-3-das-erste-echte-3d-objekt&catid=6:directx10-basics&Itemid=3). But did not achieve a very good solution.
I already set the multisampling to the maximum:
m_swapChainDesc.SampleDescription = new DXGI.SampleDescription(8,0);
To me it appears as the pixel size of the rendered image is larger than the actual pixel size of my screen.
Thank you very much in advance for your valuable inputs
here is the complete code:
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;
using SlimDX;
using DX10 = SlimDX.Direct3D10;
using DXGI = SlimDX.DXGI;
namespace TutorialSeries.DirectX10.Chapter3
{
public partial class MainWindow : Form
{
private DX10.Device m_device;
private DXGI.SwapChainDescription m_swapChainDesc;
private DXGI.SwapChain m_swapChain;
private DXGI.Factory m_factory;
private DX10.RenderTargetView m_renderTarget;
private bool m_initialized;
private SimpleBox m_simpleBox;
private Matrix m_viewMatrix;
private Matrix m_projMatrix;
private Matrix m_worldMatrix;
private Matrix m_viewProjMatrix;
public MainWindow()
{
InitializeComponent();
this.SetStyle(ControlStyles.ResizeRedraw, true);
this.SetStyle(ControlStyles.AllPaintingInWmPaint, true);
this.SetStyle(ControlStyles.Opaque, true);
}
/// <summary>
/// Initializes device and other resources needed for rendering. Returns true, if successful.
/// </summary>
private bool Initialize3D()
{
try
{
m_device = new DX10.Device(DX10.DriverType.Warp, DX10.DeviceCreationFlags.SingleThreaded);
m_factory = new DXGI.Factory();
m_swapChainDesc = new DXGI.SwapChainDescription();
m_swapChainDesc.OutputHandle = this.Handle;
m_swapChainDesc.IsWindowed = true;
m_swapChainDesc.BufferCount = 1;
m_swapChainDesc.Flags = DXGI.SwapChainFlags.AllowModeSwitch;
m_swapChainDesc.ModeDescription = new DXGI.ModeDescription(
this.Width,
this.Height,
new Rational(60, 1),
DXGI.Format.R8G8B8A8_UNorm);
m_swapChainDesc.SampleDescription = new DXGI.SampleDescription(8,0);
m_swapChainDesc.SwapEffect = DXGI.SwapEffect.Discard;
m_swapChainDesc.Usage = DXGI.Usage.RenderTargetOutput;
m_swapChain = new DXGI.SwapChain(m_factory, m_device, m_swapChainDesc);
DX10.Viewport viewPort = new DX10.Viewport();
viewPort.X = 0;
viewPort.Y = 0;
viewPort.Width = this.Width;
viewPort.Height = this.Height;
viewPort.MinZ = 0f;
viewPort.MaxZ = 1f;
//DX10.Texture2D backBuffer = m_swapChain.GetBuffer<DX10.Texture2D>(0);
DX10.Texture2D Texture = DX10.Texture2D.FromSwapChain<DX10.Texture2D>(m_swapChain,0);
//m_renderTarget = new DX10.RenderTargetView(m_device, backBuffer);
//DX10.RenderTargetViewDescription renderDesc = new DX10.RenderTargetViewDescription();
//renderDesc.FirstArraySlice = 0;
//renderDesc.MipSlice = 0;
m_renderTarget = new DX10.RenderTargetView(m_device, Texture);
Texture.Dispose();
DX10.RasterizerStateDescription rsd = new DX10.RasterizerStateDescription();
rsd.CullMode = DX10.CullMode.Back;
rsd.FillMode = DX10.FillMode.Wireframe;
rsd.IsMultisampleEnabled = true;
rsd.IsAntialiasedLineEnabled = false;
rsd.IsDepthClipEnabled = false;
rsd.IsScissorEnabled = false;
DX10.RasterizerState RasterStateWireFrame = DX10.RasterizerState.FromDescription(m_device,rsd);
DX10.BlendStateDescription blendDesc = new DX10.BlendStateDescription();
blendDesc.BlendOperation = DX10.BlendOperation.Add;
blendDesc.AlphaBlendOperation = DX10.BlendOperation.Add;
blendDesc.SourceAlphaBlend = DX10.BlendOption.Zero;
blendDesc.DestinationAlphaBlend = DX10.BlendOption.Zero;
blendDesc.SourceBlend = DX10.BlendOption.SourceColor;
blendDesc.DestinationBlend = DX10.BlendOption.Zero;
blendDesc.IsAlphaToCoverageEnabled = false;
blendDesc.SetWriteMask(0, DX10.ColorWriteMaskFlags.All);
blendDesc.SetBlendEnable(0, true);
DX10.BlendState m_blendState = DX10.BlendState.FromDescription(m_device, blendDesc);
m_device.Rasterizer.State = RasterStateWireFrame;
m_device.Rasterizer.SetViewports(viewPort);
m_device.OutputMerger.BlendState = m_blendState;
m_device.OutputMerger.SetTargets(m_renderTarget);
m_viewMatrix = Matrix.LookAtLH(
new Vector3(0f, 0f, -4f),
new Vector3(0f, 0f, 1f),
new Vector3(0f, 1f, 0f));
m_projMatrix = Matrix.PerspectiveFovLH(
(float)Math.PI * 0.5f,
this.Width / (float)this.Height,
0.1f, 100f);
m_viewProjMatrix = m_viewMatrix * m_projMatrix;
m_worldMatrix = Matrix.RotationYawPitchRoll(0.85f, 0.85f, 0f);
m_simpleBox = new SimpleBox();
m_simpleBox.LoadResources(m_device);
m_initialized = true;
}
catch (Exception ex)
{
MessageBox.Show("Error while initializing Direct3D10: \n" + ex.Message);
m_initialized = false;
}
return m_initialized;
}
/// <summary>
/// Rendering is done during the standard OnPaint event
/// </summary>
protected override void OnPaint(PaintEventArgs e)
{
base.OnPaint(e);
if (m_initialized)
{
m_device.ClearRenderTargetView(m_renderTarget, new Color4(Color.CornflowerBlue));
m_simpleBox.Render(m_device, m_worldMatrix, m_viewProjMatrix);
m_swapChain.Present(0, DXGI.PresentFlags.None);
}
}
/// <summary>
/// Initialize 3D-Graphics within OnLoad event
/// </summary>
protected override void OnLoad(EventArgs e)
{
base.OnLoad(e);
Initialize3D();
}
}
}
This is an old question but it's a shame it never got answered; I stumbled across it on Google so I figure answering it may help someone else in the future...
First of all, Pascal, you did NOT set MSAA to the maximum... You're using 8:0, which means 8 samples at a quality of 0 (zero)... definitely not the maximum. What the "max" is depends on the GPU installed on the local machine. So it varies from PC to PC. That's why a DirectX application needs to use DXGI to properly enumerate hardware devices and determine what settings are valid. This is no trivial topic and will require you to do some research and practice of your own. The DirectX SDK Documentation and samples/tutorials are a great starting place, and there's a lot of other materials to be found online. But on my machine, for instance, my GTX-580 GPU can support 8:16 MSAA (possibly higher, but haven't checked).
So you need to learn to use DXGI to enumerate your graphics cards and monitors and figure out what MSAA levels (and other graphics features/settings) it can support. That's the only way you'll ever figure out the "max" MSAA settings or the correct refresh rate of your monitor, for example. If you're clever you will write yourself a small library or component for your game engine that will enumerate hardware devices for you and figure out the optimal graphics settings so you won't have to re-do this over and over for future projects.
Regards,
--ATC--

Is there an existing PropertyGrid UITypeEditor for type "ChartColorPalette"?

I'm trying to write a simple property grid to allow the users to modify the colours of a Chart. By default, a Chart has a "Palette" property, which is of the enumeration type "ChartColorPalette". If the object which underlies my property grid also has a "Palette" property of the same type, I get the drop-down list of possible values. What I don't get however, is the little stripey images to the left of the value names.
Now, I can write a UITypeEditor derived class and have the "PaintValue" draw little resource bitmaps which I have culled from the screen using "Paint" or somesuch, but this seems rather tedious.
Does anyone know if there is already a type editor for the "ChartColorPalette" enumeration which I can use to get the little bitmaps ?
as it happens, writing the UITypeEditor is not that tricky, and not that much code either.
Firstly I created a type editor that looked like this:
private class ChartColorPaletteEditor : UITypeEditor
{
public override bool GetPaintValueSupported(ITypeDescriptorContext context)
{
return true;
}
public override void PaintValue(PaintValueEventArgs e)
{
String paletteName = e.Value.ToString();
String baseName = this.GetType().Namespace + ".MyChart";
ResourceManager mgr = new ResourceManager(baseName, this.GetType().Assembly);
Bitmap bmp = mgr.GetObject(paletteName) as Bitmap;
if (bmp != null)
{
e.Graphics.DrawImage(bmp, e.Bounds);
bmp.Dispose();
}
}
}
I attached this to my control property in the usual way:
[DefaultValue(typeof(ChartColorPalette), "BrightPastel")]
[Editor(typeof(ChartColorPaletteEditor), typeof(System.Drawing.Design.UITypeEditor))]
[Category("Appearance")]
[Description("The named palette to use when choosing the colour scheme for the chart series lines.")]
public ChartColorPalette Palette { get; set; }
Then I added a small PNG resource for each of the little palette images. I had a derived control "MyChart" which inherited from "Chart" and I added the images to that as resources (making sure to set the "Persistance" property to "Embedded in .resx" to save having to keep the PNG files about). The names of the PNG files matched the names in the ChartColorPalette enumeration.
The only issue was where to get the little 20 x 14 images from. I originally just culled them using Paint.exe but didn't like that, so I wrote some code to generate them for me. That was fairly simple, once I had found the colour values that are used by the Charting control. One subtlety is that, where there are more than 12 colours in a palette, the little bitmap uses every other colour. That code looked like this:
using System;
using System.Drawing;
using System.Drawing.Imaging;
using System.IO;
using System.Reflection;
using System.Windows.Forms.DataVisualization.Charting;
namespace ConsoleApplication10
{
class Program
{
static void Main(string[] args)
{
Enum.GetValues(typeof(ChartColorPalette)).OfType<ChartColorPalette>().ToList().ForEach(GeneratePNG);
}
static void GeneratePNG(ChartColorPalette palette)
{
if (palette == ChartColorPalette.None) return;
Color[] colours = palette.GetColors();
if (colours.Length >= 12)
{
colours = new Color[] { colours[0], colours[2], colours[4], colours[6], colours[8], colours[10] };
}
else
{
colours = new Color[] { colours[0], colours[1], colours[2], colours[3], colours[4], colours[5] };
}
using (Bitmap bmp = new Bitmap(20, 14))
{
using (Graphics gr = Graphics.FromImage(bmp))
{
using (SolidBrush b1 = new SolidBrush(colours[0]),
b2 = new SolidBrush(colours[1]),
b3 = new SolidBrush(colours[2]),
b4 = new SolidBrush(colours[3]),
b5 = new SolidBrush(colours[4]),
b6 = new SolidBrush(colours[5]))
{
int height = bmp.Height - 2;
gr.DrawRectangle(Pens.Black, 0, 0, bmp.Width - 1, bmp.Height - 1);
gr.FillRectangle(b1, new Rectangle(1, 1, 3, height));
gr.FillRectangle(b2, new Rectangle(4, 1, 3, height));
gr.FillRectangle(b3, new Rectangle(7, 1, 3, height));
gr.FillRectangle(b4, new Rectangle(10, 1, 3, height));
gr.FillRectangle(b5, new Rectangle(13, 1, 3, height));
gr.FillRectangle(b6, new Rectangle(16, 1, 3, height));
}
}
String path = System.Environment.GetFolderPath(Environment.SpecialFolder.MyDocuments);
path = Path.Combine(path, #"Visual Studio 2010\Projects\DataVisualization.Charting\Palette Bitmaps");
String filename = palette.ToString() + ".png";
bmp.Save(Path.Combine(path, filename), ImageFormat.Png);
}
}
}
public static class Extensions
{
public static Color[] GetColors(this ChartColorPalette value)
{
switch (value)
{
case ChartColorPalette.Berry:
return GetColors(0x8a2be2, 0xba55d3, 0x4169e1, 0xc71585, 0x0000ff, 0x8a2be2, 0xda70d6, 0x7b68ee, 0xc000c0, 0x0000cd, 0x800080);
case ChartColorPalette.Bright:
return GetColors(0x008000, 0x0000ff, 0x800080, 0x00ff00, 0xff00ff, 0x008080, 0xffff00, 0x808080, 0x00ffff, 0x000080, 0x800000, 0xff0000, 0x808000, 0xc0c0c0, 0xff6347, 0xffe4b5);
case ChartColorPalette.BrightPastel:
return GetColors(0x418cf0, 0xfcb441, 0xe0400a, 0x056492, 0xbfbfbf, 0x1a3b69, 0xffe382, 0x129cdd, 0xca6b4b, 0x005cdb, 0xf3d288, 0x506381, 0xf1b9a8, 0xe0830a, 0x7893be);
case ChartColorPalette.Chocolate:
return GetColors(0xa0522d, 0xd2691e, 0x8b0000, 0xcd853f, 0xa52a2a, 0xf4a460, 0x8b4513, 0xc04000, 0xb22222, 0xb65c3a);
case ChartColorPalette.EarthTones:
return GetColors(0xff8000, 0xb8860b, 0xc04000, 0x6b8e23, 0xcd853f, 0xc0c000, 0x228b22, 0xd2691e, 0x808000, 0x20b2aa, 0xf4a460, 0x00c000, 0x8fbc8b, 0xb22222, 0x8b4513, 0xc00000);
case ChartColorPalette.Excel:
return GetColors(0x9999ff, 0x993366, 0xffffcc, 0xccffff, 0x660066, 0xff8080, 0x0066cc, 0xccccff, 0x000080, 0xff00ff, 0xffff00, 0x00ffff, 0x800080, 0x800000, 0x008080, 0x0000ff);
case ChartColorPalette.Fire:
return GetColors(0xffd700, 0xff0000, 0xff1493, 0xdc143c, 0xff8c00, 0xff00ff, 0xffff00, 0xff4500, 0xc71585, 0xdde221);
case ChartColorPalette.Grayscale:
return GetColors(0xc8c8c8, 0xbdbdbd, 0xb2b2b2, 0xa7a7a7, 0x9c9c9c, 0x919191, 0x868686, 0x7b7b7b, 0x707070, 0x656565, 0x5a5a5a, 0x4f4f4f, 0x444444, 0x393939, 0x2e2e2e, 0x232323);
case ChartColorPalette.Light:
return GetColors(0xe6e6fa, 0xfff0f5, 0xffdab9, 0xfffacd, 0xffe4e1, 0xf0fff0, 0xf0f8ff, 0xf5f5f5, 0xfaebd7, 0xe0ffff);
case ChartColorPalette.Pastel:
return GetColors(0x87ceeb, 0x32cd32, 0xba55d3, 0xf08080, 0x4682b4, 0x9acd32, 0x40e0d0, 0xff69b4, 0xf0e68c, 0xd2b48c, 0x8fbc8b, 0x6495ed, 0xdda0dd, 0x5f9ea0, 0xffdab9, 0xffa07a);
case ChartColorPalette.SeaGreen:
return GetColors(0x2e8b57, 0x66cdaa, 0x4682b4, 0x008b8b, 0x5f9ea0, 0x3cb371, 0x48d1cc, 0xb0c4de, 0xffffff, 0x87ceeb);
case ChartColorPalette.SemiTransparent:
return GetColors(0xff6969, 0x69ff69, 0x6969ff, 0xffff69, 0x69ffff, 0xff69ff, 0xcdb075, 0xffafaf, 0xafffaf, 0xafafff, 0xffffaf, 0xafffff, 0xffafff, 0xe4d5b5, 0xa4b086, 0x819ec1);
case ChartColorPalette.None:
default:
return GetColors(0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000);
}
}
private static Color[] GetColors(params Int32[] values)
{
return values.Select(value => Color.FromArgb(255, Color.FromArgb(value))).ToArray(); // alpha channel of 255 for fully opaque
}
}
}
Hope this is useful to someone out there...

Resources