Example #1
0
        public static void DrawLine(Vector3 from, Vector3 to, System.Drawing.Color color)
        {
            var vertices = new PositionColored[2];
            vertices[0] = new PositionColored(Vector3.Zero, color.ToArgb());
            from = from.SwitchYZ();
            to = to.SwitchYZ();
            vertices[1] = new PositionColored(to - from, color.ToArgb());

            InternalRender(from);

            Drawing.Direct3DDevice.DrawUserPrimitives(PrimitiveType.LineList, vertices.Length / 2, vertices);
        }
 private void InternalSetColor(System.Drawing.Color value)
 {
     int status = SafeNativeMethods.Gdip.GdipSetSolidFillColor(new HandleRef(this, base.NativeBrush), value.ToArgb());
     if (status != 0)
     {
         throw SafeNativeMethods.Gdip.StatusException(status);
     }
     this.color = value;
 }
Example #3
0
        /// <summary>
        /// Convert a color to a string
        /// </summary>
        /// <param name="color">the windows forms color</param>
        /// <returns>the color in a string</returns>
        private static string ConvertColor(System.Drawing.Color color)
        {
            int i = color.ToArgb();
            byte r = (byte)((i >> 16) & 255);
            byte g = (byte)((i >> 8) & 255);
            byte b = (byte)(i & 255);

            RgbColor rgbColor = new RgbColor(r, g, b);
            return rgbColor.ToString();
        }
Example #4
0
 /// <summary>
 ///  ��ȡָ���������ļ���ָ��Key��ֵ
 /// </summary>
 /// <param name="szKeyName">��ȡ��Key����</param>
 /// <param name="defaultValue">ָ����Key������ʱ,���ص�ֵ</param>
 /// <returns>KeyÖµ</returns>
 public System.Drawing.Color Get(string szKeyName, System.Drawing.Color defaultValue)
 {
     try
     {
         int nColorValue = this.Get(szKeyName, defaultValue.ToArgb());
         return System.Drawing.Color.FromArgb(nColorValue);
     }
     catch
     {
         return defaultValue;
     }
 }
Example #5
0
		Vector3[] sphericalCoordinates = new Vector3[0]; // x = lat, y = lon, z = height

		/// <summary>
		/// Initializes a new instance of the <see cref= "T:WorldWind.Renderable.PathLine"/> class.
		/// </summary>
		/// <param name="name"></param>
		/// <param name="parentWorld"></param>
		/// <param name="terrainfileName"></param>
		/// <param name="heightAboveSurface"></param>
		/// <param name="lineColor"></param>
		public PathLine(string name, World parentWorld, string terrainfileName, float heightAboveSurface, 
			System.Drawing.Color lineColor) 
			: base(name, parentWorld.Position, Quaternion.RotationYawPitchRoll(0,0,0)) 
		{
			this._parentWorld = parentWorld;
			//this.terrainManager = terrainManager;
			this.terrainFileName = terrainfileName;
			this.heightAboveSurface = heightAboveSurface;
			this.lineColor = lineColor.ToArgb();
			
			if(this.terrainFileName == null)
			{
				this.isInitialized = true;
				this.isLoaded = true;
				this.linePoints = new CustomVertex.PositionColored[0];
				return;
			}
			
			FileInfo inFile = new FileInfo(this.terrainFileName);
			if(!inFile.Exists)
			{
				this.isInitialized = true;
				this.isLoaded = true;
				this.linePoints = new CustomVertex.PositionColored[0];
				return;
			}
			
			if(inFile.FullName.IndexOf('_') == -1)
			{
				return;
			}

			string[] parsedFileName = inFile.Name.Replace(".wwb","").Split('_');

			if(parsedFileName.Length < 5)
			{
				return;
			}
			else
			{
				this.north = (float)Int32.Parse(parsedFileName[1], CultureInfo.InvariantCulture);
				this.south = (float)Int32.Parse(parsedFileName[2], CultureInfo.InvariantCulture);
				this.west = (float)Int32.Parse(parsedFileName[3], CultureInfo.InvariantCulture);
				this.east = (float)Int32.Parse(parsedFileName[4], CultureInfo.InvariantCulture);
			}

			this.boundingBox = new BoundingBox( this.south, this.north, this.west, this.east, 
				(float)this._parentWorld.EquatorialRadius, 
				(float)this._parentWorld.EquatorialRadius + this.heightAboveSurface );
		}
        /// <summary>
        /// Get the image based on the moniker, backColor and dimensions
        /// </summary>
        public static Bitmap GetImage(ImageMoniker moniker, System.Drawing.Color backColor, int height, int width, bool scalingRequired)
        {
            m_attributes.Background = (uint)backColor.ToArgb();
            m_attributes.LogicalHeight = height;
            m_attributes.LogicalWidth = width;

            if (scalingRequired)
            {
                m_attributes.LogicalHeight = (int)(height * DpiHelper.LogicalToDeviceUnitsScalingFactorY);
                m_attributes.LogicalWidth = (int)(width * DpiHelper.LogicalToDeviceUnitsScalingFactorX);
            }

            IVsUIObject uIObjOK = ImageService.GetImage(moniker, m_attributes);
            Bitmap bitmap = (Bitmap)UIUtilities.GetObjectData(uIObjOK);
            bitmap.MakeTransparent(System.Drawing.Color.Magenta);

            return bitmap;
        }
