public void InitColorMap(IEnumerable <Color> colors, IImageParams destination) { var colorList = colors as IList <Color> ?? colors.ToList(); if (HasColorMap(destination) && _colorMap.ContainsColors(colorList)) { return; } if (_colorMap != null) { _colorMap.Dispose(); } _colorMap = new ColorMap(colorList); _colorMapDestinationPixelFormat = destination.PixelFormat; _colorMapDestinationColorProfile = destination.ColorProfile; _colorMapTargetColorSpace = TargetColorSpace; foreach (var colorSpace in _colorMap.ColorSpaces) { var source = new ImageParams(GetPixelFormat(colorSpace), GetProfile(this, colorSpace)); using (var converter = GetColorConverter(this, source, destination)) { if (converter != null) { _colorMap.Convert(converter, colorSpace); } } } }
public async Task <IActionResult> AddImage([FromBody] AddImageViewModel model) { var user = await GetCurrentUserAsync(); var imagePath = ImageHelper.SaveImage(model.ImageData, model.Title); var imageParams = new ImageParams(user.Id, model.Title, model.Description, imagePath); var image = _imageService.CreateOrUpdate(imageParams); var imageModel = _mapper.Map <ImageListModel>(image); return(Ok(imageModel)); }
public static Color ConvertColor(ColorManagement colorManagement, Color color, IImageParams destination) { var result = GetColorFromColorMap(colorManagement, color, destination); if (result != null) { return(result); } var source = new ImageParams(color.PixelFormat, GetProfile(colorManagement, color.ColorSpace)); var colorConverter = GetColorConverter(colorManagement, source, destination); return(colorConverter != null?colorConverter.ConvertColor(color, source.ColorProfile) : color); }
public void WGSendToQQWithPhoto(eQQScene scene, ImageParams imageParams, string extraScene, string messageExt) { iOSConnector.SendToQQWithPhotoWithParams((int)scene, imageParams.ios_imageData, imageParams.ios_imageDataLen, extraScene, messageExt); }
public static RgbColor GetPreviewColor(ColorManagement colorManagement, Color color) { var destination = new ImageParams(GetPixelFormat(ColorSpace.Rgb), GetSrgbProfile()); return((RgbColor)ConvertColor(colorManagement, color, destination)); }
public void InitPreviewColorMap(IEnumerable <Color> colors) { var destination = new ImageParams(PixelFormat.Format32bppArgb, GetSrgbProfile()); InitColorMap(colors, destination); }
public static ColorConverter GetColorConverter(ColorManagement colorManagement, IImageParams source, PixelFormat destinationPixelFormat, ColorProfile destinationProfile) { var destination = new ImageParams(destinationPixelFormat, destinationProfile); return(GetColorConverter(colorManagement, source, destination)); }
public static ColorConverter GetColorConverter(ColorManagement colorManagement, IImageParams source, PixelFormat destinationPixelFormat, bool isPreview = false) { var destination = new ImageParams(destinationPixelFormat, GetProfile(colorManagement, destinationPixelFormat.ColorSpace, isPreview)); return(GetColorConverter(colorManagement, source, destination)); }
public void WGSendToQQWithPhoto(eQQScene scene, ImageParams imageParams, string extraScene, string messageExt) { MsdkEvent.Instance.HandleShareNofify(dataGenerator.ShareData); }
public static void ApplyImage(CreateMeshContract inputParams, int index, ref Stream moldDataPtr, Logger logger) { var clickInput = inputParams.ClickInputs.ImageClickInputDetailsList[index]; var angle = inputParams.ClickInputs.Angles[index]; var imageAlterationParameters = new ImageAlterationParams { MoldPtDensity = inputParams.PtDensity, MinImageHeightRatio = inputParams.MinImageHeightRatio, PercentExtraWidth = inputParams.PercentExtraWidth, ImageFolder = inputParams.ImageFolder, InvalidColor = inputParams.InvalidColor, ResizeType = ResizeType.ComputeSizeBasedOnPtDensity, BottomPaddingPercent = inputParams.BottomPaddingPercent }; var imageParams = ImageProcessor.GetImageParams(inputParams.VariationIn3DCoordinates, inputParams.BackgroundStrippingParams, clickInput, angle, imageAlterationParameters); if (moldDataPtr == null) { moldDataPtr = CreateMoldDataStream(imageParams.Image.Width, imageParams.Image.Height, (float)inputParams.VariationIn3DCoordinates, inputParams.PtDensity, logger); } var processMoldParams = new ProcessMoldParams { MoldData = moldDataPtr, ImageParams = imageParams }; var imagesToObject = new ImagesToObject(processMoldParams, inputParams.LogFilePath); imagesToObject.ProcessImage(); #region track_changes_for_troubleshooting if (inputParams.SaveProcessedImages) { SaveProcessedImages(processMoldParams.ImageParams.Image, inputParams.ImageFolder, "ibmodeler3_modified_images", index, angle, logger); } var imageParamsToBeReused = false; if (AnalyzeMoldForDataLosses) { //if first time, just set values for subsequent use if (index == 0) { FirstImageParams = imageParams; imageParamsToBeReused = true; } else { var processMoldParamsForAnalysis = new ProcessMoldParams { MoldData = moldDataPtr, ImageParams = FirstImageParams, SetColorForRetainedPixels = false }; int pixelsWithAllPointsLost = MoldFileAnalyzerForImg.ProcessImage(processMoldParamsForAnalysis); if (pixelsWithAllPointsLost > 0) { SaveDataLossImages(FirstImageParams.Image, inputParams.ImageFolder, "ibmodeler3_data_loss_analysis", index, angle, pixelsWithAllPointsLost, logger); } } } #endregion //this will dispose off the image data from memory if (!imageParamsToBeReused) { imageParams.Dispose(); } logger.Log(string.Format("Image applied for camera at an angle of {0} degrees", Math.Round(angle * 180 / Math.PI, 2))); }
public void WGSendToQQWithPhoto(eQQScene scene, ImageParams imageParams, string extraScene, string messageExt) { AndroidConnector.SendToQQWithPhotoWithParams((int)scene, imageParams.android_imagePath, extraScene, messageExt); }