Mailing Lists: Apple Mailing Lists
Image of Mac OS face in stamp
app just dyes
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

app just dyes



hello all hope all is good ?

I was just messing around trying to get my little app to work out what color
in an image is the most used color of that image.. heres my code:

public QDColor getDomColor(){
try {
int maxr = 0;
int maxg = 0;
int maxb = 0;
QDColor acolor;

for (int x = 0; x < kHeight; x++) {
for(int y = 0; y < kWidth; y++) {
acolor = (mDrawable.getGWorld()).getCPixel(x, y);
maxr = maxr +
checkColorValue(QDColor.convert16to8(acolor.getRed()));
maxg = maxg +
checkColorValue(QDColor.convert16to8(acolor.getGreen()));
maxb = maxb +
checkColorValue(QDColor.convert16to8(acolor.getBlue()));
}
}

QDColor domrgb = new QDColor((maxr/(kWidth * kHeight)),
(maxg/(kWidth * kHeight)),
(maxb/(kWidth * kHeight)));
return(domrgb);
} catch (Exception err) {
Utils.dbe(2, "cant getDomColor" + err);
}
return(new QDColor());
}

public int checkColorValue(int num) {
if (num < 0) return(0);
if (num > 255) return(255);
return(0);
}

strange thing is after a few loops of this the app just closes. im using osx
10.0.4 at the moment.

anyone no why I just quits ? is there a better way of doing this type of
thing?


fun fun fun...


aNt


References: 
 >QT Java vs QTPlayer for URLs (From: email@hidden)



Visit the Apple Store online or at retail locations.
1-800-MY-APPLE

Contact Apple | Terms of Use | Privacy Policy

Copyright © 2011 Apple Inc. All rights reserved.