Example #7
0
        internal void DrawPolylineFeature(Graphics g, System.Drawing.Point[] Points_array,
            int LinePattern, System.Drawing.Color LineColor, int LineWidth)
        {
            IntPtr drawPen;		// gdi pen
            IntPtr drawPen_old;		// gdi pen

            if (LinePattern == 2)
            {
                drawPen = (IntPtr)Win32.GDI.CreatePen(Win32.GDI.PS_GEOMETRIC, LineWidth, LineColor.ToArgb());
                drawPen_old = (IntPtr)Win32.GDI.SelectObject(m_hdc, drawPen);

                int count = Points_array.GetLength(0);
                Win32.GDI.Polyline(m_hdc, ref Points_array[0], count);

                Win32.GDI.SelectObject(m_hdc, drawPen_old);
                Win32.GDI.DeleteObject(drawPen);
            }
        }
Example #8
0
		/// <summary>
		/// Initializes a new instance of the <see cref= "T:WorldWind.Renderable.TerrainPath"/> class.
		/// </summary>
		/// <param name="name"></param>
		/// <param name="parentWorld"></param>
		/// <param name="minDisplayAltitude"></param>
		/// <param name="maxDisplayAltitude"></param>
		/// <param name="terrainFileName"></param>
		/// <param name="heightAboveSurface"></param>
		/// <param name="lineColor"></param>
		/// <param name="terrainAccessor"></param>
		public TerrainPath(
			string name, 
			World parentWorld, 
			double minDisplayAltitude, 
			double maxDisplayAltitude, 
			string terrainFileName, 
			float heightAboveSurface, 
			System.Drawing.Color lineColor,
			TerrainAccessor terrainAccessor) 
			: base(name, parentWorld.Position, Quaternion.RotationYawPitchRoll(0,0,0)) 
		{
			this._parentWorld = parentWorld;
			this._minDisplayAltitude = minDisplayAltitude;
			this._maxDisplayAltitude = maxDisplayAltitude;
			this.terrainFileName = terrainFileName;
			this.heightAboveSurface = heightAboveSurface;
			//this.terrainMapped = terrainMapped;
			this.lineColor = lineColor.ToArgb();
			this._terrainAccessor = terrainAccessor;
			this.RenderPriority = RenderPriority.LinePaths;
		}
Example #9
0
 public Message(uint account, string message, string to, string from, System.Drawing.Color color, uint type)
 {
     Buffer = new byte[32 + message.Length + to.Length + from.Length];
     fixed (byte* arg = Buffer)
     {
         *((ushort*)(arg)) = (ushort)(Buffer.Length);
         *((ushort*)(arg + 2)) = 1004;
         *((uint*)(arg + 4)) = (uint)color.ToArgb();
         *((uint*)(arg + 8)) = type;
         *((uint*)(arg + 12)) = account;
         *((byte*)(arg + 24)) = 4;
         *((byte*)(arg + 25)) = (byte)from.Length;
         for (ushort i = 0; i < from.Length; i++)
             *((byte*)(arg + 26 + i)) = (byte)from[i];
         *((byte*)(arg + 26) + from.Length) = (byte)to.Length;
         for (ushort i = 0; i < to.Length; i++)
             *((byte*)(arg + 27 + from.Length + i)) = (byte)to[i];
         *((byte*)(arg + 28) + from.Length + to.Length) = (byte)message.Length;
         for (ushort i = 0; i < message.Length; i++)
             *((byte*)(arg + 29 + from.Length + to.Length + i)) = (byte)message[i];
     }
     Text = message;
 }
