isValid in BitmapData parameter

Hello

I don't know if this has been asked before, but it would be difficult to add an isValid parameter to BitmapData?

Currently, that's what I have to do to understand:

try {myBitmapData.width ;}

catch (error) {return ;}

Unless I'm missing something and there is already something to help me.

Thank you.

This works if a BitmapData is null, not if it has been deleted.

Tags: Adobe

Similar Questions

  • Blend two bitmaps in a new BitmapData, using a blend shader

    Hello

    I have:

    Two images of the same size as bitmap BitmapData.

    I want to:

    A largest BitmapData, with the two images mixed in a slope like that...

    1st row: [BitmapData 1]

    2nd row: [BitmapData BitmapData 2 1 mixed up on the top of the page, alpha 0.1]

    Row 3: [1 BitmapData with BitmapData 2 mixed up on 0.2, alpha]

    Row 4: [1 BitmapData with BitmapData 2 mixed on 0.3, alpha]

    ....

    Line n: [BitmapData [2]

    ------------------------------------

    I can easily implement this using the standard alpha blending. However, I would use my own algorithm of mix, and do it with actionscript is too slow. Therefore, I would like to implement the merge as a Pixel Bender shader function. I came here to make a function that works with the standard alpha blending and no shader custom involved:

    protected function createGradientLookupTable( bitmapAtBlend0:BitmapData, bitmapAtBlend1:BitmapData, steps:uint ):BitmapData {
        var gradient:BitmapData = new BitmapData( 256, bitmapAtBlend0.height * steps );
        var translationMatrix:Matrix = new Matrix();
        var alphaTransform:ColorTransform = new ColorTransform();

        for( var row:int = 0; row < steps; row++ ) {
            gradient.draw(bitmapAtBlend0, translationMatrix);
            alphaTransform.alphaMultiplier = row / ( steps - 1 );
            gradient.draw(bitmapAtBlend1, translationMatrix, alphaTransform );
            translationMatrix.translate( 0, bitmapAtBlend0.height );
        }

        return gradient;
    }

    This method works. At first, I did a fusion of shader to Pixel Bender, just to check if I can load into my Flash Builder project and operate standard alpha. This filter works in Pixel Bender 2.5:

    <languageVersion : 1.0;>
    kernel BlendHCL
    <   namespace : "com.yadayada";
        vendor : "Yada Yada";
        version : 1;
        description : "Blends colors using hue chroma luma";
    >
    {
        input image4 src1;
        input image4 src2;
        output pixel4 dst;

        parameter float alpha;

        void
        evaluatePixel()
        {
            float4 pixelBottom = sampleNearest(src1,outCoord());
            float4 pixelTop = sampleNearest(src2,outCoord());

            dst = pixelBottom + ( pixelTop - pixelBottom ) * alpha;

        }
    }

    Don't mind the description etc., currently it's supposed to only must accept a parameter alpha and mix using the standard alpha blending. Just to see I can make it work. Here is my Actionscript code is modified to use the custom mixer, this code does NOT work:

    protected function createGradientLookupTable( bitmapAtBlend0:BitmapData, bitmapAtBlend1:BitmapData, steps:uint ):BitmapData {
        var gradient:BitmapData = new BitmapData( 256, bitmapAtBlend0.height * steps );
        var translationMatrix:Matrix = new Matrix();
        var bitmap1:Bitmap = new Bitmap( bitmapAtBlend1 );
        var blendShader:Shader = new Shader( blendShaderCode );

        for( var row:int = 0; row < steps; row++ ) {
            gradient.draw(bitmapAtBlend0, translationMatrix);
            blendShader.data.alpha.value = [ row / ( steps - 1 ) ];
            bitmap1.blendShader = blendShader;
            try {
    //            gradient.draw( bitmap1, translationMatrix ); // doesn't work
                gradient.draw( bitmap1, translationMatrix, null, BlendMode.SHADER ); // doesn't work either
            }
            catch( e:Error ) {
                trace( "Error happened! " + e.message ); // No error messages reported
            }
            translationMatrix.translate( 0, bitmapAtBlend0.height );
        }

        return gradient;
    }

    This code change does not report the errors, it is just as if the alpha is always 1.0. The second image completely replaces the first. This is the expected result if the shader blend is not implemented at all. All the example code that I find using a blend shader, mixes just the colors directly on the screen, not in a new Bitmap or BitmapData object. Can anyone help?

    PS: Debugging in Flash Builder 4.7 and inspect the variables indicate that I have an object valid shader (blendShader).

    It seems to me I couldn't do it as I wanted. Instead, I created a shader that could create the gradient while only once and actually an object instance ShaderJob in Flash to do the job. Here is the code of the shader which results from:

    
    
    kernel BlendHCL
    <   namespace : "com.yadayada";
        vendor : "Yada Yada";
        version : 1;
        description : "Blends colors using hue chroma luma";
    >
    {
    
        input image4 src1;
        input image4 src2;
        output pixel4 dst;
    
        parameter float imageHeight
        <
            minValue:     1.0;
            maxValue:    64.0;
            defaultValue: 2.0;
            description: "The height of the images that will be blended in the gradient result";
        >;
    
        parameter float steps
        <
            minValue:      2.0;
            maxValue:   1024.0;
            defaultValue: 64.0;
            description: "The number of shades in the gradient";
        >;
    
        void
        evaluatePixel()
        {
    
            float2 sampleCoord = outCoord();
    
            sampleCoord.y = mod( sampleCoord.y, imageHeight );
    
            float4 pixelBottom = sampleNearest(src1,sampleCoord);
            float4 pixelTop = sampleNearest(src2,sampleCoord);
    
            float alpha = floor( outCoord().y / imageHeight ) / ( steps - 1.0 );
    
            dst = pixelBottom + ( pixelTop - pixelBottom ) * alpha;
    
        }
    }
    
    

    The following Actionscript code:

              public function createGradientLookupTable(bitmapAtBlend0:BitmapData, bitmapAtBlend1:BitmapData, steps:uint):BitmapData {
                   var shader:Shader = new Shader( blendShaderCode );
    
                   shader.data.imageHeight.value = [ Number( bitmapAtBlend0.height ) ];
                   shader.data.steps.value = [ Number( steps ) ];
    
                   shader.data.src1.input = bitmapAtBlend0;
                   shader.data.src2.input = bitmapAtBlend1;
    
                   var result:BitmapData = new BitmapData( 256, bitmapAtBlend0.height * steps );
    
                   var shaderJob:ShaderJob = new ShaderJob(shader, result);
    
                   shaderJob.start( true );
    
                   return result;
    
              }
    
    
    

    It worked. The shader still conducting a standard alpha blending, but now I go to do the actual shader of coding.

  • BitmapData with decimal values

    Hello

    I use bitmapdata feature with decimal value. But it takes only a round value. It's all possible ways to do... ?

    If I give as below,

    desBmp = new BitmapData (163,9, 192,9);

    It takes like,

    desBmp = new BitmapData (163, 192);

    I want the exact value to be considered as the width and height. Is there any option to do, of trying to help me.

    Kind regards

    Kelifaoui has.

    is not possible and there is no reason: you can't use a fraction of a pixel in the display.

    for smoothing, use the smooth parameter with the draw method.

  • Combining the BitmapData?

    I am writing a slide show that takes an image at random from a Media RSS feed and creates a bitmap and adds it to the stage in a random scene position so that each new image on top of the last.

    The actionscipt works very well, but after a while, the computer of memory and I get an ArgumentError: Error #2015: invalid BitmapData. error.

    My thought was, instead of add children to the top of the child, I just add the new image of the original bitmap or maybe a copy of the bitmap and Exchange from the old to the new with each image newly added.

    It is a possible solution and can someone help me with some ideas of code? All BitmapData.draw () examples of addig only one object at a time by the bitmap. I don't know if it is possible to add/merge/combine bitmaps.

    Yes, it is certainly possible. I used this to combine up to 10,000 images bitmap in a single bitmap with great performance. What you want to do is make your original bitmap data to the size of the step to full, then when you draw in you use the parameter matrix of the draw method to place the copy.

    Here are a few examples of code to show what I mean:

    var a: BitmapData = new BitmapData (550,400);
    var b:BitmapData = new BitmapData (50, 50, false, 0xFF0000);

    var m:Matrix new matrix());
    m.translate (50,50);

    var c:Bitmap = new Bitmap (a);
    addChild (c);

    a.Draw (b, m);
    m.translate (50,50);
    a.Draw (b, m);

  • How to get bitmapData from an Image control

    Hello

    Can someone help me understand this. I know I can use the "embed" tag to get the MXML compiler to associate a .jpg file with a class and then create a BitmapAsset object - and exit at his 'bitmapData '.

    I am loading files from a server dynamically .jpg using the Image control. I don't think that the Image control has a property 'bitmapData '. How to get a BitmapAsset of an Image control?

    Those of you guys informed here searching to help noobs - ty much in advance.

    the Image control was a parameter called the content that you can access only if the crossdomain.xml allows...

    This parameter is a Bitmap and contains the Bitmap bitmapData class...

  • The showOneOffButtons parameter is missing in topic: config. How can I add?

    The browser.search.showOneOffButtons parameter is missing in topic: config. I the Restorer of theme Classic firefox installed and the setting is missing there also. How can I add this setting back to the search box?

    The pref browser.search.showOneOffbuttons is no longer supported in Firefox 43 +.
    You can find this function in the Options/preferences of CTR.

    • CTR Options > general UI (1)-> old research (experimental)
  • How can I get rid of the parameter/folder synchronization and storage

    In our account settings, we have a parameter/folder synchronization & storage how do I get rid of it

    Why? This isn't a folder that you store emails in, its part of an IMAP accounts Setup.
    In IMAP e-mails are kept on the server and synchronization MUST intervene to allow you to delete, move, etc to have your file server and your T-bird records show the same mails.

  • In one of my firefox browser, the header/footer margin setup parameter is inches, I need to change it to milimeter to inches. Your help is appreciated.

    In one of my firefox browser, the header/footer margin setup parameter is inches, I need to change it to milimeter to inches. Your help is appreciated.

    As far as I KNOW Firefox displays the metric or Imperial depending on the type of paper selected for printing. If you are using A4, you should get millimeters/metric.

  • My default size for printing the letter, but it retains the impression as if a parameter is set to 8X6.75. How can I fix it?

    Firefox has recently updated to 40.0.2. Just back from a week off the coast of the work to discover, it was the incorrect impression. The printer is said to add 8X6.75 paper to print. Firefox settings are defined on 11X8.5 and all other browsers are printing very well.

    If Firefox does not use the entire sheet of paper, it can result from after having extracted Windows incorrect paper size settings when reading data from the print driver. Compensation it may involve conclusions some mask parameters, but here goes:

    (1) in a new tab, type or paste Subject: config in the address bar and press ENTER. Click on the button promising to be careful.

    (2) in the search above the list box, type or paste print and make a pause so that the list is filtered

    (3) for each parameter of the problem printer, right click and reset The fastest way is to click with the mouse and press the r key on the keyboard with your other hand.

    Note: In a few other discussions involving printers Brother, printer_printer_name.print_paper_data preference has been set to 256 and when the user changed it to 1 that solved the problem of paper size. If you see a 256 here, you can change the value by double-clicking it or by using the right click > modify.

    Any improvement?

  • Browser.Tabs.on.Top parameter does not work in Firefox 29 - please fix this!

    Before v29, browser.tabs.onTop set to false has worked very well. V29 makes this useless parameter, and now I'm stuck now with a browser that looks like a Microsoft or Google. Please fix immediately!

    The beta version of Firefox to the current address has interface Australis which seems different from the UI in Firefox 28 and lower versions.

    The pref pref browser.tabs.onTop is no longer supported in Firefox 29

    You can watch the classic extension theme restaurateur restore some lost features, including the tabs on top.

    You can also move the tabs on the lower position, just above the navigation area without the use of an extension cord with code to userChrome.css that basically, you just give the tab bar a higher value of - moz-box-ordinal-group (most toolbars have a default value for - moz-box-ordinal-group: 1 to show them in the order of DOM).

    @namespace url("http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"); /* only needed once */
    
    #TabsToolbar { -moz-box-ordinal-group:10000 !important; }
    
  • About: config is the network parameter. IDN.blacklist_chars that contains what looks like the trash graphics characters - is this normal?

    About: config is the parameter "network. IDN.blacklist_chars' that contains what looks like garbage graphics characters.

    It's a bit weird - as it is corrupt.

    Is this normal?

    Thank you!

    Good to know.

  • FIRST HP: Solving a system of linear equations with a parameter

    Hello

    I know how to solve a system of linear equations by using a setting by hand but I don't know how to set up in the calculator.

    Can someone please help me solve the system of linear equations below with a 'p' on the first HP Calculator next parameter?

    2 x + 8z = 26

    4 x-4y-14z = - 38

    8 x - 4y + 2z = 14

    The answer to the above equations is:

    x = 13 - 4, =(45-15p)/2, z = p y p

    Thank you

    Arthur

    Hello

    What you're trying to solve is not really a system of equation with a parameter, but you try to solve a set of 2 equations with 2 variables (x and y).

    The case solve command can do for you.

    According to the CASE, type:

    Solve ([(2*x+8*z) = 26,(4*x-4*y-14*z) = - 38,(8*x-4*y+2*z) = 14], [x, y])

    Come in

    and the calculator will return

    {[-4 * z + 13, 15/2 * z + 45/2]}

    which is what you want.

    Cyrille

  • Whenever I run firefox, it tells me that the proxy parameter is incorrect.

    Sometimes after that I changed my proxy in a few days.
    Now, each time after I start Firefox, I have to click on option-> proxy setting then click OK without any change or changes of mirror, it works then.

    I can't save my setting in the option-> proxy page. Whenever I run firefox, the proxy parameter is selected as "manual" with nothing in the IP blanks, although I changed it to 'Auto' last before closing.

    The problem is not fixed under the 'Disabled add-ons' mode. The removal of caches, cookies or sth otherwise don't work or the other.

    What should I do? answer me, it's annoying.

    Start Firefox in Firefox to solve the issues in Safe Mode to check if one of the extensions or if hardware acceleration is the cause of the problem (switch to the DEFAULT theme: Firefox/tools > Modules > appearance/themes).

    See also:

  • How can I start Firefox with a parameter passed html file

    I want to leave Windows (7), passing a local html file name as a parameter to use this html page for the start page of Firefox. There is no help or documentation on the parameters of start (a major deficit oversight or program)

    It should work in a .cmd or .bat file.

    start "" "C:\Program Files (x86)\Mozilla Firefox\Firefox.exe" "C:\Users\DES\Documents\MSData\HTML\GPD.shtml"
  • Binding parameter, action - invert action B

    Hello everyone I wanted to ask a question of a movement function, it is possible, two data objects (two lines) associated with a contrast value linking the subject of 'source '? I mean I have two parallel lines between them, line A (source) and line B (link on the parameter Transform - Position - y of the source of the a line), if I reduce the line -20px I want the line B increases instead of + 20px, instead has + 20px - 20px-B, then apply an equal and contrary to the source value.

    This possibility is real? I tried, but couldn't find a good solution, thanks for the replies, I am attaching the photograph

    OK SOLVED!

    The solution is called "scale parameter" + 1 regular - 1 applies to the reverse

Maybe you are looking for