- About Graphics Mill
- What's New?
- Breaking Changes in Graphics Mill 12
- Breaking Changes in Graphics Mill 11
- Features
- Supported File Formats
- System Requirements
- Getting Started
- Working with Image Formats
- Transforming Images (Resize, Rotate, Crop)
- Working with Metadata
- Color Management and Color Reduction
- Drawing Text and Graphics
- Color Keying (Green Screen Removal)
- Channels and Pixel Data
- Color and Tone Correction
- Working with Photoshop (PSD) Files
- Image Filters
- Processing Large Images
- Basics of Image Processing
- Troubleshooting
- Class Library Reference
- Aurigma.GraphicsMill Namespace
- AmbiguousFontCollisionException Class
- Bitmap Class
- Bitmap Members
- Bitmap Constructor
- Bitmap Methods
- Bitmap Operators
- Bitmap Properties
- Channels Property
- ColorAdjustment Property
- ColorManagement Property
- ColorProfile Property
- DpiX Property
- DpiY Property
- HasAlpha Property
- Height Property
- Ink Property
- IsEmpty Property
- Palette Property
- PixelFormat Property
- Scan0 Property
- Statistics Property
- Stride Property
- Transforms Property
- Width Property
- Bitmap Events
- BitmapEmptyException Class
- BitmapStatisticsProvider Class
- Channel Enumeration
- ChannelCombiner Class
- ChannelSplitter Class
- ChannelsProvider Class
- CMAdobeModuleLoadException Class
- CMException Class
- CMInappropriateProfileException Class
- CMOpenProfileException Class
- CMTransformException Class
- Cmyk16Color Class
- CmykChannelCombiner Class
- CmykChannelSplitter Class
- CmykColor Class
- CodecAdapter Class
- Color Class
- ColorAdjustmentProvider Class
- ColorManagementProvider Class
- ColorPalette Class
- ColorPaletteEmptyException Class
- ColorPaletteType Enumeration
- ColorProfile Class
- ColorProfileClass Enumeration
- ColorSpace Enumeration
- CompressedImage Class
- CompressedStream Class
- Configuration Class
- DuplicateFamilyStyleException Class
- DuplicateFontAliasException Class
- DuplicatePostscriptNameException Class
- FamilyStyleConflict Class
- FontException Class
- FontMissingException Class
- GMException Class
- GraphicsContainerRasterizer Class
- Grayscale16Color Class
- GrayscaleChannelCombiner Class
- GrayscaleChannelSplitter Class
- GrayscaleColor Class
- Histogram Class
- HistogramMode Enumeration
- IImageDescriptor Interface
- IImageParams Interface
- Image Class
- ImageGenerator Class
- ImageParams Class
- IndexedColor Class
- Ink Class
- InvalidPropertyValueException Class
- InvalidSourceException Class
- Lab16Color Class
- LabChannelCombiner Class
- LabChannelSplitter Class
- LabColor Class
- MissingIndexColorException Class
- ObjectClosedException Class
- ObjectEmptyException Class
- OnInitEventArgs Class
- OutOfMemoryException Class
- Pipeline Class
- PipelineElement Class
- PipelineException Class
- PixelFormat Class
- PostscriptNameConflict Class
- ProgressEventArgs Class
- ProgressReporter Class
- Rational Class
- Rgb16Color Class
- RgbChannelCombiner Class
- RgbChannelSplitter Class
- RgbColor Class
- SehException Class
- SpotColor Class
- TransformException Class
- TransformsProvider Class
- TrialPeriodTimeException Class
- UnexpectedException Class
- Unit Enumeration
- UnitConverter Class
- UnsignedRational Class
- UnsupportedFontException Class
- UnsupportedPixelFormatException Class
- Win32Exception Class
- Aurigma.GraphicsMill.Codecs Namespace
- Aurigma.GraphicsMill.Codecs.ClippingPath Namespace
- Aurigma.GraphicsMill.Codecs.Psd Namespace
- Aurigma.GraphicsMill.Drawing Namespace
- Aurigma.GraphicsMill.Drawing.Art Namespace
- Aurigma.GraphicsMill.Drawing.Effects Namespace
- Aurigma.GraphicsMill.Licensing Namespace
- Aurigma.GraphicsMill.Templates Namespace
- Aurigma.GraphicsMill.Transforms Namespace
- Aurigma.GraphicsMill Namespace
- Licensing
- End User License Agreement
- Copyright Notices
Bitmap.Stride Property
Gets the width (in bytes) of the scan line.
Namespace:
Aurigma.GraphicsMill
Assembly:
Aurigma.GraphicsMill (in Aurigma.GraphicsMill.dll)
Syntax
C#
public int Stride { get; }
Property Value
The width of the scan line.Remarks
Since the Width property returns a number of pixels in single scan line, this property contains number of bytes in a scan line. As scan line may be aligned on four-bytes boundary, stride may differ from bitmap data width multiplied on number of bytes per pixel. That's why you should use this property to move to the same position on the next row instead of any other methods.Examples
C#
using (var bitmap = new Bitmap(@"Images\in.jpg"))
{
unsafe
{
//A pointer to the beginning of the pixel data region
byte* pointer = (byte*)(bitmap.Scan0.ToPointer());
//Number of bytes in a row
int stride = bitmap.Stride;
//Number of rows
int height = bitmap.Height;
for (int i = 0; i < height; i++)
{
byte* position = pointer + stride * i;
for (int j = 0; j < stride; j++)
{
//Now we can modify the pixel, for example, invert it
*position = (byte)(255 - *position);
position++;
}
}
}
bitmap.Save(@"Images\Output\out.jpg");
}