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 7786399
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 1, 20262026-06-01T20:24:40+00:00 2026-06-01T20:24:40+00:00

I need to change the value of the alpha component when a pixel contains

  • 0

I need to change the value of the alpha component when a pixel contains a specific color for a TBitmap of 32 bits, I know about the ScanLine property to access the bitmap data, but i can’t figure out how change the alpha component of each pixel.

  • 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-06-01T20:24:41+00:00Added an answer on June 1, 2026 at 8:24 pm

    This is a basic implementation

    First you need define a record to hold the ARGB structure

      TRGB32 = record
        B, G, R, A: byte;
      end;
    

    Then you must define a array of TRGB32 to cast the Scanline and get and set the values.

    Check this sample method

    procedure SetAlphaBitmap(const Dest: TBitmap;Color : TColor;Alpha:Byte);
    type
      TRGB32 = record
        B, G, R, A: byte;
      end;
      PRGBArray32 = ^TRGBArray32;
      TRGBArray32 = array[0..0] of TRGB32;
    var
      x, y:    integer;
      Line, Delta: integer;
      ColorRGB : TColor;
    begin
      if Dest.PixelFormat<>pf32bit then  exit;
    
      ColorRGB:=ColorToRGB(Color);
      Line  := integer(Dest.ScanLine[0]);
      Delta := integer(Dest.ScanLine[1]) - Line;
      for y := 0 to Dest.Height - 1 do
      begin
        for x := 0 to Dest.Width - 1 do
          if TColor(RGB(PRGBArray32(Line)[x].R, PRGBArray32(Line)[x].G, PRGBArray32(Line)[x].B))=ColorRGB then
            PRGBArray32(Line)[x].A := Alpha;
        Inc(Line, Delta);
      end;
    end;
    

    Also you can take a look to this unit that i wrote to manipulate 32 bit bitmaps

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

Sidebar

Related Questions

I need to change the alpha value for the UIButton can any one suggest
I need to change the value of a versioned custom property of a svn
I need to change the value of a versioned custom property of a file
basically need to change the value that - admin_url() returns any idea?
I need to change the value of the url of the onclick portion of
I need to change the DPI of the System.Drawing.Bitmap object from the default value
i need change color of SystemTray.ProgressIndicator color, how i can do it? I tried
I need change a value in a ini file like this val2 is the
i am trying to incrementally change the alpha value of an OvalShape().. for this
I need to change the value of newiconid[0] to arg2 from method onItemSelected() .

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.