Ich habe Probleme mit der Verarbeitung von RGB_565 Bitmaps. Mein Code arbeitet für ARGB_8888 fein: Hier einige Code-Schnipsel, die ich für ARGB_8888 verwendet (was gut funktioniert):Prozess RGB_565 Bitmap in NDK
typedef struct
{
uint8_t red;
uint8_t green;
uint8_t blue;
uint8_t alpha;
} argb;
.....
.....
void* pixelscolor;
int ret;
int y;
int x;
uint32_t *pixel;
if ((ret = AndroidBitmap_getInfo(env, bmp, &infocolor)) < 0) {
//return null;
}
if ((ret = AndroidBitmap_lockPixels(env, bmp, &pixelscolor)) < 0) {
}
int width = infocolor.width;
int height = infocolor.height;
for (y = 0; y < height; y++) {
argb * line = (argb *) pixelscolor;
for (int n = 0; n < width; n++) {
int newValue = line[n].alpha+line[n].red+line[n].green+line[n].blue;
......
....
ich ein Ergebnis wie dieses ARGB_8888 results.
Aber beim Versuch, das RGB_565 Format:
typedef struct
{
uint8_t red;
uint8_t green;
uint8_t blue;
} rgb;
.....
.....
void* pixelscolor;
int ret;
int y;
int x;
uint32_t *pixel;
if ((ret = AndroidBitmap_getInfo(env, bmp, &infocolor)) < 0) {
//return null;
}
if ((ret = AndroidBitmap_lockPixels(env, bmp, &pixelscolor)) < 0) {
}
int width = infocolor.width;
int height = infocolor.height;
for (y = 0; y < height; y++) {
rgb * line = (rgb *) pixelscolor;
for (int n = 0; n < width; n++) {
int newValue = line[n].red+line[n].green+line[n].blue;
......
....
ich folgendes Ergebnis: RGB_565 result
Dank, dies löst das Problem der Doppelarbeit. aber die Qualität der Ergebnisse ist nicht so gut wie das ARGB_8888 Format. obwohl mein Programm niemals den Alpha-Kanal benutzt. trotzdem vielen herzlichen Dank :) – Thilleli
@Thilleli Gern geschehen :) – Sergio