Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 762241
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 14, 20262026-05-14T15:56:03+00:00 2026-05-14T15:56:03+00:00

The problem is that I can’t select minimalization filter for Texture2D scaling. There is

  • 0

The problem is that I can’t select minimalization filter for Texture2D scaling. There is MinFilter

GraphicsDevice.SamplerStates[0].MinFilter

But it’s not working. When I try to assign some filter it just changes back to the Linear.

Is there a way to implement my own filter or how to select one of the available?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-14T15:56:03+00:00Added an answer on May 14, 2026 at 3:56 pm

    I have one answer to my own question and i think it will be better to post a new answer for readability.

        private Texture2D Scale(GraphicsDevice gd, Texture2D texture, float scale)
        {
    
            int sourceWidth = texture.Width;
            int sourceHeight = texture.Height;
    
            int destWidth = (int)(sourceWidth * scale);
            int destHeight = (int)(sourceHeight * scale);
    
            //convert texture into bitmap
            byte[] textureData = new byte[4 * sourceWidth * sourceHeight];
            texture.GetData<byte>(textureData);
    
            System.Drawing.Bitmap bmp = new System.Drawing.Bitmap(sourceWidth, sourceHeight, System.Drawing.Imaging.PixelFormat.Format32bppArgb);
            System.Drawing.Imaging.BitmapData bmpData = bmp.LockBits(new System.Drawing.Rectangle(0, 0, sourceWidth, sourceHeight), System.Drawing.Imaging.ImageLockMode.WriteOnly,
                           System.Drawing.Imaging.PixelFormat.Format32bppArgb);
            IntPtr safePtr = bmpData.Scan0;
            System.Runtime.InteropServices.Marshal.Copy(textureData, 0, safePtr, textureData.Length);
            bmp.UnlockBits(bmpData);
    
    
            //output bitmap
            System.Drawing.Image outputImage = new System.Drawing.Bitmap(destWidth, destHeight, System.Drawing.Imaging.PixelFormat.Format24bppRgb);
            System.Drawing.Graphics grPhoto = System.Drawing.Graphics.FromImage(outputImage);
            grPhoto.InterpolationMode = (System.Drawing.Drawing2D.InterpolationMode)(interpolationMode);
    
    
            grPhoto.DrawImage((System.Drawing.Image)bmp, new System.Drawing.Rectangle(0, 0, destWidth, destHeight),
                new System.Drawing.Rectangle(0, 0, sourceWidth, sourceHeight), System.Drawing.GraphicsUnit.Pixel);
    
            grPhoto.Dispose();
    
            textureData = new byte[4 * sourceWidth * sourceHeight];
    
            MemoryStream ms = new MemoryStream();
            ((System.Drawing.Bitmap)outputImage).Save(ms, System.Drawing.Imaging.ImageFormat.Bmp);
            ms.Seek(0, SeekOrigin.Begin);
            Texture2D result = Texture2D.FromFile(gd, ms);
            ms.Dispose();
    
            return result;
        }
    

    This metod runs in about 20ms – 100ms depending on interpolation mode, maybe someone will find it usefull. Is there a way to optimize it? I dont need 32bit support but there seems to be no way to set it to 24. I found different sizing algorithms
    http://www.codeproject.com/KB/GDI-plus/imgresizoutperfgdiplus.aspx
    but they are slow.

    Is there a way to implement these methods using speed of graphic card?

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Ask A Question

Stats

  • Questions 376k
  • Answers 376k
  • Best Answers 0
  • User 1
  • Popular
  • Answers
  • Editorial Team

    How to approach applying for a job at a company ...

    • 7 Answers
  • Editorial Team

    What is a programmer’s life like?

    • 5 Answers
  • Editorial Team

    How to handle personal stress caused by utterly incompetent and ...

    • 5 Answers
  • Editorial Team
    Editorial Team added an answer I don't think this can be disabled right now (Eclipse… May 14, 2026 at 8:38 pm
  • Editorial Team
    Editorial Team added an answer Just write the action and view to render the html… May 14, 2026 at 8:38 pm
  • Editorial Team
    Editorial Team added an answer There are a couple ways I can think of: 1)… May 14, 2026 at 8:38 pm

Trending Tags

analytics british company computer developers django employee employer english facebook french google interview javascript language life php programmer programs salary

Top Members

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.