How to change the color of the same colored sections of an image according to the colorpicker. ?

Hello.. How are you all... ?


I do a small program to change the color of these sections of an image that have the same color, according to the chosen of the colorpicker color...


Say of the colorpicker, we selected a color, and then mouse click on the image event changes the color of those parts of the image that have the same color as the selected portion (or pixel) to the selected color... If we have selected FF0000 in the colorpicker and then clicked 3300CC color pixel in the image. This should change the color of all pixels of color-3300CC in the image...

I have a colorpicker [colpickr] and a movieclip [mc] the image on the stage. I created a bitmap of the same image (imag1) using the code. Select the color in the colorpicker and a mouse click on the movieclip (here I used getPixel) will change the color in the bitmap image to the selected (with setPixel) color. I have two images; one is a movieclip (inorder to add the listener for the click event), and one is a bitmap (to set the setPixel property). But I need a single image.

Please help me with this... Below is my code (horrible)...

import flash.events.MouseEvent;

Import 12345678910111213import;

import flash.display.BitmapData;

import flash.net.URLRequest;

import flash.display.Loader;

var c = 0;

var myBitmapData:BitmapData;

var bm:Bitmap;

colpickr.selectedColor = 0xffffff;

preLoader var;

var urlReq;

var preloader_img:MovieClip;

preLoader = new Loader();

preLoader.unloadAndStop ();

urlReq = new URLRequest ("imag1.jpg"); I chose the same image as that of movieclip mc

preLoader.load (urlReq);

preLoader.contentLoaderInfo.addEventListener (Event.COMPLETE, preLoaderComplete);

creates a bitmap of mc...

function preLoaderComplete(loadEvent:Event) {}

myBitmapData = new BitmapData (mc.width, mc.height);

myBitmapData.draw (mc);

BM = new Bitmap (myBitmapData);

addChild (bm);

BM. Width = mc.width;

BM. Height = mc.height;

}

mc.addEventListener (MouseEvent.CLICK, _onMouseClick);

Gets the color of mc and affects the color bitmap

function _onMouseClick(event:MouseEvent):void {}

var myColor:uint = myBitmapData.getPixel (mc.mouseX, mc.mouseY);

c = myColor.toString (16);

for (var i = 0; i < bm.width; i ++) {}

for (var j = 0; j < bm.height; j ++) {}

If (myBitmapData.getPixel(i,j).toString (16) == c) {}

myBitmapData.setPixel (i, j, colpickr.selectedColor);

}

}

}

}

Try this:

import flash.events.MouseEvent;

Import 12345678910111213import;

import flash.display.BitmapData;

import flash.net.URLRequest;

import flash.display.Loader;

var c = 0;

var myBitmapData:BitmapData;

var bm:Bitmap;

colpickr.selectedColor = 0xffffff;

preLoader var;

var urlReq;

var preloader_img:MovieClip;

preLoader = new Loader();

preLoader.unloadAndStop ();

urlReq = new URLRequest("z_bitmaps/image1.jpg"); / / I chose the same image as that of movieclip mc

preLoader.load (urlReq);

preLoader.contentLoaderInfo.addEventListener (Event.COMPLETE, preLoaderComplete);

creates a bitmap of mc... ;

function preLoaderComplete(loadEvent:Event) {}

BM = Bitmap (loadEvent.target.loader.content);

addChild (bm);

}

stage.addEventListener (MouseEvent.CLICK, f);

function f(e:MouseEvent):void {}

If (BM.hitTestPoint (MouseX, MouseY) &! colpickr.hitTestPoint (mouseX, mouseY)) {}

_onMouseClick (e);

}

}

Gets the color of mc and affects the color bitmap

function _onMouseClick(event:MouseEvent):void {}

c = BM. BitmapData.GetPixel (BM. MouseX, BM. MouseY);

for (var i = 0; i)

for (var j = 0; j)

If (bm.bitmapData.getPixel (i, j) == c) {}

bm.bitmapData.setPixel (i, j, colpickr.selectedColor);

}

}

}

}

Tags: Adobe Animate

