public bool CopyFrom(object obj) { if (object.ReferenceEquals(this, obj)) { return(true); } var from = obj as DensityImagePlotStyle; if (null == from) { return(false); } using (var suspendToken = SuspendGetToken()) { _clipToLayer = from._clipToLayer; ColorProvider = from._colorProvider; Scale = (NumericalScale)from._scale.Clone(); _imageType = CachedImageType.None; EhSelfChanged(); suspendToken.Resume(); } return(true); }
private void BuildImageV1(IROMatrix <double> matrix) { _imageType = CachedImageType.LinearEquidistant; // look if the image has the right dimensions if (null != _cachedImage && (_cachedImage.Width != matrix.ColumnCount || _cachedImage.Height != matrix.RowCount)) { _cachedImage.Dispose(); _cachedImage = null; } GetPixelwiseImage(matrix, ref _cachedImage); }
protected override bool HandleHighPriorityChildChangeCases(object sender, ref EventArgs e) { if (object.ReferenceEquals(sender, _scale)) { _imageType = CachedImageType.None; } else if (object.ReferenceEquals(sender, _colorProvider)) { _imageType = CachedImageType.None; } return(base.HandleHighPriorityChildChangeCases(sender, ref e)); }
/// <summary> /// Gets an image from the cache manager. /// If the thumbnail image is not cached, it will be /// added to the cache queue and DefaultImage of the owner image list view will /// be returned. If the thumbnail could not be cached ErrorImage of the owner /// image list view will be returned. /// </summary> /// <param name="imageType">Type of cached image to return.</param> /// <returns>Requested thumbnail or icon.</returns> internal Image GetCachedImage(CachedImageType imageType) { if (mImageListView == null) throw new InvalidOperationException("Owner control is null."); if (imageType == CachedImageType.SmallIcon || imageType == CachedImageType.LargeIcon) { if (string.IsNullOrEmpty(extension)) return mImageListView.DefaultImage; CacheState state = mImageListView.shellInfoCache.GetCacheState(extension); if (state == CacheState.Cached) { if (imageType == CachedImageType.SmallIcon) return mImageListView.shellInfoCache.GetSmallIcon(extension); else return mImageListView.shellInfoCache.GetLargeIcon(extension); } else if (state == CacheState.Error) { if (mImageListView.RetryOnError) { mImageListView.shellInfoCache.Remove(extension); mImageListView.shellInfoCache.Add(extension); } return mImageListView.ErrorImage; } else { mImageListView.shellInfoCache.Add(extension); return mImageListView.DefaultImage; } } else { Image img = null; CacheState state = ThumbnailCacheState; if (state == CacheState.Error) { if (string.IsNullOrEmpty(extension)) return mImageListView.ErrorImage; if (mImageListView.ShellIconFallback && mImageListView.ThumbnailSize.Width > 32 && mImageListView.ThumbnailSize.Height > 32) img = mImageListView.shellInfoCache.GetLargeIcon(extension); if (img == null && mImageListView.ShellIconFallback) img = mImageListView.shellInfoCache.GetSmallIcon(extension); if (img == null) img = mImageListView.ErrorImage; return img; } img = mImageListView.thumbnailCache.GetImage(Guid, mImageListView.ThumbnailSize, mImageListView.UseEmbeddedThumbnails, mImageListView.AutoRotateThumbnails, mImageListView.UseWIC == UseWIC.Auto || mImageListView.UseWIC == UseWIC.ThumbnailsOnly, false); if (state == CacheState.Cached) return img; mImageListView.thumbnailCache.Add(Guid, mAdaptor, mVirtualItemKey, mImageListView.ThumbnailSize, mImageListView.UseEmbeddedThumbnails, mImageListView.AutoRotateThumbnails, (mImageListView.UseWIC == UseWIC.Auto || mImageListView.UseWIC == UseWIC.ThumbnailsOnly)); if (img == null && string.IsNullOrEmpty(extension)) return mImageListView.DefaultImage; if (img == null && mImageListView.ShellIconFallback && mImageListView.ThumbnailSize.Width > 16 && mImageListView.ThumbnailSize.Height > 16) img = mImageListView.shellInfoCache.GetLargeIcon(extension); if (img == null && mImageListView.ShellIconFallback) img = mImageListView.shellInfoCache.GetSmallIcon(extension); if (img == null) img = mImageListView.DefaultImage; return img; } }
// CoordinateSystem is not affine, or scales are non-linear private void BuildImageV3(Graphics gfrx, IPlotArea gl, IReadOnlyList <double> lx, IReadOnlyList <double> ly, IROMatrix <double> vcolumns) { // allocate a bitmap of same dimensions than the underlying layer _imageType = CachedImageType.Other; int dimX = (int)Math.Ceiling(gl.Size.X / 72.0 * gfrx.DpiX); int dimY = (int)Math.Ceiling(gl.Size.Y / 72.0 * gfrx.DpiY); dimX = Math.Min(2048, dimX); dimY = Math.Min(2048, dimY); // look if the image has the right dimensions if (null == _cachedImage || _cachedImage.Width != dimX || _cachedImage.Height != dimY) { if (null != _cachedImage) { _cachedImage.Dispose(); } // please notice: the horizontal direction of the image is related to the row index!!! (this will turn the image in relation to the table) // and the vertical direction of the image is related to the column index _cachedImage = new System.Drawing.Bitmap(dimX, dimY, System.Drawing.Imaging.PixelFormat.Format32bppArgb); } byte[] imageBytes = new byte[dimX * dimY * 4]; double widthByDimX = gl.Size.X / dimX; double heightByDimY = gl.Size.Y / dimY; var rel = new Logical3D(); double minRX = lx[0]; double maxRX = lx[lx.Count - 1]; double minRY = ly[0]; double maxRY = ly[ly.Count - 1]; if (minRX > maxRX) { double h = minRX; minRX = maxRX; maxRX = h; } if (minRY > maxRY) { double h = minRY; minRY = maxRY; maxRY = h; } var interpol = new BivariateLinearSpline(lx, ly, vcolumns); Color colorInvalid = _colorProvider.GetColor(double.NaN); int addr = 0; for (int ny = 0; ny < dimY; ny++) { double py = (ny + 0.5) * heightByDimY; for (int nx = 0; nx < dimX; nx++, addr += 4) { double px = (nx + 0.5) * widthByDimX; if (false == gl.CoordinateSystem.LayerToLogicalCoordinates(px, py, out rel)) { _cachedImage.SetPixel(nx, ny, colorInvalid); } else // conversion to relative coordinates was possible { double rx = rel.RX; double ry = rel.RY; if (rx < minRX || rx > maxRX || ry < minRY || ry > maxRY) { //_cachedImage.SetPixel(nx, ny, _colorInvalid); imageBytes[addr + 0] = colorInvalid.B; imageBytes[addr + 1] = colorInvalid.G; imageBytes[addr + 2] = colorInvalid.R; imageBytes[addr + 3] = colorInvalid.A; } else { double val = interpol.Interpolate(rx, ry); if (double.IsNaN(val)) { //_cachedImage.SetPixel(nx, ny, _colorInvalid); imageBytes[addr + 0] = colorInvalid.B; imageBytes[addr + 1] = colorInvalid.G; imageBytes[addr + 2] = colorInvalid.R; imageBytes[addr + 3] = colorInvalid.A; } else { //_cachedImage.SetPixel(nx, ny, GetColor(val)); Color c = GetColor(val); imageBytes[addr + 0] = c.B; imageBytes[addr + 1] = c.G; imageBytes[addr + 2] = c.R; imageBytes[addr + 3] = c.A; } } } } } // Lock the bitmap's bits. var rect = new Rectangle(0, 0, _cachedImage.Width, _cachedImage.Height); System.Drawing.Imaging.BitmapData bmpData = _cachedImage.LockBits(rect, System.Drawing.Imaging.ImageLockMode.WriteOnly, _cachedImage.PixelFormat); // Get the address of the first line. IntPtr ptr = bmpData.Scan0; // Copy the RGB values back to the bitmap System.Runtime.InteropServices.Marshal.Copy(imageBytes, 0, ptr, imageBytes.Length); _cachedImage.UnlockBits(bmpData); }
/// <summary> /// Paint the density image in the layer. /// </summary> /// <param name="gfrx">The graphics context painting in.</param> /// <param name="gl">The layer painting in.</param> /// <param name="plotObject">The data to plot.</param> public void Paint(Graphics gfrx, IPlotArea gl, object plotObject) // plots the curve with the choosen style { if (!(plotObject is XYZMeshedColumnPlotData)) { return; // we cannot plot any other than a TwoDimMeshDataAssociation now } var myPlotAssociation = (XYZMeshedColumnPlotData)plotObject; myPlotAssociation.DataTableMatrix.GetWrappers( gl.XAxis.PhysicalVariantToNormal, // transformation function for row header values Altaxo.Calc.RMath.IsFinite, // selection functiton for row header values gl.YAxis.PhysicalVariantToNormal, // transformation function for column header values Altaxo.Calc.RMath.IsFinite, // selection functiton for column header values out var matrix, out var logicalRowHeaderValues, out var logicalColumnHeaderValues ); int cols = matrix.ColumnCount; int rows = matrix.RowCount; if (cols <= 0 || rows <= 0) { return; // we cannot show a picture if one length is zero } // there is a need for rebuilding the bitmap only if the data are invalid for some reason // if the cached image is valid, then test if the conditions hold any longer switch (_imageType) { case CachedImageType.LinearEquidistant: { var memento = new ImageTypeEquiLinearMemento(gl); if (!memento.Equals(_imageConditionMemento)) { _imageType = CachedImageType.None; } } break; case CachedImageType.Other: { var memento = new ImageTypeOtherMemento(gl); if (!memento.Equals(_imageConditionMemento)) { _imageType = CachedImageType.None; } } break; } // now build the image // note that the image type can change during the call of BuildImage if (_imageType == CachedImageType.None || _cachedImage == null) { BuildImage(gfrx, gl, myPlotAssociation, matrix, logicalRowHeaderValues, logicalColumnHeaderValues); switch (_imageType) { case CachedImageType.LinearEquidistant: _imageConditionMemento = new ImageTypeEquiLinearMemento(gl); break; case CachedImageType.Other: _imageConditionMemento = new ImageTypeOtherMemento(gl); break; } } // and now draw the image { // Three tricks are neccessary to get the bitmap drawn smooth and uniformly: // Everything other than this will result in distorted image, or soft (unsharp) edges var graphicsState = gfrx.Save(); // Of course, save the graphics state so we can make our tricks undone afterwards gfrx.InterpolationMode = InterpolationMode.Default; // Trick1: Set the interpolation mode, whatever it was before, back to default gfrx.PixelOffsetMode = PixelOffsetMode.Default; // Trick2: Set the PixelOffsetMode, whatever it was before, back to default switch (_imageType) { case CachedImageType.LinearEquidistant: { double xOrgRel = logicalRowHeaderValues[0]; double xEndRel = logicalRowHeaderValues[rows - 1]; double yOrgRel = logicalColumnHeaderValues[0]; double yEndRel = logicalColumnHeaderValues[cols - 1]; bool isConvertible = true; isConvertible &= gl.CoordinateSystem.LogicalToLayerCoordinates(new Logical3D(xOrgRel, yEndRel), out var x0, out var y0); isConvertible &= gl.CoordinateSystem.LogicalToLayerCoordinates(new Logical3D(xOrgRel, yOrgRel), out var x1, out var y1); isConvertible &= gl.CoordinateSystem.LogicalToLayerCoordinates(new Logical3D(xEndRel, yEndRel), out var x2, out var y2); if (isConvertible) { if (_clipToLayer) { gfrx.Clip = gl.CoordinateSystem.GetRegion(); } var pts = new PointF[] { new PointF((float)x0, (float)y0), new PointF((float)x2, (float)y2), new PointF((float)x1, (float)y1) }; gfrx.DrawImage(_cachedImage, pts, new RectangleF(0, 0, _cachedImage.Width - 1, _cachedImage.Height - 1), GraphicsUnit.Pixel); // Trick3: Paint both in X and Y direction one pixel less than the source bitmap acually has, this prevents soft edges } } break; case CachedImageType.Other: { gfrx.DrawImage(_cachedImage, 0, 0, (float)gl.Size.X, (float)gl.Size.Y); } break; } gfrx.Restore(graphicsState); } }
/// <summary> /// Called by the parent plot item to indicate that the associated data has changed. Used to invalidate the cached bitmap to force /// rebuilding the bitmap from new data. /// </summary> /// <param name="sender">The sender of the message.</param> public void EhDataChanged(object sender) { _imageType = CachedImageType.None; EhSelfChanged(EventArgs.Empty); }
protected override bool HandleHighPriorityChildChangeCases(object sender, ref EventArgs e) { if (object.ReferenceEquals(sender, _scale)) { this._imageType = CachedImageType.None; } else if (object.ReferenceEquals(sender, _colorProvider)) { this._imageType = CachedImageType.None; } return base.HandleHighPriorityChildChangeCases(sender, ref e); }
/// <summary> /// Gets an image from the cache manager. /// If the thumbnail image is not cached, it will be /// added to the cache queue and DefaultImage of the owner image list view will /// be returned. If the thumbnail could not be cached ErrorImage of the owner /// image list view will be returned. /// </summary> /// <param name="imageType">Type of cached image to return.</param> /// <returns>Requested thumbnail or icon.</returns> public Image GetCachedImage(CachedImageType imageType) { if (mImageListView == null) { throw new InvalidOperationException("Owner control is null."); } string iconPath = null; if (imageType == CachedImageType.SmallIcon || imageType == CachedImageType.LargeIcon) { if (string.IsNullOrEmpty(iconPath)) { return(mImageListView.DefaultImage); } CacheState state = mImageListView.shellInfoCache.GetCacheState(iconPath); if (state == CacheState.Cached) { if (imageType == CachedImageType.SmallIcon) { return(mImageListView.shellInfoCache.GetSmallIcon(iconPath)); } else { return(mImageListView.shellInfoCache.GetLargeIcon(iconPath)); } } else if (state == CacheState.Error) { if (mImageListView.RetryOnError) { mImageListView.shellInfoCache.Remove(iconPath); mImageListView.shellInfoCache.Add(iconPath); } return(mImageListView.ErrorImage); } else { mImageListView.shellInfoCache.Add(iconPath); return(mImageListView.DefaultImage); } } else { Image img = null; CacheState state = ThumbnailCacheState; if (state == CacheState.Error) { if (mImageListView.ShellIconFallback && !string.IsNullOrEmpty(iconPath)) { CacheState iconstate = mImageListView.shellInfoCache.GetCacheState(iconPath); if (iconstate == CacheState.Cached) { if (mImageListView.ThumbnailSize.Width > 32 && mImageListView.ThumbnailSize.Height > 32) { img = mImageListView.shellInfoCache.GetLargeIcon(iconPath); } else { img = mImageListView.shellInfoCache.GetSmallIcon(iconPath); } } else if (iconstate == CacheState.Error) { if (mImageListView.RetryOnError) { mImageListView.shellInfoCache.Remove(iconPath); mImageListView.shellInfoCache.Add(iconPath); } } else { mImageListView.shellInfoCache.Add(iconPath); } } if (img == null) { img = mImageListView.ErrorImage; } return(img); } img = mImageListView.thumbnailCache.GetImage(Guid, mAdaptor, mVirtualItemKey, mImageListView.ThumbnailSize, mImageListView.UseEmbeddedThumbnails, mImageListView.AutoRotateThumbnails, mImageListView.UseWIC == UseWIC.Auto || mImageListView.UseWIC == UseWIC.ThumbnailsOnly, false); if (state == CacheState.Cached) { return(img); } mImageListView.thumbnailCache.Add(Guid, mAdaptor, mVirtualItemKey, mImageListView.ThumbnailSize, mImageListView.UseEmbeddedThumbnails, mImageListView.AutoRotateThumbnails, (mImageListView.UseWIC == UseWIC.Auto || mImageListView.UseWIC == UseWIC.ThumbnailsOnly)); if (img == null && string.IsNullOrEmpty(iconPath)) { return(mImageListView.DefaultImage); } if (img == null && mImageListView.ShellIconFallback && mImageListView.ThumbnailSize.Width > 16 && mImageListView.ThumbnailSize.Height > 16) { img = mImageListView.shellInfoCache.GetLargeIcon(iconPath); } if (img == null && mImageListView.ShellIconFallback) { img = mImageListView.shellInfoCache.GetSmallIcon(iconPath); } if (img == null) { img = mImageListView.DefaultImage; } return(img); } }
private void BuildImageV1(IROMatrix matrix) { _imageType = CachedImageType.LinearEquidistant; // look if the image has the right dimensions if (null != _cachedImage && (_cachedImage.Width != matrix.Columns || _cachedImage.Height != matrix.Rows)) { _cachedImage.Dispose(); _cachedImage = null; } GetPixelwiseImage(matrix, ref _cachedImage); }
// CoordinateSystem is not affine, or scales are non-linear private void BuildImageV3(Graphics gfrx, IPlotArea gl, IROVector lx, IROVector ly, IROMatrix vcolumns) { // allocate a bitmap of same dimensions than the underlying layer _imageType = CachedImageType.Other; int dimX = (int)Math.Ceiling(gl.Size.X / 72.0 * gfrx.DpiX); int dimY = (int)Math.Ceiling(gl.Size.Y / 72.0 * gfrx.DpiY); dimX = Math.Min(2048, dimX); dimY = Math.Min(2048, dimY); // look if the image has the right dimensions if (null == _cachedImage || _cachedImage.Width != dimX || _cachedImage.Height != dimY) { if (null != _cachedImage) _cachedImage.Dispose(); // please notice: the horizontal direction of the image is related to the row index!!! (this will turn the image in relation to the table) // and the vertical direction of the image is related to the column index _cachedImage = new System.Drawing.Bitmap(dimX, dimY, System.Drawing.Imaging.PixelFormat.Format32bppArgb); } byte[] imageBytes = new byte[dimX * dimY * 4]; double widthByDimX = gl.Size.X / dimX; double heightByDimY = gl.Size.Y / dimY; Logical3D rel = new Logical3D(); double minRX = lx[0]; double maxRX = lx[lx.Length - 1]; double minRY = ly[0]; double maxRY = ly[ly.Length - 1]; if (minRX > maxRX) { double h = minRX; minRX = maxRX; maxRX = h; } if (minRY > maxRY) { double h = minRY; minRY = maxRY; maxRY = h; } BivariateLinearSpline interpol = new BivariateLinearSpline(lx, ly, vcolumns); Color colorInvalid = _colorProvider.GetColor(double.NaN); int addr = 0; for (int ny = 0; ny < dimY; ny++) { double py = (ny + 0.5) * heightByDimY; for (int nx = 0; nx < dimX; nx++, addr += 4) { double px = (nx + 0.5) * widthByDimX; if (false == gl.CoordinateSystem.LayerToLogicalCoordinates(px, py, out rel)) { _cachedImage.SetPixel(nx, ny, colorInvalid); } else // conversion to relative coordinates was possible { double rx = rel.RX; double ry = rel.RY; if (rx < minRX || rx > maxRX || ry < minRY || ry > maxRY) { //_cachedImage.SetPixel(nx, ny, _colorInvalid); imageBytes[addr + 0] = colorInvalid.B; imageBytes[addr + 1] = colorInvalid.G; imageBytes[addr + 2] = colorInvalid.R; imageBytes[addr + 3] = colorInvalid.A; } else { double val = interpol.Interpolate(rx, ry); if (double.IsNaN(val)) { //_cachedImage.SetPixel(nx, ny, _colorInvalid); imageBytes[addr + 0] = colorInvalid.B; imageBytes[addr + 1] = colorInvalid.G; imageBytes[addr + 2] = colorInvalid.R; imageBytes[addr + 3] = colorInvalid.A; } else { //_cachedImage.SetPixel(nx, ny, GetColor(val)); Color c = GetColor(val); imageBytes[addr + 0] = c.B; imageBytes[addr + 1] = c.G; imageBytes[addr + 2] = c.R; imageBytes[addr + 3] = c.A; } } } } } // Lock the bitmap's bits. Rectangle rect = new Rectangle(0, 0, _cachedImage.Width, _cachedImage.Height); System.Drawing.Imaging.BitmapData bmpData = _cachedImage.LockBits(rect, System.Drawing.Imaging.ImageLockMode.WriteOnly, _cachedImage.PixelFormat); // Get the address of the first line. IntPtr ptr = bmpData.Scan0; // Copy the RGB values back to the bitmap System.Runtime.InteropServices.Marshal.Copy(imageBytes, 0, ptr, imageBytes.Length); _cachedImage.UnlockBits(bmpData); }
/// <summary> /// Paint the density image in the layer. /// </summary> /// <param name="gfrx">The graphics context painting in.</param> /// <param name="gl">The layer painting in.</param> /// <param name="plotObject">The data to plot.</param> public void Paint(Graphics gfrx, IPlotArea gl, object plotObject) // plots the curve with the choosen style { if (!(plotObject is XYZMeshedColumnPlotData)) return; // we cannot plot any other than a TwoDimMeshDataAssociation now XYZMeshedColumnPlotData myPlotAssociation = (XYZMeshedColumnPlotData)plotObject; IROMatrix matrix; IROVector logicalRowHeaderValues, logicalColumnHeaderValues; myPlotAssociation.DataTableMatrix.GetWrappers( gl.XAxis.PhysicalVariantToNormal, // transformation function for row header values Altaxo.Calc.RMath.IsFinite, // selection functiton for row header values gl.YAxis.PhysicalVariantToNormal, // transformation function for column header values Altaxo.Calc.RMath.IsFinite, // selection functiton for column header values out matrix, out logicalRowHeaderValues, out logicalColumnHeaderValues ); int cols = matrix.Columns; int rows = matrix.Rows; if (cols <= 0 || rows <= 0) return; // we cannot show a picture if one length is zero // there is a need for rebuilding the bitmap only if the data are invalid for some reason // if the cached image is valid, then test if the conditions hold any longer switch (_imageType) { case CachedImageType.LinearEquidistant: { ImageTypeEquiLinearMemento memento = new ImageTypeEquiLinearMemento(gl); if (!memento.Equals(_imageConditionMemento)) this._imageType = CachedImageType.None; } break; case CachedImageType.Other: { ImageTypeOtherMemento memento = new ImageTypeOtherMemento(gl); if (!memento.Equals(_imageConditionMemento)) this._imageType = CachedImageType.None; } break; } // now build the image // note that the image type can change during the call of BuildImage if (_imageType == CachedImageType.None || _cachedImage == null) { BuildImage(gfrx, gl, myPlotAssociation, matrix, logicalRowHeaderValues, logicalColumnHeaderValues); switch (_imageType) { case CachedImageType.LinearEquidistant: _imageConditionMemento = new ImageTypeEquiLinearMemento(gl); break; case CachedImageType.Other: _imageConditionMemento = new ImageTypeOtherMemento(gl); break; } } // and now draw the image { // Three tricks are neccessary to get the bitmap drawn smooth and uniformly: // Everything other than this will result in distorted image, or soft (unsharp) edges var graphicsState = gfrx.Save(); // Of course, save the graphics state so we can make our tricks undone afterwards gfrx.InterpolationMode = InterpolationMode.Default; // Trick1: Set the interpolation mode, whatever it was before, back to default gfrx.PixelOffsetMode = PixelOffsetMode.Default; // Trick2: Set the PixelOffsetMode, whatever it was before, back to default switch (_imageType) { case CachedImageType.LinearEquidistant: { double xOrgRel = logicalRowHeaderValues[0]; double xEndRel = logicalRowHeaderValues[rows - 1]; double yOrgRel = logicalColumnHeaderValues[0]; double yEndRel = logicalColumnHeaderValues[cols - 1]; double x0, y0, x1, y1, x2, y2; bool isConvertible = true; isConvertible &= gl.CoordinateSystem.LogicalToLayerCoordinates(new Logical3D(xOrgRel, yEndRel), out x0, out y0); isConvertible &= gl.CoordinateSystem.LogicalToLayerCoordinates(new Logical3D(xOrgRel, yOrgRel), out x1, out y1); isConvertible &= gl.CoordinateSystem.LogicalToLayerCoordinates(new Logical3D(xEndRel, yEndRel), out x2, out y2); if (isConvertible) { if (this._clipToLayer) gfrx.Clip = gl.CoordinateSystem.GetRegion(); var pts = new PointF[] { new PointF((float)x0, (float)y0), new PointF((float)x2, (float)y2), new PointF((float)x1, (float)y1) }; gfrx.DrawImage(_cachedImage, pts, new RectangleF(0, 0, _cachedImage.Width - 1, _cachedImage.Height - 1), GraphicsUnit.Pixel); // Trick3: Paint both in X and Y direction one pixel less than the source bitmap acually has, this prevents soft edges } } break; case CachedImageType.Other: { gfrx.DrawImage(_cachedImage, 0, 0, (float)gl.Size.X, (float)gl.Size.Y); } break; } gfrx.Restore(graphicsState); } }
/// <summary> /// Called by the parent plot item to indicate that the associated data has changed. Used to invalidate the cached bitmap to force /// rebuilding the bitmap from new data. /// </summary> /// <param name="sender">The sender of the message.</param> public void EhDataChanged(object sender) { this._imageType = CachedImageType.None; EhSelfChanged(EventArgs.Empty); }
public bool CopyFrom(object obj) { if (object.ReferenceEquals(this, obj)) return true; var from = obj as DensityImagePlotStyle; if (null == from) return false; using (var suspendToken = SuspendGetToken()) { this._clipToLayer = from._clipToLayer; this.ColorProvider = from._colorProvider; this.Scale = (NumericalScale)from._scale.Clone(); this._imageType = CachedImageType.None; EhSelfChanged(); suspendToken.Resume(); } return true; }