From 5f203e6553fb38c26dd3296c423f5e0db123a4b7 Mon Sep 17 00:00:00 2001 From: george82 Date: Fri, 27 Oct 2006 16:11:52 +0000 Subject: [PATCH] Added ScaleFilters class implementation to the ScaledPixelBuffer. It's routines to manipulates a set of 1-d scale filters. git-svn-id: svn://svn.code.sf.net/p/tigervnc/code/trunk@2109 3789f03b-4d11-0410-bbf8-ca57d06f2519 --- common/rfb/ScaleFilters.h | 33 ++++++++++++++++++++++++++++++--- 1 file changed, 30 insertions(+), 3 deletions(-) diff --git a/common/rfb/ScaleFilters.h b/common/rfb/ScaleFilters.h index 950838a2..6839f18a 100644 --- a/common/rfb/ScaleFilters.h +++ b/common/rfb/ScaleFilters.h @@ -69,11 +69,38 @@ namespace rfb { else return sin(pi*x)/(pi*x); } - class ScaleFilter { - public: + typedef struct { char name[30]; - int radius; + double radius; filter_func func; + } SFilter; + + class ScaleFilters { + public: + ScaleFilters() { initFilters(); }; + + SFilter &operator[](unsigned int filter_id) { + return filters[filter_id]; + } + + protected: + void initFilters() { + filters[scaleFilterNearestNeighbor] = create("Nearest neighbor", 0.5, nearest_neighbor); + filters[scaleFilterBilinear] = create("Bilinear", 1, linear); + filters[scaleFilterBicubic] = create("Bicubic", 2, cubic); + filters[scaleFilterSinc] = create("Sinc", 4, sinc); + } + + SFilter create(char *name_, double radius_, filter_func func_) { + SFilter filter; + strncpy(filter.name, name_, sizeof(filter.name)-1); + filter.name[sizeof(filter.name)-1] = '\0'; + filter.radius = radius_; + filter.func = func_; + return filter; + } + + SFilter filters[scaleFiltersMax]; }; }; -- 2.39.5