English 中文(简体)
需要帮助了解以下 the辛税
原标题:Need help understanding the following Java syntax
  • 时间:2011-03-25 23:22:00
  •  标签:
  • java
public void printPixelARGB(int pixel){

 int alpha = (pixel >> 24) & 0xff;

 int red = (pixel >> 16) & 0xff;

 int green = (pixel >> 8) & 0xff;

 int blue = (pixel) & 0xff;

 System.out.println("ARGB : " + alpha + ", " + red + ", " + green + ", " + blue);
}

我发现Java syntax显示每个图象的六分母体的RGB值,但我对这种方法略感困惑。 你们能否帮助我解释这一方法?

http://www.un.org。 是什么? 另外,<代码>(pixel>>24)和“pxff的含义是什么? 提前感谢。

最佳回答

粉碎

a 吨位为4英特,每吨位为8美特。

例如

0xA3 0x41 0x28 0x76

缩略语

现在,这份一览表中包含的是有关透明度(A)红、绿色和蓝色成分的信息。

The transparency is the first byte (0xA3) then red (0x41) then green (0x28) then blue (0x76)

为了得到红 part,你在16个轨道上向权利转变,这使权利得以实现。

0x00 0xA3 0x41

如今,红色是最合适的,但你却想到,那里的透明度是好的,因此你必须去除。

实践和计划;0xFF, 确实是

0xA341 & 0x00FF

这就意味着你和每一比值,因此,A3的比值为0,而41的比值与FF的比值相同,因为森林论坛是所有合同方,给你以41的原始价值。

so red is

0x00 0x00 0x00 0x41

因此,该法典将每个组成部分从愤怒中删除。

问题回答

储存食料的方案在<代码>int上采用某种优化方法。

I suspect, that somewhere in your program there is a definition like that:

int screen[1024][726];

从面向目标的观点来看,这一点是完全的,但有时业绩确实很重要。

在这里,是怎样把六氯作为完整的 Java物体:

class Pixel
{
    byte alpha;
    byte red;
    byte green;
    byte blue;
}

但是,没有任何东西可以自由使用,而且需要更新每个屏幕上的许多物体确实增加了。 既然如此,它们就储存在很快的<条码>int上,而且当你需要查阅内容时,你需要跳跃穿某些操纵的灯。

<代码>>>和& 0xff 来到这里,因为它们能够在某些预先界定的职位上进入特定轨道,并将其转化为代表肤色强度的数值。

你可以看到,如果你处理Pixel的物品,工作会更加容易。





相关问题
Spring Properties File

Hi have this j2ee web application developed using spring framework. I have a problem with rendering mnessages in nihongo characters from the properties file. I tried converting the file to ascii using ...

Logging a global ID in multiple components

I have a system which contains multiple applications connected together using JMS and Spring Integration. Messages get sent along a chain of applications. [App A] -> [App B] -> [App C] We set a ...

Java Library Size

If I m given two Java Libraries in Jar format, 1 having no bells and whistles, and the other having lots of them that will mostly go unused.... my question is: How will the larger, mostly unused ...

How to get the Array Class for a given Class in Java?

I have a Class variable that holds a certain type and I need to get a variable that holds the corresponding array class. The best I could come up with is this: Class arrayOfFooClass = java.lang....

SQLite , Derby vs file system

I m working on a Java desktop application that reads and writes from/to different files. I think a better solution would be to replace the file system by a SQLite database. How hard is it to migrate ...

热门标签