Exemplo n.º 1
0
 public GmicImageListImageData()
 {
     width  = 0;
     height = 0;
     pixels = new GmicImageListPixelData();
     format = NativeImageFormat.Gray8;
 }
Exemplo n.º 2
0
        internal static void GmicImageListAdd(SafeGmicImageList list,
                                              uint width,
                                              uint height,
                                              GmicPixelFormat format,
                                              string name,
                                              out GmicImageListPixelData pixelData,
                                              out NativeImageFormat nativeImageFormat)
        {
            ValidateGmicImageList(list);

            pixelData         = new GmicImageListPixelData();
            nativeImageFormat = ConvertToNativeImageFormat(format);

            GmicStatus status = GmicNativeMethods.Instance.GmicImageListAdd(list,
                                                                            width,
                                                                            height,
                                                                            nativeImageFormat,
                                                                            string.IsNullOrWhiteSpace(name) ? null : name,
                                                                            pixelData);

            if (status != GmicStatus.Ok)
            {
                HandleError(status);
            }
        }
Exemplo n.º 3
0
 internal GmicStatus GmicImageListAdd(SafeGmicImageList list,
                                      uint width,
                                      uint height,
                                      NativeImageFormat format,
                                      string name,
                                      GmicImageListPixelData pixelData)
 {
     return(gmicImageListAdd(list, width, height, format, name, pixelData));
 }
Exemplo n.º 4
0
        /// <summary>
        /// Copies the pixel data from a G/MIC image into this instance.
        /// </summary>
        /// <param name="outputImageFormat">The output image format.</param>
        /// <param name="pixelData">The pixel data.</param>
        /// <param name="planeStride">The plane stride.</param>
        /// <exception cref="InvalidEnumArgumentException"><paramref name="outputImageFormat"/> is not valid.</exception>
        internal unsafe void CopyFromGmicImage(NativeImageFormat outputImageFormat, GmicImageListPixelData pixelData, int planeStride)
        {
            switch (outputImageFormat)
            {
            case NativeImageFormat.Gray8:
                CopyFromGmicImageGray(pixelData.redGrayUnion.gray, planeStride);
                break;

            case NativeImageFormat.GrayAlpha88:
                CopyFromGmicImageGrayAlpha(pixelData.redGrayUnion.gray, pixelData.alpha, planeStride);
                break;

            case NativeImageFormat.Rgb888:
                CopyFromGmicImageRGB(pixelData.redGrayUnion.red, pixelData.green, pixelData.blue, planeStride);
                break;

            case NativeImageFormat.Rgba8888:
                CopyFromGmicImageRGBA(pixelData.redGrayUnion.red, pixelData.green, pixelData.blue, pixelData.alpha, planeStride);
                break;

            default:
                throw new InvalidEnumArgumentException(nameof(outputImageFormat), (int)outputImageFormat, typeof(NativeImageFormat));
            }
        }