本文整理汇总了C#中MatterHackers.Agg.Image.ImageBuffer.stride方法的典型用法代码示例。如果您正苦于以下问题:C# ImageBuffer.stride方法的具体用法?C# ImageBuffer.stride怎么用?C# ImageBuffer.stride使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类MatterHackers.Agg.Image.ImageBuffer
的用法示例。
在下文中一共展示了ImageBuffer.stride方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: stack_blur_bgra32
//.........这里部分代码省略.........
sum_in_r += src_pix_ptr[R];
sum_in_g += src_pix_ptr[G];
sum_in_b += src_pix_ptr[B];
sum_in_a += src_pix_ptr[A];
sum_r += sum_in_r;
sum_g += sum_in_g;
sum_b += sum_in_b;
sum_a += sum_in_a;
++stack_ptr;
if(stack_ptr >= div) stack_ptr = 0;
stack_pix_ptr = &stack[stack_ptr];
sum_out_r += stack_pix_ptr->r;
sum_out_g += stack_pix_ptr->g;
sum_out_b += stack_pix_ptr->b;
sum_out_a += stack_pix_ptr->a;
sum_in_r -= stack_pix_ptr->r;
sum_in_g -= stack_pix_ptr->g;
sum_in_b -= stack_pix_ptr->b;
sum_in_a -= stack_pix_ptr->a;
}
}
}
if(ry > 0)
{
if(ry > 254) ry = 254;
div = ry * 2 + 1;
mul_sum = stack_blur_tables.g_stack_blur8_mul[ry];
shr_sum = stack_blur_tables.g_stack_blur8_shr[ry];
stack.allocate(div);
int stride = img.stride();
for(x = 0; x < w; x++)
{
sum_r =
sum_g =
sum_b =
sum_a =
sum_in_r =
sum_in_g =
sum_in_b =
sum_in_a =
sum_out_r =
sum_out_g =
sum_out_b =
sum_out_a = 0;
src_pix_ptr = img.pix_ptr(x, 0);
for(i = 0; i <= ry; i++)
{
stack_pix_ptr = &stack[i];
stack_pix_ptr->r = src_pix_ptr[R];
stack_pix_ptr->g = src_pix_ptr[G];
stack_pix_ptr->b = src_pix_ptr[B];
stack_pix_ptr->a = src_pix_ptr[A];
sum_r += src_pix_ptr[R] * (i + 1);
sum_g += src_pix_ptr[G] * (i + 1);
sum_b += src_pix_ptr[B] * (i + 1);
sum_a += src_pix_ptr[A] * (i + 1);
sum_out_r += src_pix_ptr[R];
sum_out_g += src_pix_ptr[G];
sum_out_b += src_pix_ptr[B];
sum_out_a += src_pix_ptr[A];
}
示例2: stack_blur_gray8
//.........这里部分代码省略.........
*dst_pix_ptr = (sum * mul_sum) >> shr_sum;
dst_pix_ptr += Img::pix_step;
sum -= sum_out;
stack_start = stack_ptr + div - rx;
if(stack_start >= div) stack_start -= div;
sum_out -= stack[stack_start];
if(xp < wm)
{
src_pix_ptr += Img::pix_step;
pix = *src_pix_ptr;
++xp;
}
stack[stack_start] = pix;
sum_in += pix;
sum += sum_in;
++stack_ptr;
if(stack_ptr >= div) stack_ptr = 0;
stack_pix = stack[stack_ptr];
sum_out += stack_pix;
sum_in -= stack_pix;
}
}
}
if(ry > 0)
{
if(ry > 254) ry = 254;
div = ry * 2 + 1;
mul_sum = stack_blur_tables.g_stack_blur8_mul[ry];
shr_sum = stack_blur_tables.g_stack_blur8_shr[ry];
stack.allocate(div);
int stride = img.stride();
for(x = 0; x < w; x++)
{
sum = sum_in = sum_out = 0;
src_pix_ptr = img.pix_ptr(x, 0);
pix = *src_pix_ptr;
for(i = 0; i <= ry; i++)
{
stack[i] = pix;
sum += pix * (i + 1);
sum_out += pix;
}
for(i = 1; i <= ry; i++)
{
if(i <= hm) src_pix_ptr += stride;
pix = *src_pix_ptr;
stack[i + ry] = pix;
sum += pix * (ry + 1 - i);
sum_in += pix;
}
stack_ptr = ry;
yp = ry;
if(yp > hm) yp = hm;
src_pix_ptr = img.pix_ptr(x, yp);
dst_pix_ptr = img.pix_ptr(x, 0);
for(y = 0; y < h; y++)
{
*dst_pix_ptr = (sum * mul_sum) >> shr_sum;
dst_pix_ptr += stride;
sum -= sum_out;
stack_start = stack_ptr + div - ry;
if(stack_start >= div) stack_start -= div;
sum_out -= stack[stack_start];
if(yp < hm)
{
src_pix_ptr += stride;
pix = *src_pix_ptr;
++yp;
}
stack[stack_start] = pix;
sum_in += pix;
sum += sum_in;
++stack_ptr;
if(stack_ptr >= div) stack_ptr = 0;
stack_pix = stack[stack_ptr];
sum_out += stack_pix;
sum_in -= stack_pix;
}
}
}
#endif
}