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

  • Home
  • SEARCH
  • 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 6994491
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T19:53:58+00:00 2026-05-27T19:53:58+00:00

I am building an application that has virtual windows. The output is TImage object.

  • 0

I am building an application that has “virtual windows”. The output is TImage object.

1) The application loads window skin files into TPNGObject‘s:

skin

2) Then application has to create a new blank TPNGObject, and resize the skin files to needed sizes and draw them on that blank image. Should look something like this:

new form

3) And the final output on TImage:

output

The problem is that I do know how to create a completely blank off screen image. Of course I could simply render the skin files on to TImage each time, but it’s easier and better to resize skin files and create the window once, instead.
I’m using the PNG Library by Gustavo Daud, version 1.564 (31st July, 2006).

  • 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-27T19:53:59+00:00Added an answer on May 27, 2026 at 7:53 pm

    I apologize to people that I messed their heads up.

    It turns out CreateBlank works as wanted. The problem was that I was drawing PNG on PNG canvas (PNG.Canvas.Draw). Canvas doesn’t really support transparency. To draw a translucent PNG on another PNG you will need a procedure/function that merges those both layers together. With some googling I ended up with this procedure:

    procedure MergePNGLayer(Layer1, Layer2: TPNGObject; Const aLeft, aTop: Integer);
    var
      x, y: Integer;
      SL1,  SL2,  SLBlended: pRGBLine;
      aSL1, aSL2, aSLBlended: PByteArray;
      blendCoeff: single;
      blendedPNG, Lay2buff: TPNGObject;
    begin
      blendedPNG := TPNGObject.Create;
      blendedPNG.Assign(Layer1);
      Lay2buff:=TPNGObject.Create;
      Lay2buff.Assign(Layer2);
      SetPNGCanvasSize(Layer2, Layer1.Width, Layer1.Height, aLeft, aTop);
      for y := 0 to Layer1.Height - 1 do
      begin
        SL1 := Layer1.Scanline[y];
        SL2 := Layer2.Scanline[y];
        aSL1 := Layer1.AlphaScanline[y];
        aSL2 := Layer2.AlphaScanline[y];
        SLBlended := blendedPNG.Scanline[y];
        aSLBlended := blendedPNG.AlphaScanline[y];
        for x := 0 to Layer1.Width - 1 do
        begin
          blendCoeff:=aSL1[x] * 100/255/100;
          aSLBlended[x] := round(aSL2[x] + (aSL1[x]-aSL2[x]) * blendCoeff);
          SLBlended[x].rgbtRed   := round(SL2[x].rgbtRed + (SL1[x].rgbtRed-SL2[x].rgbtRed) * blendCoeff);
          SLBlended[x].rgbtGreen := round(SL2[x].rgbtGreen + (SL1[x].rgbtGreen-SL2[x].rgbtGreen) * blendCoeff);
          SLBlended[x].rgbtBlue  := round(SL2[x].rgbtBlue + (SL1[x].rgbtBlue-SL2[x].rgbtBlue) * blendCoeff);
        end;
      end;
      Layer1.Assign(blendedPNG);
      Layer2.Assign(Lay2buff);
      blendedPNG.Free;
      Lay2buff.Free;
    end;
    

    Usage:

    var
      PNG1, PNG2: TPNGObject;
    begin
      PNG1 := TPNGObject.CreateBlank(COLOR_RGBALPHA, 16, 500, 500);
      PNG2 := TPNGObject.Create;
      PNG2.LoadFromFile('...*.png');
      MergePNGLayer(PNG1, PNG2, 0, 0);
      // PNG1 is the output
    

    And again, I am really sorry to users that wanted to help, but couldn’t due to not understanding me.

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

Sidebar

Related Questions

I am building an android application that has an Application object ( App )
I am building a simple application that has a few buttons that when clicked
I am building a web application that has a real-time feed (similar to Facebook's
I'm building an application that is used by several different customers. Each customer has
I am building a web application using ASP.NET MVC that has two very distinct
I'm building an application that is targeting Windows, Mac and Linux soon. I was
I'm building an application that has its own custom chrome. I have turned the
We're building an application that has a database (yeah, pretty exciting huh :). The
I'm building an application that search and recognizes any iPhone apps that user has
I have an application that I'm building that has had concurrency problems in the

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.