Similar Questions

  • How to change the background color of the code written DW page but not the Web page...

    How to change the background color of the code written DW page but not the Web page...

    If you have DWCC2015, you can change to edit > Preferences > coloring Code and either choose a new theme (RecoGnEyes is the background dark code by default) or you can change it to what you want in the background field by default.

    2014 CC had no theme options, but you can change the background color in the same place.

    I think that some of the previous versions also had the option, but I don't have them on my machine to check.

  • How to change the color of car Pic?

    can anyone help please, how to change the color of car Pic?

    Thank you

    Rental Mobil Jogja

    You have a few options open to you:

    There is a tutorial called, 'Replace the colors' in the tutorials folder when you first open touch of the PS. Which follow, and then apply what you have learned in your image of car.

    You also have the option to use a brush of FX. (Click on the active tool in the top left, slide down and hold over the brush icon; a drawer must get out where you can select the brush icon fx.) Press the option below the brush option to select a desired FX (color balance is listed here, the same effect used in the PS Touch tutorial). You must use this brush in roughly the same way you learned to replace colors in the tutorial "replace color", into an area selection using the selection tools before painting.

  • How to change the highlight color, click the button image and text and sound.  are there packages of buttons for use in my project?

    How to change the highlight color, click the button image and text and sound. are there packages of buttons for use in my project?

    Hello

    Even if the point of things based Web links buttons created using them is of simple images. Captivate uses simple images. If you need to put your creative hat and not to let the fact that you see the word 'web' scared you somehow. An image is an image. Use on the web, use Captivate. Same case!

    If you change the properties of the button, you can activate the legend of success. Fix any sound that you like with the legend of success and it will play when you click the button. If you do not want to see the legend of success, delete the text and configure it as transparent.

    See you soon... Rick

    Useful and practical links

  • How to change the color of pre-rendered screen.

    My question is how to change the color of the page that is displayed before a site is fully charged. So let's say I go to a site where the background color is red. Before the end of Firefox loading it will appear as white. Also yes I have known that I have an add-on which changes the default color of YouTube. However the first picture comes on all websites no matter if their background is white or not.

    You can try the userChrome.css code or elegant.

    Add code to the file userChrome.css below default @namespace.

    @namespace url("http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"); /* only needed once */
    
    browser {background-color:#f0f0f0!important}
    

    The file userChrome.css (UI) customization and userContent.css (Web sites) are located in the folder of chrome in the Firefox profile folder.

    You can use this button to go to the current Firefox profile folder:

    • Create the folder chrome (lowercase) in the .default < xxxxxxxx > profile folder if the folder does not exist
    • Use a text editor like Notepad to create a userChrome.css (new) file in the folder chrome (file name is case sensitive)
    • Paste the code in the userChrome.css file in the Editor window
    • Make sure that the userChrome.css file starts with the default @namespace line
    • Make sure that you select "All files" and not "text files" when you save the file via "save file as" in the text editor as userChrome.css.
      Otherwise, Windows can add a hidden .txt file extension and you end up with one does not not userChrome.css.txt file
  • It is difficult to see how to change the color of the scrollbar in gray on gray background?

    It is difficult to see how to change the color of the scrollbar in gray on gray background?

    I think you should probably use an extension or theme to replace the default colors.

    If you are not interested in all the changes that might come with a new theme, is the next extension compatible with Linux?

    https://addons.Mozilla.org/firefox/addon/noiascrollbars/

  • How to change the background of the playlist window colors in iTunes

    The background color of my playlist 'window' in iTunes is black, which is difficult to read.  How to change the background of all the playlists to a light color.

    All the indications are that the selected background colors are random and cannot be changed. If someone knows a way to change them please let us know.

  • How to change the color of the mailbox that contains new messages

    I have Thunderbird sort my incoming mail into different mailboxes based on different criteria.

    Until recently, the arrival of new messages in any box, the title of this box (in the list, the left pane) became Red - which makes it easy for me to identify what boxes necessary to my attention. For some reason, it stopped. The incremental number indicating the number of unread to messages always changes, but the color of title remains black.

    Someone knows how to change the behavior in order to highlight the mailboxes containing new messages please?

    Thank you...

    by using a theme? or a userchrome file?

  • How I change the fonts and colors of default return?

    I changed the font and the color of the text through the Tools button and the button options and the tab content. I can't find anything tell me how to change the fonts and colors to the colors and fonts by default. Can you advise me? I use Windows 7 Home Premium OS. Thank you.

    Hi Brenda19605,

    You can use this article to set the fonts and colors: https://support.mozilla.org/en-US/kb/change-fonts-and-colors-websites-use?esab=a & s = do & r = 0 & s = as

    The default settings for the police are in this article:
    https://support.Mozilla.org/en-us/KB/some%20text%20shows%20up%20bold%20after%20upgrade

    Unfortunately for the default color has no good reference. For the text, but it is black (most lower-left), the background is white (color above left). Unvisited links is blue (column 8, line 5) and the visited link is purple (column 9, line 5).

    Let me know if you need help more!

    Lordfreak

  • How to change the font colors in the communities of support?

    How to change the font colors in the communities of support?

    Thank you

    Press or click on use the Advanced Editor in the upper right of this text block which will take you to it.

  • How to change the color of Satellite Pro P300 settings

    I just received my new laptop computer and cannot for the life of me find how to change the color settings in the monitor.
    My old desk there was a button on the monitor.

    In a first time laptop user im nuts will try to find how to change my monitor settings...

    If anyone can help id be so grateful

    Please don t mix the portable computers internal monitor with external PC monitor.
    You won't find any control unit and on the external monitor that would help you to change the color.

    I put t know what your laptop smart chart uses but my laptop supports Intel graphics card and pre-installed (in Control Panel) Intel Graphics Media Accelerator provides a few color correction settings.
    The parameters are; color, gamma, brightness and contrast

    Here, you can set values between 0 and 100

    Maybe it's what you're looking for

  • How to change the settings on the Equium A100 color & contrast

    Does anyone know how you change the settings on the Equium A100 color & contrast? Thank you.

    Hello

    Change the contrast and color?
    Well buddy, you can change the screen brightness level using the FN + F6 and F7 key combination of.
    The other settings are only editable in the properties of the graphics card.
    I put t know what graphics card you are using but usually you must search advanced options.
    Check if there is no gamma, brightness or contrast settings.

    I found these settings on my laptop. I have a graphics card intel and the option was called the color correction

  • How to change the color of the Apple Watch pointer?

    How to change the color of the Apple Watch pointer? In the style of color Apple Watch ca change you the color of the masince, complication, brands, etc. However, the needle of the hours and minutes remains white and red dark second pointer. Is there a way to set the pointers to become Gold?

    Hello

    It is not currently possible to customize the color of the hand or the second on the color dial hand.

    If a customization option is not specified for any feature of any particular face watch, then it cannot be customized.

    More information:

    https://help.Apple.com/watch/#/apd6ce85daf4

  • Satellite A210-109: how to change the color temperature of the display?

    I want to know how to change the color temperature of the screen of my laptop? Theres no option in the ATI catalyst and no toshiba utility, where I can change this? I have the latest installed toshiba display drivers.

    Hello

    you mean the gamma settings? I don't know if the ati drivers are able to do, but you can try the program "powerstrip" (www.download.com/PowerStrip/3000-2086_4-10395724.html), which can change the color and the parameter gamma for graphics cards.

    Just give it a try and you will get your favorite color settings. :)

    Welcome them

  • How to change the colors of default keynote

    In all the 'Office' of Apple apps - Keynote, Numbers, Pages - there are a number of standards of colors that can be selected in the popup. They are different for each theme. This is as follows. How can change these colors?

    In the filling of style inspector, click the multicolored circle to open the color palette, select the color you want to add to the fill color.

    Click the current fill patch, and then drag down to an existing patch to replace.

    New color fillings will be saved with the presentation, and you can create a custom theme to use for other presentations. (File > save the theme)

Maybe you are looking for