Пример #1
0
        public static IFriendsFilter GetCompatibleFilter(eFilterType i_FilterType)
        {
            switch (i_FilterType)
            {
            case eFilterType.AgeRangeFilter:
            {
                return(new AgeFilter());
            }

            case eFilterType.GenderFilter:
            {
                return(new GenderFilter());
            }

            case eFilterType.LivingCityFilter:
            {
                return(new LivingCityFilter());
            }

            case eFilterType.RelationshipFilter:
            {
                return(new RelationshipFilter());
            }
            }

            return(null);
        }
        private void StartFilterActivity(eFilterType filterType)
        {
            AppSession.SelectedFilterType = filterType;

            var intent = new Intent(this, typeof(FilterListActivity));

            StartActivity(intent);
        }
Пример #3
0
        public void Initialize(string module, eFilterType filtType, bool initializeCamera = true)
        {
            moduleName = module;
            filterType = filtType;


            if (initializeCamera)
            {
                cameraFilter = CameraFilter.CreateFilter(cameraMode);
                cameraFilter.Activate();
            }
            currentMode = (filterType == eFilterType.Map ? eFilterType.Flight : filterType);

            if (titleFile != "")
            {
                titleTexture = CameraFilter.LoadTextureFile(titleFile);
            }
        }
Пример #4
0
        void multiscaleDisplace(ref DAGMask baseMask, ref DAGMask subMask, ref DAGMask addMask)
        {
            eFilterType type  = eFilterType.cFilter_Linear;//eFilterType.cFilter_Nearest;//
            int         level = 4;

            // int l = level;
            for (int l = level; l > 0; l--)
            {
                //resize to smaller texture
                DAGMask smallMask = new DAGMask(baseMask.Width >> l, baseMask.Height >> l);
                resizeF32Img(baseMask, smallMask, baseMask.Width, baseMask.Height, smallMask.Width, smallMask.Height, type);

                DAGMask addMaskSmall = new DAGMask(smallMask.Width, smallMask.Height);
                DAGMask subMaskSmall = new DAGMask(smallMask.Width, smallMask.Height);
                resizeF32Img(addMask, addMaskSmall, addMask.Width, addMask.Height, addMaskSmall.Width, addMaskSmall.Height, type);
                resizeF32Img(subMask, subMaskSmall, subMask.Width, subMask.Height, subMaskSmall.Width, subMaskSmall.Height, type);

                //calculate erosion
                calculateErosion(smallMask, smallMask.Width, smallMask.Height, ref subMaskSmall, ref addMaskSmall, l);

                //move back
                DAGMask addMaskBig = new DAGMask(baseMask.Width, baseMask.Height);
                DAGMask subMaskBig = new DAGMask(baseMask.Width, baseMask.Height);
                resizeF32Img(addMaskSmall, addMaskBig, addMaskSmall.Width, addMaskSmall.Height, addMask.Width, addMask.Height, type);
                resizeF32Img(subMaskSmall, subMaskBig, subMaskSmall.Width, subMaskSmall.Height, subMask.Width, subMask.Height, type);

                DAGMask smallMaskBig = new DAGMask(baseMask.Width, baseMask.Height);
                resizeF32Img(smallMask, smallMaskBig, smallMask.Width, smallMask.Height, smallMaskBig.Width, smallMaskBig.Height, type);

                for (int x = 0; x < baseMask.Width; x++)
                {
                    for (int y = 0; y < baseMask.Height; y++)
                    {
                        // baseMask[x, y] = smallMaskBig[x, y];
                        addMask[x, y] = addMaskBig[x, y];
                        subMask[x, y] = subMaskBig[x, y];
                    }
                }
            }
        }
Пример #5
0
        static public void resizeF32Img(DAGMask inputTexture, DAGMask outputTexture, int inputWidth, int inputHeight, int newWidth, int newHeight, eFilterType method)
        {
            if (outputTexture == null)
            {
                outputTexture = new DAGMask(newWidth, newHeight);
            }
            if (inputWidth == newWidth && inputHeight == newHeight)
            {
                outputTexture = inputTexture.Clone();
                return;
            }
            float xFactor = (float)inputWidth / newWidth;
            float yFactor = (float)inputHeight / newHeight;

            int dstOffset = inputWidth - newWidth;

            //create a new texture of new size

            switch (method)
            {
            case eFilterType.cFilter_Nearest:
            {
                int ox, oy;


                // for each line
                for (int y = 0; y < newHeight; y++)
                {
                    // Y coordinate of the nearest point
                    oy = (int)(y * yFactor);

                    // for each pixel
                    for (int x = 0; x < newWidth; x++)
                    {
                        // X coordinate of the nearest point
                        ox = (int)(x * xFactor);

                        int srcIndex = oy * inputWidth + ox;

                        outputTexture[x, y] = inputTexture[ox, oy];
                    }
                    //     dstIndex += dstOffset;
                }
                break;
            }

            case eFilterType.cFilter_Linear:
            {
                float ox, oy, dx1, dy1, dx2, dy2;
                int   ox1, oy1, ox2, oy2;
                int   ymax = inputHeight - 1;
                int   xmax = inputWidth - 1;
                float v1, v2;


                // for each line
                for (int y = 0; y < newHeight; y++)
                {
                    // Y coordinates
                    oy  = (float)y * yFactor;
                    oy1 = (int)oy;
                    oy2 = (oy1 == ymax) ? oy1 : oy1 + 1;
                    dy1 = oy - (float)oy1;
                    dy2 = 1.0f - dy1;

                    // for each pixel
                    for (int x = 0; x < newWidth; x++)
                    {
                        // X coordinates
                        ox  = (float)x * xFactor;
                        ox1 = (int)ox;
                        ox2 = (ox1 == xmax) ? ox1 : ox1 + 1;
                        dx1 = ox - (float)ox1;
                        dx2 = 1.0f - dx1;


                        // interpolate using 4 points
                        {
                            v1 = (float)(dx2 * (inputTexture[ox1, oy1]) + dx1 * (inputTexture[ox2, oy1]));
                            v2 = (float)(dx2 * (inputTexture[ox1, oy2]) + dx1 * (inputTexture[ox2, oy2]));
                            outputTexture[x, y] = (float)(dy2 * v1 + dy1 * v2);
                        }
                    }
                    //  dstIndex += dstOffset;
                }
                break;
            }
            }
            ;
        }
Пример #6
0
 public FilterData(eFilterType i_FilterType)
 {
     m_FilterType = i_FilterType;
 }