Get the color of a pixel on the Stage

Is there a way to retrieve the color of a generic pixel on the screen using the mouse pointer inside the Stage of Flash Player? With the getPixel method of the BitmapData class you can get the color of a pixel only if the mouse is over a bitmap image, but what if I need the color a generic pixel on the screen?

this takes a snapshot of the pixel below the mouse:
function eventHandler(event:MouseEvent):void
     var bmd:BitmapData = new BitmapData(1, 1, false, 0x000000);
     var matrix:Matrix = new Matrix();
     matrix.translate(event.stageX, event.stageY);
     //can never remember which way translate works so it could be:
     //matrix.translate(-event.stageX, -event.stageY);
     bmd.draw(stage, matrix);
     var pixelColour:uint = bmd.getPixel(0, 0);
my blog has more info: http://blog.leeburrows.com/2010/09/bitmapdata-basics-1/

Similar Messages

  • Get the color of a pixel in an image

    how can i do to get the color of a pixel in an image ???
    Can anyone help me ?

    Hi,
    first of all you need to get the library to transfer your image to java.awt.image.BufferedImage object.
    I know many such libraries. Its depends of what kind of image you have: jpeg, gif, png or other.
    And when you get the BufferedImage of you picture using library, then you can get the color of any pixel in image using int BufferedImage.getRGB(int x, int y) as integer value.
    Victor Letunovsky

  • Setting the color of individual pixels in a bufferedimage

    i am trying to set the color of each pixel in a loop as follows:-
    BufferedImage bi=new BufferedImage(w,h,BufferedImage.TYPE-INT_RGB);
    for(int j=0;j<h;j++){
    for(int i=0;i<w;i++){
    pixel=translate(i,j);
    clr=findcolor(pixel);
    if(clr==-1){
    bi.setRGB(i,j,0);
    else
    bi.setRGB(i,j,clr);
    findcolor() function just returns an int, so how do take this integer value and set the appropriate color?
    when i execute this code,in the PaintComponent method of a JPanel class, my entire panel becomes black, this is not because of my first "if" condition.i checked the return value of my findcolor function.
    However if i multiply the color value by a large number like 10000, then i get a few colors only(black,blue, green)
    So please let me know how i can get all colors, without having to multiply the value.

    What do the translate and findcolor methods do?

  • Possible to get the color space and resolution from the .eps file

    Hi all,
    We have using the InDesign CS3 5.0.4, windows, javascript.  We need to get the color space and resolution of the graphics (.eps) file using scripting.
    The properties of the image like (actualPpi and effectivePpi will return the value only for the .tiff. and .jpg etc) but it will not return the .eps file resolution values.
    Kindly give me the suggesting for the decrepancies.
    Regards,
    Nagaraj

    ... open them programmatically in PhotoShop, read out resolution and color space ...
    On opening them in Photoshop, it asks you "what resolution shall I use, and what color space shall I apply?"
    A single EPS may contain any number of embedded bitmaps, with any horizontal and vertical resolution, and in any color space. You can use only a few of these with Illustrator -- and even only one at a time with Photoshop --, but other programs allow just about every possible combination.
    Not to mention procedurally generated bitmaps, also possible with PostScript.

  • HT4623 I have just updated to ios7 on my iphone and don't like the look and feel of this update. Where are all the colors and texture of all the older isos, all those white background colors,yuk. Is a way to go back to the ios6

    I have just updated to ios7 on my iphone and don't like the look and feel of this update. Where are all the colors and texture of all the older isos, all those white background colors,yuk. Is a way to go back to the ios6

    "Unlike".  iOS 7 doesnt display well on my 4S. iOS 6.1.3 should still be supported for older hardware.  I think I shall me moving to Samsung Galaxy now.  Was really hoping hte new iphone would get a bit larger.

  • How to let the user define the colors for each plots in the graph (I use LabVIEW 7)?

    How to let the user define the colors for each plots in the graph (I
    use LabVIEW 7)?

    Hi,
    Take a look at this example, it uses property nodes to select tha
    active plot and then changes the color of that plot.
    If you want to make the number of plots dynamic you could use a for
    loop and an array of color boxes.
    I hope this helps.
    Regards,
    Juan Carlos
    N.I.
    Attachments:
    Changing_plot_color.vi ‏38 KB

  • How to display the color of time period and the legend in Calendar view?

    Hi,
    Sorry to disturb you guys with a quite simple question.
    I want to do a calendar view to display the period of absence for the portal user. I've setup the iView but it displays neither the color of time period nor the legend.
    The problem is:
    1) If I test with <i>static legend</i> (that is, I input the time period directly in the form instead of using data service),
       a) I could only define <b>one</b> time period, because it's impossible to map the <i>out</i> port of calendar to <i>in</i> port of form on defining the event as 'goto'.
       b) I can't see the color displayd while deploying although there is just one time period! Neither the legend. I' ve given the label and color of the legend and assigned the action as default in design board. Why it doesn't work?
    2) If I test with <i>dynamic legend</i> following the chapter "<i>Display Date on a Calendar</i>" in the <i>Modeler's Guide</i> of VC;
        I assigned @RECORDNR to 'ID legend field', and used BAPI_ABSENCE_GETLIST as dynamic legend data service to edit the legend, and assigned the color for every ID. But neither color nor legend could kindly appear. What's the problem? Is there any error in the edit of entry list of the legend?
    Please help me! Thanks!!!

    Is there any advice?
    I'll greatly appreciate your help!

  • What is the color number in HTML of the result line in the web reports

    Hi guys,
    what is the color number in HTML of the result line in the web reports, its like a yellow, but i m looking for the exactly number color to make some modifications, please

    the same should correspond to a CSS class definition. You execute the report - view source and ideally you should be able to find the class associated with the result cells. You can also go an check out the CSS directly.

  • The screen of my MacBook Pro itself periodically switches the color. That is, with the usual colors, on some blue. What to do? Should be repaired, or you can figure out the most? HELP ME PLEASE!

    The screen of my laptop itself periodically switches the color. That is, with the usual colors, on some blue. What to do? Should be repaired, or you can figure out the most? HELP ME PLEASE!

    LambChops1,
    I’m using Mavericks, and it’s still possible to select text to drag and for cutting and pasting. Left-clicking and right-clicking is still possible, too.
    Try opening the Trackpad pane of System Preferences, and select the Point & Click tab. To right-click, ensure that your “Secondary click” checkbox has been checked; the small print under “Secondary click” is a dropdown menu which allows you to select the form of right-clicking that you prefer. (For instance, mine is set to “Click in bottom right corner”.) For left-clicking, is your “Tap to click” checkbox checked, or unchecked? (Mine is unchecked, since I prefer pushing for left-clicking over tapping to do so.)

  • After updating to Mountain Lion, Mail has lost the RSS feeds, the colored marked mails folder, and the notes

    After updating to Mountain Lion, Mail has lost the RSS feeds, the colored marked mails folder, and the notes. Where are they?

    why did they erase something usefull and easy to use?

  • Getting the Color of a Pixel in a Image

    Hi. I need to get the Color of the point in an Image (or ImageIcon). I've seen examples but they use BufferedImages.
    Thanks, Bob

    Here is a simple conversion for you:
    BufferedImage bi = new BufferedImage(myImage, myImage.getWidth(null), myImage.getHeight(null), BufferedImage.TYPE_INT_RGB);
    Graphics g = bi.getGraphics():
    g.drawImage(myImage, 0, 0, null);If you are using ImageObserver objects, then replace null with the corresponding ImageObserver object in the BufferedImage and drawImage.

  • Sampling the color of a pixel

    I have a very simple question: Is it possible for applescript to sample the color of a specific pixel on my screen and store it in a variable? (or three variables as the case may be)
    Thanks

    I knew I saw something like this earlier, but it took me a little while to find it.
    There is a scripting addition called XTools that lets you move the mouse from AppleScript - it is available at http://lestang.org/osax/XTool/XTool-2.0.dmg.tgz . With XTools installed, it is a simple matter to move the mouse to where you want, then tell DigitalColor Meter to copy the color to the clipboard (it isn't scriptable, but you can use keystrokes):
    <pre style="
    font-family: Monaco, 'Courier New', Courier, monospace;
    font-size: 10px;
    margin: 0px;
    padding: 5px;
    border: 1px solid #000000;
    width: 720px;
    color: #000000;
    background-color: #FFEE80;
    overflow: auto;"
    title="this text can be pasted into the Script Editor">
    move mouse {500, 500} -- requires XTool OSAX
    tell application "DigitalColor Meter"
    activate
    tell application "System Events" to keystroke "c" using {shift down, command down}
    end tell
    log (get the clipboard)
    </pre>

  • The color of a pixel in Graphics

    Hi... does anyone know how to get the Color of a specific pixel in a Graphics object??
    For example:
    public void paint(Graphics g) {
    // Something like this would be great! (but it doesn't exist)
      Color c = g.getColor(10,10);
      /* etc... */
    }Does anyone know something about it?

    http://www.rgagnon.com/javadetails/java-0257.html

  • The app icons I have on the iPad have just come up blank with the app name under it. How do I get the colorful icons to appear? The apps do work though

    The Ipad icons are all just a grey box. How do I get the colorful icons?

    First thing to try is a reboot of your iPad. Press and hold the Home and Sleep buttons simultaneously ignoring the red slider until the Apple logo appears. Let go of the buttons and let the iPad restart. See if that fixes your problem.

  • A simple question involving the color of a pixel?

    I'm just wondering, I'm using a BufferedImage to load an image and retrieve the pixels by their location in an image. I looked through the APIs, but I can't seem to figure out how to find the shade of each pixel. I understand that each color has a range within the possibilities of the int returned in the method getRGB(). Does the range denote the shade? Or does the alpha value perhaps? I'm not sure. Any help would be appreciated. Thanks!

    What do you mean by the "shade"? Do you mean hue?
    You might want to look at the HSBtoRGB and RGBtoHSB methods. HSB is a way to describe colors via their hue, saturation, and brightness.
    The alpha value indicates the transparency of the pixel.
    Just out of curiosity, what are you doing?

Maybe you are looking for

  • How to turn off Quick time plugin in Firefox.

    Be peace and happiness upon you! Under Windows XP Home SP2, I recently updated to Firefox 2.0.0.4 and QuickTime 7 seems to crash Firefox 2.0.0.4 every time a flash is loaded into a page. So I was wondering if there was a way to turn QuickTime off in

  • 1.1.3 upgrade help....

    My bad I put this in the wrong forum last time. Anyways I have the newest version of Itunes and I run vista. But everytime I attempt to upgrade my Iphone, I tunes crazy,I've re-installed Itunes 3 times, is there another way?

  • How about a 'place' command?

    When I'm building layouts in Photoshop, I love to use the 'Place' command that is available under the 'File' menu in Bridge. I just select the image I want to add, select 'Place', and it is dropped right into my layout AS A SMART OBJECT, and ready fo

  • My picture gets blurry while streaming

    ANYONE ELSE HAVING THIS PROBLEM IT REALL ***** WHEN WATCHING HBOGO AND NETFLIX

  • Black screen G3 at start up

    M=When I start up my g3 I get a grey screen with the apple, the next screen is a black one with /etc/master.password: Input/output error -sh: /etc/profile: Input/output error -sh-2.05b# in the upper left corner. If I type in anything it says command