/// <summary> /// Updates the splash window with current contents of the overlay image. /// </summary> /// <exception cref="IllegalStateException"> if the overlay image does not exist; /// for example, if {@code createGraphics} has never been called, /// or if the splash screen has already been closed </exception> //JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in .NET: //ORIGINAL LINE: public void update() throws IllegalStateException public void Update() { BufferedImage image; lock (typeof(SplashScreen)) { CheckVisible(); image = this.Image; } if (image == null) { throw new IllegalStateException("no overlay image available"); } DataBuffer buf = image.Raster.DataBuffer; if (!(buf is DataBufferInt)) { //JAVA TO C# CONVERTER WARNING: The .NET Type.FullName property will not always yield results identical to the Java Class.getName method: throw new AssertionError("Overlay image DataBuffer is of invalid type == " + buf.GetType().FullName); } int numBanks = buf.NumBanks; if (numBanks != 1) { throw new AssertionError("Invalid number of banks ==" + numBanks + " in overlay image DataBuffer"); } if (!(image.SampleModel is SinglePixelPackedSampleModel)) { //JAVA TO C# CONVERTER WARNING: The .NET Type.FullName property will not always yield results identical to the Java Class.getName method: throw new AssertionError("Overlay image has invalid sample model == " + image.SampleModel.GetType().FullName); } SinglePixelPackedSampleModel sm = (SinglePixelPackedSampleModel)image.SampleModel; int scanlineStride = sm.ScanlineStride; Rectangle rect = image.Raster.Bounds; // Note that we steal the data array here, but just for reading // so we do not need to mark the DataBuffer dirty... int[] data = SunWritableRaster.stealData((DataBufferInt)buf, 0); lock (typeof(SplashScreen)) { CheckVisible(); _update(SplashPtr, data, rect.x, rect.y, rect.Width_Renamed, rect.Height_Renamed, scanlineStride); } }
/// <summary> /// Checks if the specified <code>SampleModel</code> is compatible /// with this <code>ColorModel</code>. If <code>sm</code> is /// <code>null</code>, this method returns <code>false</code>. </summary> /// <param name="sm"> the specified <code>SampleModel</code>, /// or <code>null</code> </param> /// <returns> <code>true</code> if the specified <code>SampleModel</code> /// is compatible with this <code>ColorModel</code>; /// <code>false</code> otherwise. </returns> /// <seealso cref= SampleModel </seealso> public override bool IsCompatibleSampleModel(SampleModel sm) { if (!(sm is SinglePixelPackedSampleModel)) { return(false); } // Must have the same number of components if (NumComponents_Renamed != sm.NumBands) { return(false); } // Transfer type must be the same if (sm.TransferType != TransferType_Renamed) { return(false); } SinglePixelPackedSampleModel sppsm = (SinglePixelPackedSampleModel)sm; // Now compare the specific masks int[] bitMasks = sppsm.BitMasks; if (bitMasks.Length != MaskArray.Length) { return(false); } /* compare 'effective' masks only, i.e. only part of the mask * which fits the capacity of the transfer type. */ int maxMask = (int)((1L << DataBuffer.GetDataTypeSize(TransferType_Renamed)) - 1); for (int i = 0; i < bitMasks.Length; i++) { if ((maxMask & bitMasks[i]) != (maxMask & MaskArray[i])) { return(false); } } return(true); }