//---------------------------------------------------------------- public void begin(double x, double y, int len) { m_pos = 1; m_src_x = agg_basics.iround(x * subpixel_scale) + subpixel_scale; m_src_y = y; m_len = len; if (len > m_subdiv_size) { len = (int)m_subdiv_size; } m_interpolator.begin(x, y, len); }
public override void generate(Color[] span, int spanIndex, int x, int y, int len) { ImageBuffer SourceRenderingBuffer = (ImageBuffer)GetImageBufferAccessor().SourceImage; if (SourceRenderingBuffer.BitDepth != 24) { throw new NotSupportedException("The source is expected to be 32 bit."); } ISpanInterpolator spanInterpolator = interpolator(); spanInterpolator.begin(x + filter_dx_dbl(), y + filter_dy_dbl(), len); int x_hr; int y_hr; spanInterpolator.coordinates(out x_hr, out y_hr); int x_lr = x_hr >> (int)image_subpixel_scale_e.image_subpixel_shift; int y_lr = y_hr >> (int)image_subpixel_scale_e.image_subpixel_shift; int bufferIndex; bufferIndex = SourceRenderingBuffer.GetBufferOffsetXY(x_lr, y_lr); byte[] fg_ptr = SourceRenderingBuffer.GetBuffer(); #if USE_UNSAFE_CODE unsafe { fixed(byte *pSource = fg_ptr) { do { span[spanIndex++] = *(RGBA_Bytes *)&(pSource[bufferIndex]); bufferIndex += 4; } while (--len != 0); } } #else Color color = Color.White; do { color.blue = fg_ptr[bufferIndex++]; color.green = fg_ptr[bufferIndex++]; color.red = fg_ptr[bufferIndex++]; span[spanIndex++] = color; } while (--len != 0); #endif }