Example #10
0
		/// <summary>
		/// Initializes a new instance of the <see cref= "T:WorldWind.Renderable.ShapeLayer"/> class.
		/// </summary>
		/// <param name="name"></param>
		/// <param name="parentWorld"></param>
		/// <param name="Altitude"></param>
		/// <param name="masterFilePath"></param>
		/// <param name="minDisplayAltitude"></param>
		/// <param name="maxDisplayAltitude"></param>
		/// <param name="font"></param>
		/// <param name="color"></param>
		/// <param name="scalarKey"></param>
		/// <param name="showBoundaries"></param>
		/// <param name="showFilledPolygons"></param>
		public ShapeLayer(
			string name,
			World parentWorld,
			double Altitude,
			string masterFilePath,
			double minDisplayAltitude,
			double maxDisplayAltitude,
			Font font,
			System.Drawing.Color color,
			string scalarKey,
			bool showBoundaries,
			bool showFilledPolygons) : base(name, parentWorld.Position, Quaternion.RotationYawPitchRoll(0,0,0))
		{
			this._parentWorld = parentWorld;
			this._Altitude = Altitude;
			this._masterFilePath = masterFilePath;
			this._minDisplayAltitude = minDisplayAltitude;
			this._maxDisplayAltitude = maxDisplayAltitude;
			this.drawingFont = font;
			this._color = color.ToArgb();
			this._scalarKey = scalarKey;
			this._showBoundaries = showBoundaries;
			this._showFilledPolygons = showFilledPolygons;
		}
        /// <summary>
        /// Draws an image using the specified flags and state on XP systems.
        /// </summary>
        /// <param name="hdc">Device context to draw to</param>
        /// <param name="index">Index of image to draw</param>
        /// <param name="x">X Position to draw at</param>
        /// <param name="y">Y Position to draw at</param>
        /// <param name="flags">Drawing flags</param>
        /// <param name="cx">Width to draw</param>
        /// <param name="cy">Height to draw</param>
        /// <param name="foreColor">Fore colour to blend with when using the 
        /// ILD_SELECTED or ILD_BLEND25 flags</param>
        /// <param name="stateFlags">State flags</param>
        /// <param name="glowOrShadowColor">If stateFlags include ILS_GLOW, then
        /// the colour to use for the glow effect.  Otherwise if stateFlags includes 
        /// ILS_SHADOW, then the colour to use for the shadow.</param>
        /// <param name="saturateColorOrAlpha">If stateFlags includes ILS_ALPHA,
        /// then the alpha component is applied to the icon. Otherwise if 
        /// ILS_SATURATE is included, then the (R,G,B) components are used
        /// to saturate the image.</param>
        public void DrawImage(
            IntPtr hdc,
            int index,
            int x,
            int y,
            ImageListDrawItemConstants flags,
            int cx,
            int cy,
            System.Drawing.Color foreColor,
            ImageListDrawStateConstants stateFlags,
            System.Drawing.Color saturateColorOrAlpha,
            System.Drawing.Color glowOrShadowColor
            )
        {
            IMAGELISTDRAWPARAMS pimldp = new IMAGELISTDRAWPARAMS();
            pimldp.hdcDst = hdc;
            pimldp.cbSize = Marshal.SizeOf(pimldp.GetType());
            pimldp.i = index;
            pimldp.x = x;
            pimldp.y = y;
            pimldp.cx = cx;
            pimldp.cy = cy;
            pimldp.rgbFg = Color.FromArgb(0,
                foreColor.R, foreColor.G, foreColor.B).ToArgb();
            Console.WriteLine("{0}", pimldp.rgbFg);
            pimldp.fStyle = (int)flags;
            pimldp.fState = (int)stateFlags;
            if ((stateFlags & ImageListDrawStateConstants.ILS_ALPHA) ==
                ImageListDrawStateConstants.ILS_ALPHA)
            {
                // Set the alpha:
                pimldp.Frame = (int)saturateColorOrAlpha.A;
            }
            else if ((stateFlags & ImageListDrawStateConstants.ILS_SATURATE) ==
                ImageListDrawStateConstants.ILS_SATURATE)
            {
                // discard alpha channel:
                saturateColorOrAlpha = Color.FromArgb(0,
                    saturateColorOrAlpha.R,
                    saturateColorOrAlpha.G,
                    saturateColorOrAlpha.B);
                // set the saturate color
                pimldp.Frame = saturateColorOrAlpha.ToArgb();
            }
            glowOrShadowColor = Color.FromArgb(0,
                glowOrShadowColor.R,
                glowOrShadowColor.G,
                glowOrShadowColor.B);
            pimldp.crEffect = glowOrShadowColor.ToArgb();
            if (iImageList == null)
            {
                pimldp.himl = hIml;
                int ret = ImageList_DrawIndirect(ref pimldp);
            }
            else
            {

                iImageList.Draw(ref pimldp);
            }
        }
