Kleiner Tipp: Bennen deine Variablen mal vernünftig, dann muss man nicht nachfragen. Ein Buchstabige Variablen sind eigentlich ein No-Go außer für Schleifenzähle oder sowas wie x/y Koordinaten.
Zwei Probleme: a) Der Alphakanal kommt mit
b) Es wird nicht als int geliefert, sondern als Binarzahl - die nach Int konvertiert wird. Und da der int signed ist, aber ggf. alle Bits verwendet wird (spätestens mit Alphakanal) können auch negative Zahlen rauskommen.
This is a problem with single-letter variable names. Certainly a loop counter may be
named i or j or k (though never l!) if its scope is very small and no other names can conflict
with it. This is because those single-letter names for loop counters are traditional.
However, in most other contexts a single-letter name is a poor choice; it’s just a place
holder that the reader must mentally map to the actual concept. There can be no worse reason
for using the name c than because a and b were already taken.
In general programmers are pretty smart people. Smart people sometimes like to show
off their smarts by demonstrating their mental juggling abilities. After all, if you can reliably
remember that r is the lower-cased version of the url with the host and scheme
removed, then you must clearly be very smart. One difference between a smart programmer and a professional programmer is that
the professional understands that clarity is king. Professionals use their powers for good
and write code that others can understand.
Man kann keinen Code schreiben, den alle verstehen können. Das würde voraussetzen, dass es keine dummen Menschen gibt.
Mein Oma würde zum Beispiel b.getRGB(j, i); auch nicht dann verstehen, wenn dort bufferedImage.getRGB(j, i); stünde.
Hingegen kann man mit etwas Erfahrung kürzere Variablennamen schneller lesen; das ist einfach die logische Konklusion, da diese kürzer sind, also weniger Buchstaben beinhalten...
So und jetzt nochmal zur Frage zurück... Wie tilge ich den Alphakanal-Wert?
Hingegen kann man mit etwas Erfahrung kürzere Variablennamen schneller lesen; das ist einfach die logische Konklusion, da diese kürzer sind, also weniger Buchstaben beinhalten...