好的,我正在研究一个接收图像的程序,将一个像素块隔离成一个数组,然后为该数组中的每个像素获取每个单独的rgb值.
当我这样做
//first pic of image
//just a test
int pix = myImage.getRGB(0,0)
System.out.println(pix);
Run Code Online (Sandbox Code Playgroud)
它吐了出来-16106634
我需要从这个int值中得到(R,G,B)值
有公式,alg,方法吗?
好的,我正在努力将大约120个左右的特定数组列表添加到数组列表中(这些只是假设的值和名称,但是相同的概念
private ArrayList<int[]> listofNames = new ArrayList<int[]>();
private static int[] NAME_0 = {x, x, x};
Run Code Online (Sandbox Code Playgroud)
private static int[] NAME_1 = {x, x, x};
private static int[] NAME_2 = {x, x, x};
private static int[] NAME_3 = {x, x, x};
有没有办法可以使用for循环来通过NAME_0来说NAME_120?
我似乎无法弄清楚为什么在使用promises后它仍然没有等待,所以$ scope.return_message返回null.
function getRandomCommit()
{
var d = $q.defer();
$scope.repos = Repos.query({username: 'octocat'}).$promise.then(function ( value )
{
var ranNum = Math.floor((Math.random()*value.length) + 1);
$scope.repo = Repo.get({username: 'octocat'}, {repo: value[ranNum].name}).$promise.then(function ( value2 )
{
$scope.commits = Commit.query({username: 'octocat'}, {repo: value2.name}).$promise.then(function ( value3 )
{
var ranNum2 = Math.floor((Math.random()*value3.length));
d.resolve(value3[ranNum2].commit.message);
return d.promise;
});
});
});
};
$scope.return_message = getRandomCommit();`
Run Code Online (Sandbox Code Playgroud)