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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 21, 20262026-05-21T18:57:11+00:00 2026-05-21T18:57:11+00:00

Here’s what I want to do. An image is loaded by default when the

  • 0

Here’s what I want to do. An image is loaded by default when the app is run. There is a way to load another image the user wants by specifying an url. When the user defined image is loaded, the default image is still in the background and there are some method that would be used to apply some filters on the image as a whole (I mean the resultant image with both the default and the user loaded image blended) and then I want to save the final image as jpg or png.

Now, I am still a beginner at Flex, and getting all confused with all the canvas, image control, bitmapdata etc. Where I want help is what’s the best way to implement what I want? Should I load the default image into an Image with url/embed or should I load it as a BitmapData, how do I load the second user defined image? Whats the best way to blend the two images?

  • 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-21T18:57:11+00:00Added an answer on May 21, 2026 at 6:57 pm

    You can leave the default image as embedded one, and retrieve its BitmapData to work with further.

    When the user-defined image is loaded, you retrieve its BitmapData, and draw the embedded image over the user-defined one:

    /**
     * An embedded image's class (your default image)
     */
    [Embed(source="/assets/logo.png")]
    public static var Logo:Class;
    
    /**
     * @param bitmapData: The user-defined BitmapData that you want to modify
     * @param matrix: The transofrmation matrix applied to the resulting BitmapData 
     */
    public function getCustomBitmapData(bitmapData:BitmapData, matrix:Matrix):BitmapData
    {
        // Initialize and drawing the resulting BitmapData's first layer 
        var result:BitmapData = new BitmapData(bitmapData.height, bitmapData.width);
        result.draw(bitmapData, matrix);
    
        // Load the BitmapData of the embedded Logo image
        var bitmapAsset:BitmapAsset = new Logo();
        var logoBd:BitmapData = bitmapAsset.bitmapData;
    
        // Draw the logo over the result with an alpha of 0.3
        result.draw(logoBd, matrix, new ColorTransform(1, 1, 1, .3));
        //TODO: You should play with the size of the images, apply filters, etc.
    
        return result;
    }
    

    Then you can save the resulting BitmapData instace to the local file system:

    /**
     * Save the BitmapData to a local file
     * @param bitmapData: the data to save
     */
    public function saveBitmapData(bitmapData:BitmapData):void
    {
        // Initialize the encoder
        var pngEncoder:PNGEncoder = new PNGEncoder();
        // Encode the BitmapData and save its byte array
        var imageBytes:ByteArray = pngEncoder.encode(bitmapData);
        // Create a new FileReference:
        var imageFile:FileReference = new FileReference();
        // Save the file:
        imageFile.save(imageBytes, "myimage.png");
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Here's my scenario - I have an SSIS job that depends on another prior
Here is the scenario: I'm writing an app that will watch for any changes
Here, i have coded to get data from DB. I want to store the
Here's a basic regex technique that I've never managed to remember. Let's say I'm
Here's a problem I ran into recently. I have attributes strings of the form
Here is the issue I am having: I have a large query that needs
Here is a simplification of my database: Table: Property Fields: ID, Address Table: Quote
Here is my code, which takes two version identifiers in the form 1, 5,
Here's a coding problem for those that like this kind of thing. Let's see
Here's an interesting problem. On a recently installed Server 2008 64bit I opened IE

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.