/// <summary> /// Determines whether a pixel /// instance is a yellow-dot /// </summary> private static bool IsYellowDot(ImGearDIB igDIB, int x_position, int y_position) { const int redChannel = 0; const int greenChannel = 1; const int blueChannel = 2; int red, green, blue; ///////////////////////////////////////////////////////////////////////////////////////////////////////// // This remainder of this function will be left for contestants to implement // // Hint: // Gets a pixel from the ImGearDIB instance. // https://help.accusoft.com/ImageGear-Net/v24.11/Windows/HTML/webframe.html#topic3854.html // Sets variables red, green, and blue with their appropriate values from ImGearPixel instance. // https://help.accusoft.com/ImageGear-Net/v24.11/Windows/HTML/webframe.html#topic4189.html // // contestant implementation ------------------------------------------------------------------------------ ImGearPixel p = igDIB.GetPixelCopy(x_position, y_position); red = p[0]; green = p[1]; blue = p[2]; // end contestant implementation -------------------------------------------------------------------------- ///////////////////////////////////////////////////////////////////////////////////////////////////////// CMYKColor cmyk = new CMYKColor(red, green, blue); return(YellowThreshold(cmyk.yellow)); }
static void WriteColumn(ImGearRasterPage outPage, int xCoordinate, int value) { var pixel = new ImGearPixel(3, 8); pixel[0] = pixel[1] = pixel[2] = value; // Write a pixel value to each y-coordinate, given an x-coordinate (ie. write a full column of the same pixel) // <code here> }
//This function should return an ImGearPage that contains the extracted hidden image public static ImGearPage ExtractHiddenImage(ImGearPage mergedImage) { int bitNum = 1; int bitShift = mergedImage.DIB.BitsPerChannel - bitNum; int bitMask = 0xFF >> bitShift; int imageWidth = mergedImage.DIB.Width; int imageHeight = mergedImage.DIB.Height; // initialize blank ImGearRasterPage ImGearPage hidden = new ImGearRasterPage(imageWidth, imageHeight, new ImGearColorSpace(ImGearColorSpaceIDs.RGBA), new int[] { 8, 8, 8, 8 }, true); // For Each Pixel for (int x = 0; x < imageWidth; ++x) { for (int y = 0; y < imageHeight; ++y) { // Copy Pixel ImGearPixel s = mergedImage.DIB.GetPixelCopy(x, y); ImGearPixel p = new ImGearPixel(4, 8); //For Each Channel for (int c = 0; c < 3; ++c) { // Get Low bit bool bit = (s[c] & (1 << 0)) != 0; // Set to Either 1 or 0 Followed by 7 0s if (bit) { p[c] = 128; //10000000 } else { p[c] = 0; //0000000 } } // Keep Alpha Channel Intact p[3] = 255; // Set the Pixel hidden.DIB.UpdatePixelFrom(x, y, p); } } // Return Extracted Image return(hidden); }