public void CopyFromRaster(DsRGB565Raster i_raster) { Debug.Assert(i_raster.isEqualBufferType(NyARBufferType.WORD1D_R5G6B5_16LE)); int pitch; GraphicsStream gs = this._surface.LockRectangle(this.m_src_rect,LockFlags.None, out pitch); Marshal.Copy((short[])i_raster.getBuffer(), 0, (IntPtr)((int)gs.InternalData), this._width * 2 * this._height); this._surface.UnlockRectangle(); return; }
public void CopyFromRaster(DsRGB565Raster i_raster) { Debug.Assert(i_raster.isEqualBufferType(NyARBufferType.WORD1D_R5G6B5_16LE)); int pitch; GraphicsStream gs = this._surface.LockRectangle(this.m_src_rect, LockFlags.None, out pitch); Marshal.Copy((short[])i_raster.getBuffer(), 0, (IntPtr)((int)gs.InternalData), this._width * 2 * this._height); this._surface.UnlockRectangle(); return; }
public void CopyFromRaster(DsRGB565Raster i_raster) { //BUFFERFORMAT_WORD1D_R5G6B5_16LEしか受けられません。 Debug.Assert(i_raster.isEqualBufferType(NyARBufferType.WORD1D_R5G6B5_16LE)); int pi; int w = this.m_width; GraphicsStream gs = this._texture.LockRectangle(0, LockFlags.None, out pi); short[] buf = (short[])i_raster.getBuffer(); int st = this.m_width; int s_idx = 0; int d_idx = 0; for (int i = this.m_height - 1; i >= 0; i--) { Marshal.Copy(buf, s_idx, (IntPtr)((int)gs.InternalData + d_idx), w); s_idx += st; d_idx += pi; } this._texture.UnlockRectangle(0); return; }
public void CopyFromRaster(DsRGB565Raster i_raster) { Debug.Assert(i_raster.isEqualBufferType(NyARBufferType.WORD1D_R5G6B5_16LE)); int pitch; GraphicsStream gs = this._surface.LockRectangle(this._src_rect, LockFlags.None, out pitch); /* int cp_size = this.m_width * 4; int s_idx=0; int d_idx = (this.m_height - 1) * cp_size; for(int i=this.m_height-1;i>=0;i--){ //どう考えてもポインタです。 Marshal.Copy((byte[])i_sample.getBufferReader().getBuffer(),s_idx,(IntPtr)((int)gs.InternalData+d_idx),cp_size); s_idx += cp_size; d_idx -= cp_size; } */ Marshal.Copy((short[])i_raster.getBuffer(), 0, (IntPtr)((int)gs.InternalData), this._width * this._height); this._surface.UnlockRectangle(); return; }
public void CopyFromRaster(DsRGB565Raster i_raster) { Debug.Assert(i_raster.isEqualBufferType(NyARBufferType.WORD1D_R5G6B5_16LE)); int pitch; GraphicsStream gs = this._surface.LockRectangle(this._src_rect, LockFlags.None, out pitch); /* * int cp_size = this.m_width * 4; * int s_idx=0; * int d_idx = (this.m_height - 1) * cp_size; * for(int i=this.m_height-1;i>=0;i--){ * //どう考えてもポインタです。 * Marshal.Copy((byte[])i_sample.getBufferReader().getBuffer(),s_idx,(IntPtr)((int)gs.InternalData+d_idx),cp_size); * s_idx += cp_size; * d_idx -= cp_size; * } */ Marshal.Copy((short[])i_raster.getBuffer(), 0, (IntPtr)((int)gs.InternalData), this._width * this._height); this._surface.UnlockRectangle(); return; }