How can I access each R,G,B value spanning 0 to 255 from an RColor object returned by getColor(REntity)? The API shows that RColor objects can contain R,G,B,A integers, or QString objects, or QColor objects. How can I force interpretation of the object as R,G,B,A integers?
My task is to find & store the RGB values of all uniquely colored entities from a document, like this:
Code: Select all
aColor = [0,0,0,255];//RGBA black is always present
uniqueColors = [aColor];//javascript does not directly support multidimensional arrays
allEntityIds = document.queryAllEntities();
for(var e = 0; e < allEntityIds.length; e++){
var entity = queryEntity(allEntityIds[e]);
var color = entity.getColor(); //hoping to get colors as a 4-element array for R,G,B,A
var uniqueColor = true;
for(var c = 0; c < e; c++){
if(color == uniqueColors[c]){ // uniqueColors is a 4-element array for R,G,B,A
uniqueColor = false;
}
}
if(uniqueColor){
uniqueColors.push([color[0], color[1], color[2], color[3]]);// need to access RGBA values
}
}