Example #12
0
 internal virtual void Draw(Display.DisplayPipeline pipeline, System.Drawing.Color color, int thickness)
 {
   IntPtr pDisplayPipeline = pipeline.NonConstPointer();
   IntPtr ptr = ConstPointer();
   int argb = color.ToArgb();
   UnsafeNativeMethods.CRhinoDisplayPipeline_DrawCurve(pDisplayPipeline, ptr, argb, thickness);
 }
Example #13
0
 public void SetValue(System.Drawing.Color v)
 { UnsafeNativeMethods.Rdk_Variant_SetOnColorValue(NonConstPointer(), v.ToArgb()); }
    /// <summary>
    /// Draws scaled 2D text.  Note that x and y are in viewport coordinates
    /// (ranging from -1 to +1).  fXScale and fYScale are the size fraction 
    /// relative to the entire viewport.  For example, a fXScale of 0.25 is
    /// 1/8th of the screen width.  This allows you to output text at a fixed
    /// fraction of the viewport, even if the screen or window size changes.
    /// </summary>
    public void DrawTextScaled(float x, float y, float z, 
        float fXScale, float fYScale,
        System.Drawing.Color color,
        string text, RenderFlags flags)
    {
        if (device == null)
            throw new System.ArgumentNullException();

        // Set up renderstate
        savedStateBlock.Capture();
        drawTextStateBlock.Apply();
        device.VertexFormat = CustomVertex.TransformedColoredTextured.Format;
        device.PixelShader = null;
        device.SetStreamSource(0, vertexBuffer, 0);

        // Set filter states
        if ((flags & RenderFlags.Filtered) != 0) {
            samplerState0.MinFilter = TextureFilter.Linear;
            samplerState0.MagFilter = TextureFilter.Linear;
        }

        Viewport vp = device.Viewport;
        float xpos = (x+1.0f)*vp.Width/2;
        float ypos = (y+1.0f)*vp.Height/2;
        float sz = z;
        float rhw = 1.0f;
        float fLineHeight = (textureCoords[0,3] - textureCoords[0,1]) * textureHeight;

        // Adjust for character spacing
        xpos -= spacingPerChar * (fXScale*vp.Height)/fLineHeight;
        float fStartX = xpos;

        // Fill vertex buffer
        int numTriangles = 0;
        int realColor = color.ToArgb();
        int iv = 0;

        foreach (char c in text) {
            if (c == '\n') {
                xpos  = fStartX;
                ypos += fYScale*vp.Height;
            }

            if ((c-32) < 0 || (c-32) >= 128-32)
                continue;

            float tx1 = textureCoords[c-32,0];
            float ty1 = textureCoords[c-32,1];
            float tx2 = textureCoords[c-32,2];
            float ty2 = textureCoords[c-32,3];

            float w = (tx2-tx1)*textureWidth;
            float h = (ty2-ty1)*textureHeight;

            w *= (fXScale*vp.Height)/fLineHeight;
            h *= (fYScale*vp.Height)/fLineHeight;

            if (c != ' ') {
                fontVertices[iv++] = new CustomVertex.TransformedColoredTextured(new Vector4(xpos+0-0.5f,ypos+h-0.5f,sz,rhw), realColor, tx1, ty2);
                fontVertices[iv++] = new CustomVertex.TransformedColoredTextured(new Vector4(xpos+0-0.5f,ypos+0-0.5f,sz,rhw), realColor, tx1, ty1);
                fontVertices[iv++] = new CustomVertex.TransformedColoredTextured(new Vector4(xpos+w-0.5f,ypos+h-0.5f,sz,rhw), realColor, tx2, ty2);
                fontVertices[iv++] = new CustomVertex.TransformedColoredTextured(new Vector4(xpos+w-0.5f,ypos+0-0.5f,sz,rhw), realColor, tx2, ty1);
                fontVertices[iv++] = new CustomVertex.TransformedColoredTextured(new Vector4(xpos+w-0.5f,ypos+h-0.5f,sz,rhw), realColor, tx2, ty2);
                fontVertices[iv++] = new CustomVertex.TransformedColoredTextured(new Vector4(xpos+0-0.5f,ypos+0-0.5f,sz,rhw), realColor, tx1, ty1);
                numTriangles += 2;

                if (numTriangles*3 > (MaxNumfontVertices-6)) {
                    // Unlock, render, and relock the vertex buffer
                    vertexBuffer.SetData(fontVertices, 0, LockFlags.Discard);
                    device.DrawPrimitives(PrimitiveType.TriangleList , 0, numTriangles);
                    numTriangles = 0;
                    iv = 0;
                }
            }

            xpos += w - (2 * spacingPerChar) * (fXScale*vp.Height)/fLineHeight;
        }

        // Unlock and render the vertex buffer
        vertexBuffer.SetData(fontVertices, 0, LockFlags.Discard);
        if (numTriangles > 0)
            device.DrawPrimitives(PrimitiveType.TriangleList , 0, numTriangles);

        // Restore the modified renderstates
        savedStateBlock.Apply();
    }
