Search Results

Search found 2807 results on 113 pages for 'ash blue'.

Page 9/113 | < Previous Page | 5 6 7 8 9 10 11 12 13 14 15 16  | Next Page >

  • Java image conversion to RGB565

    - by Vladimir
    I try to convert image to RGB565 format. I read this image: BufferedImage bufImg = ImageIO.read(imagePathFile); sendImg = new BufferedImage(CONTROLLER_LCD_WIDTH/*320*/, CONTROLLER_LCD_HEIGHT/*240*/, BufferedImage.TYPE_USHORT_565_RGB); sendImg .getGraphics().drawImage(bufImg, 0, 0, CONTROLLER_LCD_WIDTH/*320*/, CONTROLLER_LCD_HEIGHT/*240*/, null); Here is it: Then I convert it to RGB565: int numByte=0; byte[] OutputImageArray = new byte[CONTROLLER_LCD_WIDTH*CONTROLLER_LCD_HEIGHT*2]; int i=0; int j=0; int len = OutputImageArray.length; for (i=0;i<CONTROLLER_LCD_WIDTH;i++) { for (j=0;j<CONTROLLER_LCD_HEIGHT;j++) { Color c = new Color(sendImg.getRGB(i, j)); int aRGBpix = sendImg.getRGB(i, j); int alpha; int red = c.getRed(); int green = c.getGreen(); int blue = c.getBlue(); //RGB888 red = (aRGBpix >> 16) & 0x0FF; green = (aRGBpix >> 8) & 0x0FF; blue = (aRGBpix >> 0) & 0x0FF; alpha = (aRGBpix >> 24) & 0x0FF; //RGB565 red = red >> 3; green = green >> 2; blue = blue >> 3; //A pixel is represented by a 4-byte (32 bit) integer, like so: //00000000 00000000 00000000 11111111 //^ Alpha ^Red ^Green ^Blue //Converting to RGB565 short pixel_to_send = 0; int pixel_to_send_int = 0; pixel_to_send_int = (red << 11) | (green << 5) | (blue); pixel_to_send = (short) pixel_to_send_int; //dividing into bytes byte byteH=(byte)((pixel_to_send >> 8) & 0x0FF); byte byteL=(byte)(pixel_to_send & 0x0FF); //Writing it to array - High-byte is second OutputImageArray[numByte]=byteH; OutputImageArray[numByte+1]=byteL; numByte+=2; } } Then I try to restore this from resulting array OutputImageArray: i=0; j=0; numByte=0; BufferedImage NewImg = new BufferedImage(CONTROLLER_LCD_WIDTH, CONTROLLER_LCD_HEIGHT, BufferedImage.TYPE_USHORT_565_RGB); for (i=0;i<CONTROLLER_LCD_WIDTH;i++) { for (j=0;j<CONTROLLER_LCD_HEIGHT;j++) { int curPixel=0; int alpha=0x0FF; int red; int green; int blue; byte byteL=0; byte byteH=0; byteH = OutputImageArray[numByte]; byteL = OutputImageArray[numByte+1]; curPixel= (byteH << 8) | (byteL); //RGB565 red = (curPixel >> (6+5)) & 0x01F; green = (curPixel >> 5) & 0x03F; blue = (curPixel) & 0x01F; //RGB888 red = red << 3; green = green << 2; blue = blue << 3; //aRGB curPixel = 0; curPixel = (alpha << 24) | (red << 16) | (green << 8) | (blue); NewImg.setRGB(i, j, curPixel); numByte+=2; } } I output this restored image. But I see that it looks very poor. I expected the lost of pictures quality. But as I thought, this picture has to have almost the same quality as the previous picture. - Is it right? Is my code right?

    Read the article

  • Windows Vista Nested Desktop Folders Problem

    - by Samuel Walker
    I have no idea how, nor when this happened, and it's started to really quite annoy me. When navigating through Explorer, by clicking on Icons I have C:\Users\Samuel\Desktop (Icon is the blue special Desktop icon), which contains the items I see on my Desktop. I then have the following folder: C:\Users\Samuel\Desktop (Icon is the standard yellow folder icon), which contains many program shortcuts, and is completely seperate from the other C:\Users\Samuel\Desktop Then in the Yellow Icon Desktop I have the sub-folder Desktop with the blue icon that is a direct mirror of the blue C:\Users\Samuel\Desktop folder (as in a new folder / file shows up in both). In explorer when I directly type C:\Users\Samuel\Desktop I am taken to the Yellow folder version. If I go to C:\Users\Samuel\Desktop\Desktop I am taken to the Blue folder version. Finally, from cmd cd'ing to C:\Users\Samuel\Desktop takes me to the Yellow folder version whilst C:\Users\Samuel\Desktop\Desktop takes me to the blue folder version. How on earth can I get rid of the yellow folder version leaving the blue C:\Users\Samuel\Desktop. I can't delete either as it says they're in use. UPDATE: Ok, so it looks like doing a dir from cmd lists only one Desktop folder - the Yellow one. In addition, it looks like I can't delete either of them (given that they both contain my 'Desktop'

    Read the article

  • My SSD stopped working as it ends up in blue death right after windows 7 launches, how can I reset it for new windows install?

    - by HattoriHanzo
    As I mentioned in the title my SSD suddenly started to fail as after launching Windows 7 it goes straight to completely idle and after a few minutes it goes to blue death and restarts. I have an another HD with a windows xp on it and it works fine and I can also see the SSD and can access everything on it. Windows 7 on the SSD does work in safe mode though yet I didn't manage to find out what causes the problem. Since I can sill access the files and save them to another HD I'm looking for the best way to wipe and reinstall Windows 7. I have yet failed to find an easy to follow (or even understand) guide, different sources on the internet recommend different ways of doing this. And some guides are just simply full of terms I have no clue about. It's an OCZ Vertex 2 120GB. I"d very much appreciate if someone could give me an advice on what I should do, preferably in a way so I could regain the best possible performance as well. it doesn't matter if I don't understand the science behind it as long as I can follow the steps. Thanks!

    Read the article

  • vs2010 wpf c#: how to get friends list from facebook? (Desktop application)

    - by Ash
    As per this link code from stack overflow i have try this code for getting friendslist but after login i got this error "requires valid signature" string APIKey = ConfigurationManager.AppSettings["API_Key"]; string APISecret = ConfigurationManager.AppSettings["API_Secret"]; Facebook.Session.ConnectSession connectsession = new Facebook.Session.ConnectSession(APIKey, APISecret); Facebook.Rest.Api api = new Facebook.Rest.Api(connectsession); var friends = api.Friends.GetLists(); foreach (var friend in friends) { System.Console.WriteLine(friend.name); } guide me to find out the solution Thanks ash

    Read the article

  • Diagonal line of sight with two corners

    - by Ash Blue
    Right now I'm using Bresenham's line algorithm for line of sight. The problem is I've found an edge case where players can look through walls. Occurs when the player looks between two corners of a wall with a gap on the other side at specific angles. The result I want is for the tile between two walls to be marked invalid as so. What is the fastest way to modify Bresenham's line algorithm to solve this? If there isn't a good solution, is there a better suited algorithm? Any ideas are welcome. Please note the solution should also be capable of supporting 3d. Edit: For the working source code and an interactive demo of the completed product please see http://ashblue.github.io/javascript-pathfinding/

    Read the article

  • Turn-based games [closed]

    - by Blue
    I've been looking for tutorials on turn-based games. I found an incomplete tutorial series by InsugentX about turn-based games. I haven't looked through it, but since it's incomplete, I worry that I won't be able to finish the scripts. I'm looking for tutorials or some good tips or advice to create turn-based games(similar to Worms). Recently I finished watching the WalkerBoys' tutorials so I am familiar with code. Where can I find some info and/or tutorials on creating Turn-based games? I'd prefer it to be video format. How can I create turn-based games (not the entire thing, only the set-up) or a turn-based event like in Worms? To explain more, How do I create 2 parties(1st player, 2nd player) exchanging turns(turn-based games and/or hotseat). While parties have characters similar to Worms(having more than 1 character within each party)? Do I use an array, an enum? I don't have any experience in turn-based games, so I would like to know how to actually make turn-based games. I can't find any reference to help me with construction of a turn-based game code similar to Worms in a programming language I can understand.

    Read the article

  • help with boxplot needed

    - by kathy_BJ
    I am new to R, can anyone help me with boxplot for a dataset like: file1 col1 col2 col3 col4 col5 050350005 101 56.625 48.318 RED 051010002 106 50.625 46.990 GREEN 051190007 25 65.875 74.545 BLUE 051191002 246 52.875 57.070 RED 220050004 55 70 80.274 BLUE 220150008 75 67.750 62.749 RED 220170001 77 65.750 54.307 GREEN file2 col1 col2 col3 col4 col5 050350005 101 56.625 57 RED 051010002 106 50.625 77 GREEN 051190007 25 65.875 51.6 BLUE 051191002 246 52.875 55.070 RED 220050004 55 70 32 BLUE 220150008 75 67.750 32.49 RED 220170001 77 65.750 84.07 GREEN for each color (red,green and blue), I need to compare file1 and file2 by making box plot with MB and RMSE for (col4-col3) for file1 and file2 by dividing col2 in different group: if col2<20,20<=col2<50, 50 <= col2 <70, col2 =70. That is, for the boxplot, the x is (<20, 20-50,50-70, 70), while y is MB (and RMSE) of the difference of col4 and col3 I hope I didn't confuse anybody. Thank you so much.

    Read the article

  • Running UBUNTU from a USB Flash drive on Acer

    - by Byron Blue
    I've made a bootable USB flash drive to run UBUNTU. The drive works fine on MOST laptops/computers I try: It does not want to start on my (favourite) Acer Aspire 5745 (Windows 7 64 bit). The opening screen has SYSLINUX 4.06 EDD 4.06-pre1 (...) and simply sits there. I was using UBUNTU 12.04.1 64 bit until I tried booting to the Acer this morning. I've tried booting to 10.04 as well (saw this as a fix on a discussion) with the same result. I really want to use the Acer for development and do not want to wipe my Windows 7 from the hard disk. Are there any solutions/answers?

    Read the article

  • How can I turn a bunch of rows into aggregated columns WITHOUT using pivot in SQL Server 2005?

    - by cdeszaq
    Here is the scenario: I have a table that records the user_id, the module_id, and the date/time the module was viewed. eg. Table: Log ------------------------------ User_ID Module_ID Date ------------------------------ 1 red 2001-01-01 1 green 2001-01-02 1 blue 2001-01-03 2 green 2001-01-04 2 blue 2001-01-05 1 red 2001-01-06 1 blue 2001-01-07 3 blue 2001-01-08 3 green 2001-01-09 3 red 2001-01-10 3 green 2001-01-11 4 white 2001-01-12 I need to get a result set that has the user_id as the 1st column, and then a column for each module. The row data is then the user_id and the count of the number of times that user viewed each module. eg. --------------------------------- User_ID red green blue white --------------------------------- 1 2 1 2 0 2 0 1 1 0 3 1 2 1 0 4 0 0 0 1 I was initially thinking that I could do this with PIVOT, but no dice; the database is a converted SQL Server 2000 DB that is running in SQL Server 2005. I'm not able to change the compatibility level, so pivot is out. How can I accomplish this?

    Read the article

  • Swap drive not operating correctly

    - by Blue Ice
    At first, I started seeing the warning signs. The halting pages. The molasses speed of the windows closing. The pictures not rendering. Then, I took action. Recently I added a swap drive to my computer. For a while, everything was good. Unicorns frolicked among the new bits and bytes resplendent on the shiny metal platter known as my swap drive. Today, I opened Chromium, and got on the 7th tab (start.csail.mit.edu) "He's dead, Jim!". This used to happen before I added my swap drive, but now I thought that it wouldn't happen because I added more memory. I fear for the safety of the unicorns. Please help me make my swap drive work again. As a side note, here is the result of cat /proc/swaps: Filename Type Size Used Priority /dev/sda5 partition 39075836 213896 -1 Result of free: total used free shared buffers cached Mem: 507472 330792 176680 0 6208 71252 -/+ buffers/cache: 253332 254140 Result of df -h: Filesystem Size Used Avail Use% Mounted on /dev/sdb1 147G 8.9G 130G 7% / none 4.0K 0 4.0K 0% /sys/fs/cgroup udev 240M 12K 240M 1% /dev tmpfs 50M 824K 49M 2% /run none 5.0M 0 5.0M 0% /run/lock none 248M 208K 248M 1% /run/shm none 100M 20K 100M 1% /run/user

    Read the article

  • Equivalent of public static final fields in Scala

    - by JT
    I'm learning Scala, and I can't figure out how to best express this simple Java class in Scala: public class Color { public static final Color BLACK = new Color(0, 0, 0); public static final Color WHITE = new Color(255, 255, 255); public static final Color GREEN = new Color(0, 0, 255); private static final int red; private static final int blue; private static final int green; public Color(int red, int blue, int green) { this.red = red; this.blue = blue; this.green = green; } // getters, et cetera } The best I have is the following: class Color(val red: Int, val blue: Int, val green: Int) object BLACK extends Color(0, 0, 0) object WHITE extends Color(255, 255, 255) object GREEN extends Color(0, 0, 255) But I lose the advantages of having BLACK, WHITE, and GREEN being tied to the Color namespace.

    Read the article

  • Displaying possible movement tiles

    - by Ash Blue
    What's the fastest way to highlight all possible movement tiles for a player on a square grid? Players can only move up, down, left, right. Tiles can cost more than one movement, multiple levels are available to move, and players can be larger than one tile. Think of games like Fire Emblem, Front Mission, and XCOM. My first thought was to recursively search for connecting tiles. This quickly demonstrated many shortcomings when blockers, movement costs, and other features were added into the mix. My second thought was to use an A* pathfinding algorithm to check all tiles presumed valid. Presumed valid tiles would come from an algorithm that generates a diamond of tiles from the player's speed (see example here http://jsfiddle.net/truefreestyle/Suww8/9/). Problem is this seems a little slow and expensive. Is there a faster way? Edit: In Lua for Corona SDK, I integrated the following movement generation controller. I've linked to a Gist here because the solution is around 90 lines of code. https://gist.github.com/ashblue/5546009

    Read the article

  • how to fix fatal error jvmti.h No such file or directory compilation terminated on c code ubuntu? [on hold]

    - by Blue Rose
    how to fix fatal error jvmti.h No such file or directory compilation terminated c code ubuntu? my c code is: #include "jvmti.h" JNIEXPORT jint JNICALL Agent_OnLoad(JavaVM *jvm, char *options, void *reserved) { /* We return JNI_OK to signify success */ printf("\nBushra Za'areer,\n\n"); return JNI_OK; } JNIEXPORT void JNICALL Agent_OnUnload(JavaVM *vm) { } type this command in terminal: gcc -Wall -W -Werror first_agent.c -o firstagent first_agent.c:1:19: fatal error: jvmti.h: No such file or directory compilation terminated. where java jdk version javac 1.7.0_25 where gcc version gcc version 4.7.3 (Ubuntu/Linaro 4.7.3-2ubuntu4) here should update gcc version to 4.8?

    Read the article

  • Periodic updates of an object in Unity

    - by Blue
    I'm trying to make a collider appear every 1 second. But I can't get the code right. I tried enabling the collider in the Update function and putting a yield to make it update every second or so. But it's not working (it gives me an error: Update() cannot be a coroutine.) How would I fix this? Would I need a timer system to toggle the collider? var waitTime : float = 1; var trigger : boolean = false; function Update () { if(!trigger){ collider.enabled = false; yield WaitForSeconds(waitTime); } if(trigger){ collider.enabled = true; yield WaitForSeconds(waitTime); } } }

    Read the article

  • jquery select problem

    - by codedude
    Say I have an unordered list like so: <ul> <li>Some Text</li> <li>Some Text</li> <li>Some Text</li> <li>Some Text</li> </ul> I want to use jquery so that when I click a "li", the background changes to blue. So I do this: $('li').click(function() { $(this).addClass('active'); }); And the "active" class has as background of blue. However, I can't figure out how to make it so that when I click another "li", the other "li" that has a background of blue stops having a background of blue. I guess what I'm trying to say is how to make only one "li" have a background of blue at a time--using jquery.

    Read the article

  • How to adjust the shooting angle of an object

    - by Blue
    I've been trying to add an angle adjustment feature to a power bar that I got from unity3dStudents. But I can't seem to get the code right. I'm using addforce to rigidbody, it works but the power is too great. I also found that rotating the object it's shooting from changes the angle. But I don't know how to proceed from that. Can somebody show me the problem with the script below, as in how to add height to the addforce without it going to far up or to the side? Or how to change the angle of the object? var theAngle : int; var maxAngle : int = 130; var minAngle : int = 0; var angleIncreasing : boolean = false; var angleDecreasing : boolean = false; var rotationSpeed : float = 10; var ball : Rigidbody; var spawnPos : Transform; var shotForce : float = 25; function Update () { if(Input.GetKeyDown("k")){ angleIncreasing = true; angleDecreasing = false; } if(Input.GetKeyUp("k")){ angleIncreasing = false; } if(Input.GetKeyDown("l")){ angleIncreasing = false; angleDecreasing = true; } if(Input.GetKeyUp("l")){ angleDecreasing = false; } ------- if(angleIncreasing){ theAngle += Time.deltaTime * rotationSpeed; if(theAngle > maxAngle){ theAngle = maxAngle; } } if(angleDecreasing){ theAngle -= Time.deltaTime * rotationSpeed; if(theAngle < minAngle){ theAngle = minAngle; } } } function Shoot(power : float, angle : int){ ---- var forward : Vector3 = spawnPos.forward; var upward : Vector3 = spawnPos.up; pFab.AddForce(forward * power * shotForce); pFab.AddForce(upward * angle * 10); ---- }

    Read the article

  • How Would I create alternate players (Turn base Event)

    - by Blue
    The picture above shows 2 players. Each containing 3 characters. I want to know how to make a Turn based event starting with player 1 alternating turns with player 2. And in every alternation each character gets a turn. If a character dies, the next character on the same team goes, and so on. How would I create this? Is there a tutorial? I haven't made any turn-based games so I don't know how to program these kinds of stuff.

    Read the article

  • Enabling and Disabling Colliders Unity

    - by Blue
    I'm trying to make the collider appear every 1 second. But I can't get the code write. I tried enabling the collider under a boolean and putting a yield to make it every second or so. But it's not working(gives me an error: Update() can not be a coroutine.). How would I fix this? Would I need a timer system and set the collider to be enabled every 'x' seconds and disabled every 'y' seconds? var waitTime : float = 1; var trigger : boolean = false; function Update () { if(!trigger){ collider.enabled = false; yield WaitForSeconds(waitTime); } if(trigger){ collider.enabled = true; yield WaitForSeconds(waitTime); } } }

    Read the article

  • Enabling and Disabling components in Unity

    - by Blue
    I'm trying to create an enable/ disable game objects in Unity. I used GameObject.SetActiveRecursively but it only works one-way. I used a collider in which when an object enters the collider. The game objects become enabled. When they leave or get to a certain point, they disable. How would I make this a two way system, making it able to be enabled while inside the collider and disabled when outside the collider? -- The collider is in the game object who is being disabled and enabled. According to this information from Unity Answers, the object becomes disabled. So how would I make the object enabled?

    Read the article

  • Lubuntu 13.04, kernel still 3.8.0-32-generic

    - by Blue Ice
    My question is very similar to Ubuntu 13.10, kernel still 3.8.0-31-generic. Recently was updating to Saucy and the ethernet cable got unplugged. So I decided to run Software Update again, to reinstall files. It returned that "everything is up to date". But according to these command-line searches, that is incorrect. How can I install Saucy now safely from the command line? sudo apt-get install lubuntu-desktop Reading package lists... Done Building dependency tree Reading state information... Done lubuntu-desktop is already the newest version. The following package was automatically installed and is no longer required: linux-image-extra-3.8.0-19-generic Use 'apt-get autoremove' to remove it. 0 upgraded, 0 newly installed, 0 to remove and 0 not upgraded. sudo apt-get dist-upgrade Reading package lists... Done Building dependency tree Reading state information... Done Calculating upgrade... Done 0 upgraded, 0 newly installed, 0 to remove and 0 not upgraded. sudo apt-get update Get:1 http://extras.ubuntu.com raring Release.gpg [72 B] Hit http://extras.ubuntu.com raring Release Get:2 http://az-1.hpcloud.mirror.websitedevops.com raring Release.gpg Hit http://extras.ubuntu.com raring/main Sources Hit http://extras.ubuntu.com raring/main i386 Packages Get:3 http://az-1.hpcloud.mirror.websitedevops.com raring-updates Release.gpg Get:4 http://az-1.hpcloud.mirror.websitedevops.com raring-backports Release.gpg Get:5 http://az-1.hpcloud.mirror.websitedevops.com raring-security Release.gpg Get:6 http://az-1.hpcloud.mirror.websitedevops.com raring Release Ign http://extras.ubuntu.com raring/main Translation-en_US Ign http://extras.ubuntu.com raring/main Translation-en Hit http://ppa.launchpad.net raring Release.gpg Ign http://az-1.hpcloud.mirror.websitedevops.com raring Release E: GPG error: http://az-1.hpcloud.mirror.websitedevops.com raring Release: The following signatures were invalid: NODATA 1 NODATA 2 lsb_release -rd Description: Ubuntu 13.04 Release: 13.04 uname -r 3.8.0-32-generic

    Read the article

  • sIFR3: controlling a and a:hover styles inside replaced through CSS rather than JS

    - by sneeuwitje
    For graceful degrading and minimal coding for the sIFR feature on my websites I would want to define styles in CSS as much as possible. Here's what I do: Define a H3 tag to be replaced by sIFR3. H3 comes in varying colors by CSS depending on it's container, say body.blue-txt h3{ color: #009CDA; } body.white-txt h3{ color: #FFFFFF; } body.etc... H3 might contain an anchor (I'm aware of semantical issues, but that's just how it is ... sorry) With setting sIFR.useStyleCheck = true; sIFR3 will show replaced normal H3 text with correct color, but when it contains a link, it shows the Flash default #0000FF .... All fine; I can tweak e.g. blue text in sifr-config.js by using the css-parameter for sIFR.replace(): sIFR.replace(futura, { selector: 'body.blue-txt h3', css: 'a {color: #009CDA; }, a:hover { color: #009CDA; text-decoration: underline; }' }); But that would have to be coded for every single text-color in my sIFR replacements in both JS and CSS. So I would want to make the sIFR.useStyleCheck setting just respect the CSS in sifr-config.css like: body.blue-txt h3{ color: #009CDA; } body.blue-txt h3 a{ color: #009CDA; } body.blue-txt h3 a:hover{ color: #009CDA; text-decoration: underline; } Only this doesn't seem to work ... the link text keeps popping up as #0000FF and the hover is not underlined. Is this just Not A Feature (Yet), or am doing something wrong?

    Read the article

  • Function should return float, but it gets messed up!

    - by Andre
    Hi guys, I'm going crazy here. I have a function that should return a float number: - (float) getHue:(UIColor *)original { NSLog(@"getHue"); const CGFloat *componentColors = CGColorGetComponents(original.CGColor); float red = componentColors[0]; float green = componentColors[1]; float blue = componentColors[2]; float h = 0.0f; float maxChannel = fmax(red, fmax(green, blue)); float minChannel = fmin(red, fmin(green, blue)); if (maxChannel == minChannel) h = 0.0f; else if (maxChannel == red) h = 0.166667f * (green - blue) / (maxChannel - minChannel) + 0.000000f; else if (maxChannel == green) h = 0.166667f * (blue - red) / (maxChannel - minChannel) + 0.333333f; else if (maxChannel == blue) h = 0.166667f * (red - green) / (maxChannel - minChannel) + 0.666667f; else h = 0.0f; if (h < 0.0f) h += 1.0f; NSLog(@"getHue results: %f", h); return h; } The NSLog will trace it correctly (i.e: 0.005), but the actual return value of the function is NULL. I've tried getting that value in so many ways and it never works. float originalHue = [self getHue:original]; results in a building error, as it says: "incompatible types in initialization" float *originalHue = [self getHue:original]; results in a null return. I've tried other ways, but it never actually gets the value properly. Any thoughts? Cheers guys, Andre

    Read the article

< Previous Page | 5 6 7 8 9 10 11 12 13 14 15 16  | Next Page >