Files
Andy De George c0ba284473 Initial winforms content migrated (#18)
* Merge winforms framework content to working branch (#14)

* Breadcrumb / TOC / Move net5 to net folder (#15)

* change path from net5 to net

* Mess with bread/toc

* Mess with bread/toc

* Mess with bread/toc

* Mess with bread/toc

* Mess with bread/toc

* Mess with bread/toc

* Mess with bread/toc

* Mess with bread/toc

* Mess with bread/toc

* Mess with bread/toc

* Mess with bread/toc

* Mess with bread/toc

* Mess with bread/toc

* Mess with bread/toc

* Add .net 5 winforms placeholder article (#16)

* added some metadata and adjusted net5 placeholder

* corrections

* corrections

* corrections

* Test1

* Swapping landing page vs concept

* fix links

* Fix links

* Fix desc
2020-09-01 16:26:21 -07:00

2.2 KiB
Raw Permalink Blame History

title, ms.date, helpviewer_keywords, ms.assetid
title ms.date helpviewer_keywords ms.assetid
Alpha Blending Lines and Fills 03/30/2017
lines [Windows Forms], adding transparency
examples [Windows Forms], alpha blending
alpha blending [Windows Forms], using with lines
alpha blending
lines [Windows Forms], alpha blending
fills [Windows Forms], alpha blending
alpha blending [Windows Forms], using with fills
shapes [Windows Forms], adding transparency
5440f48c-3ac9-44c3-b170-c1c110bdbab8

Alpha Blending Lines and Fills

In GDI+, a color is a 32-bit value with 8 bits each for alpha, red, green, and blue. The alpha value indicates the transparency of the color — the extent to which the color is blended with the background color. Alpha values range from 0 through 255, where 0 represents a fully transparent color, and 255 represents a fully opaque color.

Alpha blending is a pixel-by-pixel blending of source and background color data. Each of the three components (red, green, blue) of a given source color is blended with the corresponding component of the background color according to the following formula:

displayColor = sourceColor × alpha / 255 + backgroundColor × (255 alpha) / 255

For example, suppose the red component of the source color is 150 and the red component of the background color is 100. If the alpha value is 200, the red component of the resultant color is calculated as follows:

150 × 200 / 255 + 100 × (255 200) / 255 = 139

In This Section

How to: Draw Opaque and Semitransparent Lines
Shows how to draw alpha-blended lines.

How to: Draw with Opaque and Semitransparent Brushes
Explains how to alpha-blend with brushes.

How to: Use Compositing Mode to Control Alpha Blending
Describes how to control alpha blending using xref:System.Drawing.Drawing2D.CompositingMode.

How to: Use a Color Matrix to Set Alpha Values in Images
Explains how to use a xref:System.Drawing.Imaging.ColorMatrix object to control alpha blending.