Example #15
0
        /// <summary>
        /// Draws an image using the specified flags and state on XP systems.
        /// </summary>
        /// <param name="hdc">Device context to draw to</param>
        /// <param name="index">Index of image to draw</param>
        /// <param name="x">X Position to draw at</param>
        /// <param name="y">Y Position to draw at</param>
        /// <param name="flags">Drawing flags</param>
        /// <param name="cx">Width to draw</param>
        /// <param name="cy">Height to draw</param>
        /// <param name="foreColor">Fore colour to blend with when using the ILD_SELECTED or ILD_BLEND25 flags</param>
        /// <param name="stateFlags">State flags</param>
        /// <param name="saturateColorOrAlpha">If stateFlags includes ILS_ALPHA, then the alpha component is applied to the icon. Otherwise if 
        /// ILS_SATURATE is included, then the (R,G,B) components are used to saturate the image.</param>
        /// <param name="glowOrShadowColor">If stateFlags include ILS_GLOW, then the colour to use for the glow effect.  Otherwise if stateFlags includes 
        /// ILS_SHADOW, then the colour to use for the shadow.</param>
        public void DrawImage(
            IntPtr hdc,
            int index,
            int x,
            int y,
            ImageListDrawItemConstants flags,
            int cx,
            int cy,
            System.Drawing.Color foreColor,
            ImageListDrawStateConstants stateFlags,
            System.Drawing.Color saturateColorOrAlpha,
            System.Drawing.Color glowOrShadowColor)
        {
            IMAGELISTDRAWPARAMS pimldp = new IMAGELISTDRAWPARAMS();
            pimldp.HdcDst = hdc;
            pimldp.Size = Marshal.SizeOf(pimldp.GetType());
            pimldp.Index = index;
            pimldp.X = x;
            pimldp.Y = y;
            pimldp.CX = cx;
            pimldp.CY = cy;
            pimldp.ForegroundRgb = Color.FromArgb(0, foreColor.R, foreColor.G, foreColor.B).ToArgb();
            pimldp.Style = (int)flags;
            pimldp.State = (int)stateFlags;
            if ((stateFlags & ImageListDrawStateConstants.ILS_ALPHA) == ImageListDrawStateConstants.ILS_ALPHA)
            {
                // Set the alpha
                pimldp.Frame = (int)saturateColorOrAlpha.A;
            }
            else if ((stateFlags & ImageListDrawStateConstants.ILS_SATURATE) == ImageListDrawStateConstants.ILS_SATURATE)
            {
                // discard alpha channel:
                saturateColorOrAlpha = Color.FromArgb(0, saturateColorOrAlpha.R, saturateColorOrAlpha.G, saturateColorOrAlpha.B);

                // set the saturate color
                pimldp.Frame = saturateColorOrAlpha.ToArgb();
            }

            glowOrShadowColor = Color.FromArgb(0, glowOrShadowColor.R, glowOrShadowColor.G, glowOrShadowColor.B);

            pimldp.Effect = glowOrShadowColor.ToArgb();

            if (this.imageList == null)
            {
                pimldp.Himl = this.himl;

                int ret = ImageList_DrawIndirect(ref pimldp);
            }
            else
            {
                this.imageList.Draw(ref pimldp);
            }
        }
