//// This code is part of Document Solutions for Imaging demos.// Copyright (c) MESCIUS inc. All rights reserved.//usingSystem.IO;usingSystem.Drawing;usingGrapeCity.Documents.Drawing;usingGrapeCity.Documents.Imaging; namespaceDsImagingWeb.Demos{// This sample demonstrates how to find and show pixels with clipped shadows. // This sample is identical to ShowLoClippingTiff but uses a JPEG image// rather than a TIFF created from the same source photo.publicclassShowLoClippingJpeg {publicGcBitmapGenerateImage(Size pixelSize, float dpi, bool opaque, string[] sampleParams = null) {var bmp = newGcBitmap(pixelSize.Width, pixelSize.Height, opaque, dpi, dpi);using (var bmpSrc = newGcBitmap(Path.Combine("Resources", "ImagesBis", "clivia.jpg"))) {// BitBlt requires the opacity of both images to be the same: bmpSrc.Opaque = opaque;// Render source image onto the target bitmap// (generally we might want to resize the source image first,// but in this case we just know that the source image has// the same size as the target, so skip this step): bmp.BitBlt(bmpSrc, 0, 0); using (var g = bmp.CreateGraphics()) {for (int i = 0; i < bmp.PixelWidth; ++i)for (int j = 0; j < bmp.PixelHeight; ++j) {// If all of the colors are 0x00, we change the pixel's color to magenta:if ((bmp[i, j] & 0x00FFFFFF) == 0) bmp[i, j] = 0xFFFF00FF; }// Draw the original image in the bottom right corner for reference:var rc = newRectangleF(0, 0, pixelSize.Width / 4, pixelSize.Height / 4); g.DrawImage(bmpSrc, rc, null, ImageAlign.StretchImage); g.DrawRectangle(rc, Color.LightGray); } }return bmp; } }}