This is the source code to determine the position of the watermark to be inserted. anyone can help explain the following sourcecode ...? because I do not understand.
static int Posisi = 0;
private int getPosisiX() {
int x = Posisi % 3;
return x == 0 ? 1 : (x == 2 ? Lebar - Lebar_Watermark - 1 : ((Lebar - Lebar_Watermark) >> 1));
}
private int getPosisiY() {
int y = Posisi / 3;
return y == 0 ? 1 : (y == 2 ? Tinggi - Tinggi_Watermark - 1 : ((Tinggi - Tinggi_Watermark) >> 1));
}
private ArrayList<Pixel> getOpacity(int[] gambarRGB, int[] watermarkRGB, boolean[] unavailable) {
java.util.ArrayList<Pixel> pixels = new java.util.ArrayList<Pixel>(Lebar_Watermark * Tinggi_Watermark / 2);
for (int h = 0, offsetWatermark = 0, offsetOrig = getPosisiY() * Lebar + getPosisiX(); h < Tinggi_Watermark; h++, offsetOrig += Lebar) {
for (int w = 0; w < Lebar_Watermark; w++, offsetWatermark++) {
int c = watermarkRGB[offsetWatermark];
if (Opacity(c)) { // transparansi
} else {
pixels.add(new Pixel(w, h, watermarkRGB[offsetWatermark], gambarRGB[offsetOrig + w]));
unavailable[offsetOrig + w] = true;
}
}
}
return pixels;
}
Aucun commentaire:
Enregistrer un commentaire