Example #16
0
 public bool PutColour(string name, System.Drawing.Color colour)
 {
     return EDDConfig.Instance.PutSettingInt("MapColour_" + name, colour.ToArgb());
 }
Example #17
0
 public bool SetColor(int id, System.Drawing.Color value)
 {
   IntPtr pThis = NonConstPointer();
   return UnsafeNativeMethods.CRhinoHistory_SetColor(pThis, id, value.ToArgb());
 }
 /// <summary>
 /// Draw a typical Rhino Curvature Graph.
 /// </summary>
 /// <param name="curve">Base curve for curvature graph.</param>
 /// <param name="color">Color of curvature graph.</param>
 /// <param name="hairScale">100 = true length, &gt; 100 magnified, &lt; 100 shortened.</param>
 /// <param name="hairDensity">&gt;= 0 larger numbers = more hairs (good default is 1).</param>
 /// <param name="sampleDensity">Between 1 and 10. Higher numbers draw smoother outer curves. (good default is 2).</param>
 public void DrawCurvatureGraph(Geometry.Curve curve, System.Drawing.Color color, int hairScale, int hairDensity, int sampleDensity)
 {
   int argb = color.ToArgb();
   IntPtr pCurve = curve.ConstPointer();
   UnsafeNativeMethods.CRhinoDisplayPipeline_DrawCurvatureGraph(m_ptr, pCurve, argb, hairScale, hairDensity, sampleDensity);
 }
 internal sealed override void Draw(DisplayPipeline pipeline, System.Drawing.Color color, int thickness)
 {
   IntPtr pDisplayPipeline = pipeline.NonConstPointer();
   int argb = color.ToArgb();
   IntPtr pCurveDisplay = CurveDisplay();
   UnsafeNativeMethods.CurveDisplay_Draw(pCurveDisplay, pDisplayPipeline, argb, thickness);
 }
 public void DrawSprite(DisplayBitmap bitmap, Point3d worldLocation, float size, System.Drawing.Color blendColor, bool sizeInWorldSpace)
 {
   IntPtr pBitmap = bitmap.NonConstPointer();
   UnsafeNativeMethods.CRhinoDisplayPipeline_DrawBitmap(m_ptr, pBitmap, worldLocation, size, blendColor.ToArgb(), sizeInWorldSpace);
 }
Example #21
0
        /// <summary>
        /// Set the border style around the range.
        /// </summary>
        /// <param name="Style">The border style</param>
        /// <param name="Color">The color of the border</param>
        public void BorderAround(ExcelBorderStyle Style, System.Drawing.Color Color)
        {            
            var addr=new ExcelAddress(_address);
            SetBorderAroundStyle(Style, addr);

            _ChangedEvent(this, new StyleChangeEventArgs(eStyleClass.BorderTop, eStyleProperty.Color, Color.ToArgb().ToString("X"), _positionID, new ExcelAddress(addr._fromRow, addr._fromCol, addr._fromRow, addr._toCol).Address));
            _ChangedEvent(this, new StyleChangeEventArgs(eStyleClass.BorderBottom, eStyleProperty.Color, Color.ToArgb().ToString("X"), _positionID, new ExcelAddress(addr._toRow, addr._fromCol, addr._toRow, addr._toCol).Address));
            _ChangedEvent(this, new StyleChangeEventArgs(eStyleClass.BorderLeft, eStyleProperty.Color, Color.ToArgb().ToString("X"), _positionID, new ExcelAddress(addr._fromRow, addr._fromCol, addr._toRow, addr._fromCol).Address));
            _ChangedEvent(this, new StyleChangeEventArgs(eStyleClass.BorderRight, eStyleProperty.Color, Color.ToArgb().ToString("X"), _positionID, new ExcelAddress(addr._fromRow, addr._toCol, addr._toRow, addr._toCol).Address));
        }
 public void DrawSprite(DisplayBitmap bitmap, Point2d screenLocation, float size, System.Drawing.Color blendColor)
 {
   IntPtr pBitmap = bitmap.NonConstPointer();
   UnsafeNativeMethods.CRhinoDisplayPipeline_DrawBitmap2(m_ptr, pBitmap, screenLocation, size, blendColor.ToArgb());
 }
        public static void DrawFilledBox(float x, float y, float w, float h, System.Drawing.Color Color)
        {
            Vector2[] vLine = new Vector2[2];

            line.GlLines = true;
            line.Antialias = false;
            line.Width = 1;

            vLine[0].X = x + w / 2;
            vLine[0].Y = y;
            vLine[1].X = x + w / 2;
            vLine[1].Y = y + h;

            line.Begin();
            line.Draw(vLine, Color.ToArgb());
            line.End();
        }
