summaryrefslogtreecommitdiff
path: root/agg/inc/agg_span_image_filter_gray.h
diff options
context:
space:
mode:
Diffstat (limited to 'agg/inc/agg_span_image_filter_gray.h')
-rwxr-xr-xagg/inc/agg_span_image_filter_gray.h140
1 files changed, 70 insertions, 70 deletions
diff --git a/agg/inc/agg_span_image_filter_gray.h b/agg/inc/agg_span_image_filter_gray.h
index 3f7ae6fcfa72..963b901cfa76 100755
--- a/agg/inc/agg_span_image_filter_gray.h
+++ b/agg/inc/agg_span_image_filter_gray.h
@@ -2,8 +2,8 @@
// Anti-Grain Geometry - Version 2.3
// Copyright (C) 2002-2005 Maxim Shemanarev (http://www.antigrain.com)
//
-// Permission to copy, use, modify, sell and distribute this software
-// is granted provided this copyright notice appears in all copies.
+// Permission to copy, use, modify, sell and distribute this software
+// is granted provided this copyright notice appears in all copies.
// This software is provided "as is" without express or implied
// warranty, and with no claim as to its suitability for any purpose.
//
@@ -13,12 +13,12 @@
// http://www.antigrain.com
//----------------------------------------------------------------------------
//
-// Adaptation for high precision colors has been sponsored by
+// Adaptation for high precision colors has been sponsored by
// Liberty Technology Systems, Inc., visit http://lib-sys.com
//
// Liberty Technology Systems, Inc. is the provider of
// PostScript and PDF technology for software developers.
-//
+//
//----------------------------------------------------------------------------
#ifndef AGG_SPAN_IMAGE_FILTER_GRAY_INCLUDED
@@ -36,8 +36,8 @@ namespace agg
//==============================================span_image_filter_gray_nn
template<class ColorT,
class Interpolator,
- class Allocator = span_allocator<ColorT> >
- class span_image_filter_gray_nn :
+ class Allocator = span_allocator<ColorT> >
+ class span_image_filter_gray_nn :
public span_image_filter<ColorT, Interpolator, Allocator>
{
public:
@@ -58,16 +58,16 @@ namespace agg
//--------------------------------------------------------------------
span_image_filter_gray_nn(alloc_type& alloc,
- const rendering_buffer& src,
+ const rendering_buffer& src,
const color_type& back_color,
interpolator_type& inter) :
- base_type(alloc, src, back_color, inter, 0)
+ base_type(alloc, src, back_color, inter, 0)
{}
//--------------------------------------------------------------------
color_type* generate(int x, int y, unsigned len)
{
- base_type::interpolator().begin(x + base_type::filter_dx_dbl(),
+ base_type::interpolator().begin(x + base_type::filter_dx_dbl(),
y + base_type::filter_dy_dbl(), len);
calc_type fg;
@@ -86,7 +86,7 @@ namespace agg
y >>= image_subpixel_shift;
if(x >= 0 && y >= 0 &&
- x <= maxx && y <= maxy)
+ x <= maxx && y <= maxy)
{
fg = *((const value_type*)base_type::source_image().row(y) + x);
src_alpha = base_mask;
@@ -113,9 +113,9 @@ namespace agg
//========================================span_image_filter_gray_bilinear
template<class ColorT,
- class Interpolator,
- class Allocator = span_allocator<ColorT> >
- class span_image_filter_gray_bilinear :
+ class Interpolator,
+ class Allocator = span_allocator<ColorT> >
+ class span_image_filter_gray_bilinear :
public span_image_filter<ColorT, Interpolator, Allocator>
{
public:
@@ -136,16 +136,16 @@ namespace agg
//--------------------------------------------------------------------
span_image_filter_gray_bilinear(alloc_type& alloc,
- const rendering_buffer& src,
+ const rendering_buffer& src,
const color_type& back_color,
interpolator_type& inter) :
- base_type(alloc, src, back_color, inter, 0)
+ base_type(alloc, src, back_color, inter, 0)
{}
//--------------------------------------------------------------------
color_type* generate(int x, int y, unsigned len)
{
- base_type::interpolator().begin(x + base_type::filter_dx_dbl(),
+ base_type::interpolator().begin(x + base_type::filter_dx_dbl(),
y + base_type::filter_dy_dbl(), len);
calc_type fg;
calc_type src_alpha;
@@ -163,7 +163,7 @@ namespace agg
{
int x_hr;
int y_hr;
-
+
base_type::interpolator().coordinates(&x_hr, &y_hr);
x_hr -= base_type::filter_dx_int();
@@ -173,7 +173,7 @@ namespace agg
int y_lr = y_hr >> image_subpixel_shift;
if(x_lr >= 0 && y_lr >= 0 &&
- x_lr < maxx && y_lr < maxy)
+ x_lr < maxx && y_lr < maxy)
{
fg = image_subpixel_size * image_subpixel_size / 2;
@@ -203,13 +203,13 @@ namespace agg
}
else
{
- fg =
+ fg =
src_alpha = image_subpixel_size * image_subpixel_size / 2;
x_hr &= image_subpixel_mask;
y_hr &= image_subpixel_mask;
- weight = (image_subpixel_size - x_hr) *
+ weight = (image_subpixel_size - x_hr) *
(image_subpixel_size - y_hr);
if(x_lr >= 0 && y_lr >= 0 &&
x_lr <= maxx && y_lr <= maxy)
@@ -293,9 +293,9 @@ namespace agg
//========================================span_image_filter_gray_2x2
template<class ColorT,
- class Interpolator,
- class Allocator = span_allocator<ColorT> >
- class span_image_filter_gray_2x2 :
+ class Interpolator,
+ class Allocator = span_allocator<ColorT> >
+ class span_image_filter_gray_2x2 :
public span_image_filter<ColorT, Interpolator, Allocator>
{
public:
@@ -316,17 +316,17 @@ namespace agg
//--------------------------------------------------------------------
span_image_filter_gray_2x2(alloc_type& alloc,
- const rendering_buffer& src,
+ const rendering_buffer& src,
const color_type& back_color,
interpolator_type& inter,
const image_filter_lut& filter) :
- base_type(alloc, src, back_color, inter, &filter)
+ base_type(alloc, src, back_color, inter, &filter)
{}
//--------------------------------------------------------------------
color_type* generate(int x, int y, unsigned len)
{
- base_type::interpolator().begin(x + base_type::filter_dx_dbl(),
+ base_type::interpolator().begin(x + base_type::filter_dx_dbl(),
y + base_type::filter_dy_dbl(), len);
calc_type fg;
calc_type src_alpha;
@@ -336,8 +336,8 @@ namespace agg
const value_type *fg_ptr;
color_type* span = base_type::allocator().span();
- const int16* weight_array = base_type::filter().weight_array() +
- ((base_type::filter().diameter()/2 - 1) <<
+ const int16* weight_array = base_type::filter().weight_array() +
+ ((base_type::filter().diameter()/2 - 1) <<
image_subpixel_shift);
int maxx = base_type::source_image().width() - 1;
@@ -347,7 +347,7 @@ namespace agg
{
int x_hr;
int y_hr;
-
+
base_type::interpolator().coordinates(&x_hr, &y_hr);
x_hr -= base_type::filter_dx_int();
@@ -357,7 +357,7 @@ namespace agg
int y_lr = y_hr >> image_subpixel_shift;
if(x_lr >= 0 && y_lr >= 0 &&
- x_lr < maxx && y_lr < maxy)
+ x_lr < maxx && y_lr < maxy)
{
fg = image_filter_size / 2;
@@ -365,24 +365,24 @@ namespace agg
y_hr &= image_subpixel_mask;
fg_ptr = (const value_type*)base_type::source_image().row(y_lr) + x_lr;
- fg += *fg_ptr++ * ((weight_array[x_hr + image_subpixel_size] *
- weight_array[y_hr + image_subpixel_size] +
- image_filter_size / 2) >>
+ fg += *fg_ptr++ * ((weight_array[x_hr + image_subpixel_size] *
+ weight_array[y_hr + image_subpixel_size] +
+ image_filter_size / 2) >>
image_filter_shift);
- fg += *fg_ptr++ * ((weight_array[x_hr] *
- weight_array[y_hr + image_subpixel_size] +
- image_filter_size / 2) >>
+ fg += *fg_ptr++ * ((weight_array[x_hr] *
+ weight_array[y_hr + image_subpixel_size] +
+ image_filter_size / 2) >>
image_filter_shift);
fg_ptr = (const value_type*)base_type::source_image().next_row(fg_ptr - 2);
- fg += *fg_ptr++ * ((weight_array[x_hr + image_subpixel_size] *
- weight_array[y_hr] +
- image_filter_size / 2) >>
+ fg += *fg_ptr++ * ((weight_array[x_hr + image_subpixel_size] *
+ weight_array[y_hr] +
+ image_filter_size / 2) >>
image_filter_shift);
- fg += *fg_ptr++ * ((weight_array[x_hr] *
- weight_array[y_hr] +
- image_filter_size / 2) >>
+ fg += *fg_ptr++ * ((weight_array[x_hr] *
+ weight_array[y_hr] +
+ image_filter_size / 2) >>
image_filter_shift);
fg >>= image_filter_shift;
@@ -405,9 +405,9 @@ namespace agg
x_hr &= image_subpixel_mask;
y_hr &= image_subpixel_mask;
- weight = (weight_array[x_hr + image_subpixel_size] *
- weight_array[y_hr + image_subpixel_size] +
- image_filter_size / 2) >>
+ weight = (weight_array[x_hr + image_subpixel_size] *
+ weight_array[y_hr + image_subpixel_size] +
+ image_filter_size / 2) >>
image_filter_shift;
if(x_lr >= 0 && y_lr >= 0 &&
x_lr <= maxx && y_lr <= maxy)
@@ -423,9 +423,9 @@ namespace agg
x_lr++;
- weight = (weight_array[x_hr] *
- weight_array[y_hr + image_subpixel_size] +
- image_filter_size / 2) >>
+ weight = (weight_array[x_hr] *
+ weight_array[y_hr + image_subpixel_size] +
+ image_filter_size / 2) >>
image_filter_shift;
if(x_lr >= 0 && y_lr >= 0 &&
x_lr <= maxx && y_lr <= maxy)
@@ -442,9 +442,9 @@ namespace agg
x_lr--;
y_lr++;
- weight = (weight_array[x_hr + image_subpixel_size] *
- weight_array[y_hr] +
- image_filter_size / 2) >>
+ weight = (weight_array[x_hr + image_subpixel_size] *
+ weight_array[y_hr] +
+ image_filter_size / 2) >>
image_filter_shift;
if(x_lr >= 0 && y_lr >= 0 &&
x_lr <= maxx && y_lr <= maxy)
@@ -460,9 +460,9 @@ namespace agg
x_lr++;
- weight = (weight_array[x_hr] *
- weight_array[y_hr] +
- image_filter_size / 2) >>
+ weight = (weight_array[x_hr] *
+ weight_array[y_hr] +
+ image_filter_size / 2) >>
image_filter_shift;
if(x_lr >= 0 && y_lr >= 0 &&
x_lr <= maxx && y_lr <= maxy)
@@ -508,9 +508,9 @@ namespace agg
//================================================span_image_filter_gray
template<class ColorT,
- class Interpolator,
- class Allocator = span_allocator<ColorT> >
- class span_image_filter_gray :
+ class Interpolator,
+ class Allocator = span_allocator<ColorT> >
+ class span_image_filter_gray :
public span_image_filter<ColorT, Interpolator, Allocator>
{
public:
@@ -531,17 +531,17 @@ namespace agg
//--------------------------------------------------------------------
span_image_filter_gray(alloc_type& alloc,
- const rendering_buffer& src,
+ const rendering_buffer& src,
const color_type& back_color,
interpolator_type& inter,
const image_filter_lut& filter) :
- base_type(alloc, src, back_color, inter, &filter)
+ base_type(alloc, src, back_color, inter, &filter)
{}
//--------------------------------------------------------------------
color_type* generate(int x, int y, unsigned len)
{
- base_type::interpolator().begin(x + base_type::filter_dx_dbl(),
+ base_type::interpolator().begin(x + base_type::filter_dx_dbl(),
y + base_type::filter_dy_dbl(), len);
int fg;
@@ -564,7 +564,7 @@ namespace agg
int maxx2 = base_type::source_image().width() - start - 1;
int maxy2 = base_type::source_image().height() - start - 1;
- int x_count;
+ int x_count;
int weight_y;
do
@@ -576,7 +576,7 @@ namespace agg
int x_hr = x;
int y_hr = y;
-
+
int x_lr = x_hr >> image_subpixel_shift;
int y_lr = y_hr >> image_subpixel_shift;
@@ -586,7 +586,7 @@ namespace agg
unsigned y_count = diameter;
if(x_lr >= -start && y_lr >= -start &&
- x_lr <= maxx && y_lr <= maxy)
+ x_lr <= maxx && y_lr <= maxy)
{
y_hr = image_subpixel_mask - (y_hr & image_subpixel_mask);
fg_ptr = (const value_type*)base_type::source_image().row(y_lr + start) + x_lr + start;
@@ -598,8 +598,8 @@ namespace agg
do
{
- fg += *fg_ptr++ * ((weight_y * weight_array[x_hr] +
- image_filter_size / 2) >>
+ fg += *fg_ptr++ * ((weight_y * weight_array[x_hr] +
+ image_filter_size / 2) >>
image_filter_shift);
x_hr += image_subpixel_size;
@@ -619,7 +619,7 @@ namespace agg
else
{
if(x_lr < start1 || y_lr < start1 ||
- x_lr > maxx2 || y_lr > maxy2)
+ x_lr > maxx2 || y_lr > maxy2)
{
fg = back_v;
src_alpha = back_a;
@@ -639,12 +639,12 @@ namespace agg
do
{
- int weight = (weight_y * weight_array[x_hr] +
- image_filter_size / 2) >>
+ int weight = (weight_y * weight_array[x_hr] +
+ image_filter_size / 2) >>
image_filter_shift;
- if(x_lr >= 0 && y_lr >= 0 &&
- x_lr < int(base_type::source_image().width()) &&
+ if(x_lr >= 0 && y_lr >= 0 &&
+ x_lr < int(base_type::source_image().width()) &&
y_lr < int(base_type::source_image().height()))
{
fg_ptr = (const value_type*)base_type::source_image().row(y_lr) + x_lr;