public HatchBrush(HatchStyle style, Color foreground, Color background) { _hatchStyle = style; _foregroundColor = foreground; _backgroundColor = background; throw new NotImplementedException(); }
public GBrush(BrushStyle aStyle, HatchStyle hatchStyle, Colorref aColor, Guid uniqueID) { BrushStyle = aStyle; HatchStyle = hatchStyle; Color = aColor; UniqueID = uniqueID; }
public Captcha(int Width, int Height, HatchStyle TextStyle = HatchStyle.NarrowHorizontal, HatchStyle BackStyle = HatchStyle.DottedGrid) { this.Width = Width; this.Height = Height; this.TextStyle = TextStyle; this.BackStyle = BackStyle; }
public HatchBrush(HatchStyle hatchStyle, Color foreColor, Color backColor) { this.hatchStyle = hatchStyle; this.foreCol = foreColor; this.backCol = backColor; base.native = LibIGraph.CreateBrush_Hatch(hatchStyle, foreCol.ToArgb(), backCol.ToArgb()); }
public GradientStyle(HatchStyle hatch, Color fore, Color back) { Type = GradientType.HatchStyleGradient; FirstColor = fore; SecondColor = back; Hatch = hatch; }
protected void FillImageByHatch(Image img, HatchStyle s) { Graphics g = Graphics.FromImage(img); HatchBrush brush = new HatchBrush(s, Color.Black, Color.White); g.FillRectangle(brush, new Rectangle(0, 0, img.Width, img.Height)); g.Dispose(); }
// Constructor. public DrawingHatchBrush(HatchStyle style, System.Drawing.Color foreColor, System.Drawing.Color backColor) : base (foreColor) { this.style = style; this.foreColor = foreColor; this.backColor = backColor; }
public HatchBrush(HatchStyle hatchstyle, Color foreColor, Color backColor) { IntPtr brush = IntPtr.Zero; int status = SafeNativeMethods.Gdip.GdipCreateHatchBrush(unchecked((int) hatchstyle), foreColor.ToArgb(), backColor.ToArgb(), out brush); if (status != SafeNativeMethods.Gdip.Ok) throw SafeNativeMethods.Gdip.StatusException(status); SetNativeBrushInternal(brush); }
/// <summary> /// Initializes a new instance of the <c>HatchPattern</c> class. /// </summary> /// <param name="name">Pattern name, always stored as uppercase.</param> /// <param name="description">Description of the pattern (optional, this information is not saved in the dxf file). By default it will use the supplied name.</param> public HatchPattern(string name, string description = null) { this.name = name.ToUpper(); this.description = string.IsNullOrEmpty(description) ? name : description; this.style = HatchStyle.Normal; this.fill = this.name == "SOLID" ? HatchFillType.SolidFill : HatchFillType.PatternFill; this.type = HatchType.UserDefined; this.origin = Vector2.Zero; this.angle = 0.0; this.scale = 1.0; this.lineDefinitions = new List<HatchPatternLineDefinition>(); }
void SetDataSource(HatchStyle selected) { this.BeginUpdate(); Items.Clear(); foreach (HatchStyle o in Enum.GetValues(typeof(HatchStyle))) Items.Add(o); SelectedItem = selected; this.EndUpdate(); }
/// <summary> /// Constructor that takes a HatchStyle, BackColor and ForeColor as arguments. /// </summary> /// <param name="hs">HatchStyle to be used in the instance created.</param> /// <param name="cBack">BackColor to be used in the instance created.</param> /// <param name="cFore">ForeColor to be used in the instance created.</param> public EditorHatchStyleUI(HatchStyle hs, Color cBack, Color cFore) { InitializeComponent(); AddHatchStylesToListBox(); hsHatchStyle = hs; cHatchStyleBackColor = cBack; cHatchStyleForeColor = cFore; this.Width = 224; }
public GDIBrush(BrushStyle aStyle, HatchStyle hatchStyle, Colorref colorref, Guid uniqueID) : base(true, uniqueID) { fBrushStyle = aStyle; fHatchStyle = hatchStyle; fColor = colorref; fLogBrush = new LOGBRUSH32(); // Make sure to mask off the high order byte // or GDI will draw in black fLogBrush.lbColor = colorref & 0x00ffffff; fLogBrush.lbHatch = (int)hatchStyle; fLogBrush.lbStyle = (int)aStyle; IntPtr brushHandle = GDI32.CreateBrushIndirect(ref fLogBrush); SetHandle(brushHandle); }
public DrawingHatchBrush(IToolkit toolkit, HatchStyle style, System.Drawing.Color foreColor, System.Drawing.Color backColor) : base (toolkit, backColor) { this.foreColor = DrawingGraphics.ColorToWin32(foreColor); this.backColor = DrawingGraphics.ColorToWin32(backColor); IntPtr hBi; lock(typeof(DrawingHatchBrush)) { hBi = GetBitmap(style); } if (hBi != IntPtr.Zero) { hBrush = Win32.Api.CreatePatternBrush(hBi); } else //not one of the types we recognize, so make it a solid brush hBrush = DrawingSolidBrush.CreateSolidBrush(foreColor); }
public ChronodexSector(string[] timeData) { // basic fields _startTime = timeData[0].Trim(); _duration = Int32.Parse(timeData[1]); _focus = (FocusLevel)Int32.Parse(timeData[2]); _area = GetAreaFrom(timeData[3]); _description = timeData.Length > 4 ? String.Join("-", timeData.Skip(4)) : ""; _layedOut = false; _hatchType = _styles[0]; // derivative fields _angleBegin = Chronodex.angles[_startTime]; _angleEnd = _angleBegin + _duration * 7.5f; _angleMiddle = (_angleBegin + _angleEnd) / 2; _centralPoint = new PointF(615.0f + (float)Math.Cos(_angleMiddle * Math.PI / 180) * (144 + (Int32)_focus * 30), 509.0f + (float)Math.Sin(_angleMiddle * Math.PI / 180) * (144 + (Int32)_focus * 30)); _calloutEnd = new PointF(615.0f + (float)Math.Cos(_angleMiddle * Math.PI / 180) * 380, 509.0f + (float)Math.Sin(_angleMiddle * Math.PI / 180) * 380); _color = Chronodex.colors[_area]; }
// Get the bitmap corresponding to a particular hatch style. private static IntPtr GetBitmap(HatchStyle style) { IntPtr bitmap; // See if we have a cached bitmap for this style. if(((int)style) >= 0 && ((int)style) <= 52) { if (hatchBitmaps == null) { hatchBitmaps = new IntPtr[53]; } bitmap = hatchBitmaps[(int)style]; if (bitmap != IntPtr.Zero) { return bitmap; } } else { return IntPtr.Zero; } // Get the raw bits for the hatch bitmap. byte[] bits = GetBits(style); if(bits == null) { return IntPtr.Zero; } // Create the bitmap, cache it for later, and then return it. Array.Reverse(bits); bitmap = Win32.Api.CreateBitmap(16, 16, 1, 1, bits); hatchBitmaps[(int)style] = bitmap; return bitmap; }
internal extern static IntPtr Win32CreateHatchBrush(HatchStyle fnStyle, ref COLORREF color);
public HatchBrush(HatchStyle hatchstyle, Color foreColor, Color backColor) { Status status = GDIPlus.GdipCreateHatchBrush(hatchstyle, foreColor.ToArgb(), backColor.ToArgb(), out nativeObject); GDIPlus.CheckStatus(status); }
protected override void OnMouseDown(MouseEventArgs e) { for (short i = 0; i < items.Length; i++) { if (items[i].rect.Contains(e.Location)) { patternStyle = items[i].style; hasPatternStyle = i > 0; if (PatternPicked != null) PatternPicked(this, null); break; } } }
static internal extern Status GdipGetHatchStyle (IntPtr brush, out HatchStyle hatchstyle);
float getLineWidth(HatchStyle hbr) { return hatches_const[(int)hbr][2]; }
float getHatchHeight(HatchStyle hbr) { return hatches_const[(int)hbr][1]; }
public HatchBrush(HatchStyle hatchStyle, Color foreColor) : this(hatchStyle, foreColor, Color.Black) { }
public Element(DrawingElementEnum elementType, Point startPoint, Point endPoint, Font textFont, Color penColor, float penWidth, Color brushColor, HatchStyle hatchStyle, Color brushForeColor, String text) { this.ElementType = elementType; this.StartPoint = startPoint; this.EndPoint = endPoint; this.TextFont = textFont; this.PenColor = penColor; this.PenWidth = penWidth; this.BrushColor = brushColor; this.HatchStyle = hatchStyle; this.BrushForeColor = brushForeColor; this.Text = text; }
public void LoadWordOnScreen() { Graphics g = this.CreateGraphics(); lettersPositions.Clear(); button2.Visible = false; HatchStyle backStyle = new HatchStyle(); backStyle = HatchStyle.Cross; HatchBrush backgrndBrush = new HatchBrush(backStyle, Color.CadetBlue, Color.White); g.FillRectangle(backgrndBrush, new Rectangle(0, 0, 862, 561)); ClearKeyboard(); string word = null; try { word = words.GetWords()[playingWordNum]; } catch { return; } Random rand = new Random(); int numOfLetters = Convert.ToInt32(word.Length * 0.3); // количество начально открываемых букв ////////// подготовка коллекции начально открытых букв for (int i = 0; i < numOfLetters; i++) { int tmpRand = rand.Next(0, word.Length); if (!lettersPositions.Contains(tmpRand)) { lettersPositions.Add(tmpRand); } // если буква встречается несколько раз if (word.Count(x => x == word[tmpRand]) > 1) { for (int j = 0; j < word.Length; j++) { if (word[j] == word[tmpRand] && !lettersPositions.Contains(j)) { lettersPositions.Add(j); } } } } lettersPositions.Sort(); //////////// int xCoord = 390; int yCoord = 300; SolidBrush backBrush = new SolidBrush(Color.Coral); SolidBrush txtBrush = new SolidBrush(Color.Black); for (int i = 0; i < word.Length; i++) { string forDraw = "--"; if (lettersPositions.Any(x => x == i)) { forDraw = Convert.ToString(word[i]); } g.FillRectangle(backBrush, new Rectangle(xCoord, yCoord, 40, 40)); g.DrawString(forDraw, new Font("Arial", 30), txtBrush, xCoord - 2, yCoord - 2); xCoord += 45; } backBrush.Dispose(); txtBrush.Dispose(); g.Dispose(); }
public void SetHatchBrush(HatchStyle hs, Color fc) { SetHatchBrush(hs, fc, Color.Black); }
GdipCreateHatchBrush(HatchStyle hatchstyle, int forecol, int backcol, out GpHatch brush);
/// <summary> /// Initializes a new instance of the <c>Ring</c> class with a hatch pattern, and adds it to this <c>RingCollection</c>. /// </summary> /// <param name="size">The size of the ring.</param> /// <param name="hatchStyle">A <c>System.Drawing.Drawing2D.HatchStyle</c> enumeration value that specifies the style of hatching.</param> /// <param name="foreColor">Hatch lines color.</param> /// <param name="backColor">Background color.</param> /// <param name="borderColor">Border color.</param> /// <param name="borderSize">Border thickness (in pixels).</param> /// <remarks> /// Refer to <c>RingCollection</c> for a discussion of the coordinate system used by <c>size</c>. /// </remarks> public void Add(float size, HatchStyle hatchStyle, Color foreColor, Color backColor, Color borderColor, float borderSize) { Add(new Ring(size, hatchStyle, foreColor, backColor, borderColor, borderSize)); }
/// <summary> /// Initializes a new instance of the <c>Ring</c> class with a hatch pattern and no border, and adds it to this <c>RingCollection</c>. /// </summary> /// <param name="size">The size of the ring.</param> /// <param name="hatchStyle">A <c>System.Drawing.Drawing2D.HatchStyle</c> enumeration value that specifies the style of hatching.</param> /// <param name="foreColor">Hatch lines color.</param> /// <param name="backColor">Background color.</param> /// <remarks> /// Refer to <c>RingCollection</c> for a discussion of the coordinate system used by <c>size</c>. /// </remarks> public void Add(float size, HatchStyle hatchStyle, Color foreColor, Color backColor) { Add(new Ring(size, hatchStyle, foreColor, backColor)); }
public void Ctor_InvalidHatchStyle_ThrowsArgumentException(HatchStyle hatchStyle) { AssertExtensions.Throws <ArgumentException>("hatchstyle", null, () => new HatchBrush(hatchStyle, Color.Empty)); AssertExtensions.Throws <ArgumentException>("hatchstyle", null, () => new HatchBrush(hatchStyle, Color.Empty, Color.Empty)); }
void ComboBoxStyleSelectedIndexChanged(object sender, EventArgs e) { String type = comboBoxStyle.SelectedItem.ToString(); style = (HatchStyle)Enum.Parse( typeof(HatchStyle), type); }
public void FillRectangle(HatchStyle style, SolidColor hatchColor, SolidColor bgColor, float x, float y, float width, float height) { System.Drawing.Drawing2D.HatchBrush hb = this.resourceManager.GetHatchBrush(style, hatchColor, bgColor); this.g.FillRectangle(hb, x, y, width, height); }
public HatchBrush(HatchStyle hatchStyle, Color foreColor, Color backColor) { this.hatchStyle = hatchStyle; this.foreColor = foreColor; this.backColor = backColor; }
public HatchBrush(HatchStyle hatchstyle, Color foreColor, Color backColor) { HatchStyle = hatchstyle; ForegroundColor = foreColor; BackgroundColor = backColor; }
float getHatchWidth(HatchStyle hbr) { return hatches_const[(int)hbr][0]; }
public void FillRectangle(HatchStyle style, SolidColor hatchColor, SolidColor bgColor, Rectangle rect) { this.FillRectangle(style, hatchColor, bgColor, rect.X, rect.Y, rect.Width, rect.Height); }
static internal extern Status GdipCreateHatchBrush (HatchStyle hatchstyle, int foreColor, int backColor, out IntPtr brush);
public void DrawCaptcha(HttpContext context, string CaptchaText, int iWidth, int iHeight) { Random oRandom = new Random(); int[] aBackgroundNoiseColor = new int[] { 150, 150, 150 }; int[] aTextColor = new int[] { 0, 0, 0 }; int[] aFontEmSizes = new int[] { 15, 20, 25, 30, 35 }; string[] aFontNames = new string[] { "Comic Sans MS", "Arial", "Times New Roman", "Georgia", "Verdana", "Geneva" }; FontStyle[] aFontStyles = new FontStyle[] { FontStyle.Bold, FontStyle.Italic, FontStyle.Regular, FontStyle.Strikeout, FontStyle.Underline }; HatchStyle[] aHatchStyles = new HatchStyle[] { HatchStyle.BackwardDiagonal, HatchStyle.Cross, HatchStyle.DashedDownwardDiagonal, HatchStyle.DashedHorizontal, HatchStyle.DashedUpwardDiagonal, HatchStyle.DashedVertical, HatchStyle.DiagonalBrick, HatchStyle.DiagonalCross, HatchStyle.Divot, HatchStyle.DottedDiamond, HatchStyle.DottedGrid, HatchStyle.ForwardDiagonal, HatchStyle.Horizontal, HatchStyle.HorizontalBrick, HatchStyle.LargeCheckerBoard, HatchStyle.LargeConfetti, HatchStyle.LargeGrid, HatchStyle.LightDownwardDiagonal, HatchStyle.LightHorizontal, HatchStyle.LightUpwardDiagonal, HatchStyle.LightVertical, HatchStyle.Max, HatchStyle.Min, HatchStyle.NarrowHorizontal, HatchStyle.NarrowVertical, HatchStyle.OutlinedDiamond, HatchStyle.Plaid, HatchStyle.Shingle, HatchStyle.SmallCheckerBoard, HatchStyle.SmallConfetti, HatchStyle.SmallGrid, HatchStyle.SolidDiamond, HatchStyle.Sphere, HatchStyle.Trellis, HatchStyle.Vertical, HatchStyle.Wave, HatchStyle.Weave, HatchStyle.WideDownwardDiagonal, HatchStyle.WideUpwardDiagonal, HatchStyle.ZigZag }; //Creates an output Bitmap Bitmap oOutputBitmap = new Bitmap(iWidth, iHeight, PixelFormat.Format24bppRgb); Graphics oGraphics = Graphics.FromImage(oOutputBitmap); oGraphics.TextRenderingHint = TextRenderingHint.AntiAlias; //Create a Drawing area RectangleF oRectangleF = new RectangleF(0, 0, iWidth, iHeight); Brush oBrush = default(Brush); //Draw background (Lighter colors RGB 100 to 255) oBrush = new HatchBrush(aHatchStyles[oRandom.Next(aHatchStyles.Length - 1)], Color.FromArgb((oRandom.Next(100, 255)), (oRandom.Next(100, 255)), (oRandom.Next(100, 255))), Color.White); oGraphics.FillRectangle(oBrush, oRectangleF); System.Drawing.Drawing2D.Matrix oMatrix = new System.Drawing.Drawing2D.Matrix(); int i = 0; for (i = 0; i <= CaptchaText.Length - 1; i++) { oMatrix.Reset(); int iChars = CaptchaText.Length; int x = iWidth / (iChars + 1) * i; int y = iHeight / 2; //Rotate text Random oMatrix.RotateAt(oRandom.Next(-40, 40), new PointF(x, y)); oGraphics.Transform = oMatrix; //Draw the letters with Randon Font Type, Size and Color oGraphics.DrawString ( //Text CaptchaText.Substring(i, 1), //Random Font Name and Style new Font(aFontNames[oRandom.Next(aFontNames.Length - 1)], aFontEmSizes[oRandom.Next(aFontEmSizes.Length - 1)], aFontStyles[oRandom.Next(aFontStyles.Length - 1)]), //Random Color (Darker colors RGB 0 to 100) new SolidBrush(Color.FromArgb(oRandom.Next(0, 100), oRandom.Next(0, 100), oRandom.Next(0, 100))), x, oRandom.Next(10, 40) ); oGraphics.ResetTransform(); } MemoryStream oMemoryStream = new MemoryStream(); oOutputBitmap.Save(oMemoryStream, System.Drawing.Imaging.ImageFormat.Png); byte[] oBytes = oMemoryStream.GetBuffer(); oOutputBitmap.Dispose(); oMemoryStream.Close(); context.Response.BinaryWrite(oBytes); context.Response.End(); }
/// <summary> /// Creates a new HatchPattern with the specified image /// </summary> /// <param name="style">The hatch style to use</param> ///<param name="foreColor">the forecolor to use</param> ///<param name="backColor">the background color to use</param> public HatchPattern(HatchStyle style, Color foreColor, Color backColor) { HatchStyle = style; _foreColor = foreColor; _backColor = backColor; }
public override void CalculateValues() { foreach (string name in Properties.Keys) { string value = Properties[name]; switch (name) { case "background-color": _backgroundColor = ParseColor(value); break; case "shape": _shape = (ShapeStyle)Enum.Parse(typeof(ShapeStyle), value); break; case "color": _foregroundColor = ParseColor(value); break; case "border-style": _borderStyle = (BorderStyle)Enum.Parse(typeof(BorderStyle), value); break; case "border-width": _borderWidth = float.Parse(value, CultureInfo.InvariantCulture); break; case "border-color": _borderColor = ParseColor(value); break; case "fill-style": _fillStyle = (FillStyle)Enum.Parse(typeof(FillStyle), value); break; case "hatch-style": _hatchStyle = (HatchStyle)Enum.Parse(typeof(HatchStyle), value); break; case "width": _width = float.Parse(value, CultureInfo.InvariantCulture); break; case "height": _height = float.Parse(value, CultureInfo.InvariantCulture); break; case "alpha": _alpha = int.Parse(value, CultureInfo.InvariantCulture); break; } } }
// Create a hatched toolkit brush. public virtual IToolkitBrush CreateHatchBrush (HatchStyle style, Color foreColor, Color backColor) { return(null); }
public HatchBrush(HatchStyle hatchstyle, Color foreColor) : this(hatchstyle, foreColor, Color.Black) { }
public static extern IntPtr CreateBrush_Hatch(HatchStyle hatchStyle, int foreCol, int backCol);
/// <summary> /// Initializes a new instance of the <see cref="HatchPattern"/> class. /// </summary> /// <param name="style">The hatch style to use.</param> /// <param name="foreColor">the forecolor to use.</param> /// <param name="backColor">the background color to use.</param> public HatchPattern(HatchStyle style, Color foreColor, Color backColor) { HatchStyle = style; _foreColor = foreColor; _backColor = backColor; }
internal extern static IntPtr Win32CreateHatchBrush(HatchStyle fnStyle, IntPtr color);
private void DrawBackground(HatchStyle hatchStyle) { //设置填充背景时用的笔刷 HatchBrush hBrush = new HatchBrush(hatchStyle, backColor); //填充背景图片 dc.FillRectangle(hBrush, 0, 0, this.bgWidth, this.bgHeight); }
public BrushInfo(BrushType brushType, HatchStyle hatchStyle) { this.brushType = brushType; this.hatchStyle = hatchStyle; }
GdipGetHatchStyle(GpHatch brush, out HatchStyle hatchstyle);