Example #24
0
 /// <summary>
 /// ctor.
 /// </summary>
 /// <param name="value">Value of the chart's segment.</param>
 /// <param name="color">Color of the segment.</param>
 /// <param name="label">Label of the segment.</param>        
 public PieChartSegment(double value, System.Drawing.Color color, string label)
 {
     Value = value;
     Label = label;
     Color = new BaseColor(color.ToArgb());
 }
Example #25
0
 public void SetColor(System.Drawing.Color color)
 {
     Clear();
     _rgb = color.ToArgb().ToString("X");
 }
 void SetColor(int which, System.Drawing.Color c)
 {
   IntPtr ptr = NonConstPointer();
   int argb = c.ToArgb();
   UnsafeNativeMethods.ON_3dmObjectAttributes_GetSetColor(ptr, which, true, argb);
 }
 internal override void Draw(DisplayPipeline pipeline, System.Drawing.Color color, int thickness)
 {
   IntPtr ptr = ConstPointer();
   IntPtr pDisplayPipeline = pipeline.NonConstPointer();
   int argb = color.ToArgb();
   UnsafeNativeMethods.ON_LineCurve_Draw(ptr, pDisplayPipeline, argb, thickness);
 }
 /// <summary>
 /// get color index
 /// </summary>
 /// <param name="c">color</param>
 /// <returns>index , if not found , return -1</returns>
 public int IndexOf( System.Drawing.Color c )
 {
     if (c.A == 0)
     {
         return -1;
     }
     if( c.A != 255 )
     {
         c = System.Drawing.Color.FromArgb( 255 , c );
     }
     for (int iCount = 0; iCount < myItems.Count; iCount++)
     {
         System.Drawing.Color color = (System.Drawing.Color)myItems[iCount];
         if (color.ToArgb() == c.ToArgb())
         {
             return iCount;
         }
     }
     return -1 ;
 }
 internal virtual void Draw(Display.DisplayPipeline pipeline, System.Drawing.Color color, int density)
 {
   IntPtr pDisplayPipeline = pipeline.NonConstPointer();
   IntPtr ptr = ConstPointer();
   int argb = color.ToArgb();
   UnsafeNativeMethods.CRhinoDisplayPipeline_DrawSurface(pDisplayPipeline, ptr, argb, density);
 }
Example #30
0
 private static unsafe void ReplaceTransparentPixelsWithTransparentKey(BitmapData bmpData, System.Drawing.Color transKey)
 {
     System.Drawing.Imaging.PixelFormat pixelFormat = bmpData.PixelFormat;
     if (System.Drawing.Imaging.PixelFormat.Format32bppArgb == pixelFormat || System.Drawing.Imaging.PixelFormat.Format32bppPArgb == pixelFormat)
     {
         int num1 = transKey.ToArgb();
         byte* numPtr1 = (byte*)bmpData.Scan0.ToPointer();
         int num2 = 0;
         while (num2 < bmpData.Height)
         {
             int* numPtr2 = (int*)numPtr1;
             int num3 = 0;
             while (num3 < bmpData.Width)
             {
                 if (((long)*numPtr2 & 4278190080L) == 0L)
                     *numPtr2 = num1;
                 ++num3;
                 ++numPtr2;
             }
             ++num2;
             numPtr1 += bmpData.Stride;
         }
     }
     else
         Trace.TraceWarning("Not converting transparent colors to transparency key.");
 }