adjusting converter to work with black and white image backgrounds
This commit is contained in:
parent
a8457d9399
commit
98e78b915e
@ -11,11 +11,11 @@ class Converter {
|
|||||||
Converter(std::string level);
|
Converter(std::string level);
|
||||||
Converter();
|
Converter();
|
||||||
~Converter();
|
~Converter();
|
||||||
void updateComposition(unsigned int idG, unsigned int idB, float posX, float posZ);
|
void updateComposition(unsigned int idG, unsigned int idB, float posX, float posZ); //updates the position of a composition
|
||||||
std::vector<unsigned int> newComposition(unsigned int type, float posX, float posZ);
|
std::vector<unsigned int> newComposition(unsigned int type, float posX, float posZ);//creates a new composition and returns its ID
|
||||||
void deleteComposition(unsigned int idG, unsigned int idB);
|
void deleteComposition(unsigned int idG, unsigned int idB);
|
||||||
void save();
|
void save(); //writes the xml to file
|
||||||
std::vector<unsigned int> getNextID();
|
std::vector<unsigned int> getNextID(); //returns the next unused ID
|
||||||
|
|
||||||
private:
|
private:
|
||||||
std::vector<unsigned int> nextID;
|
std::vector<unsigned int> nextID;
|
||||||
|
@ -31,8 +31,8 @@ int main( int argc, char *argv[] ){
|
|||||||
for(unsigned int columnNum = 0; columnNum < width; columnNum++){
|
for(unsigned int columnNum = 0; columnNum < width; columnNum++){
|
||||||
unsigned int pixel = (rowNum*width+columnNum)*4;
|
unsigned int pixel = (rowNum*width+columnNum)*4;
|
||||||
//if there is a composition here, adjust the xml and image
|
//if there is a composition here, adjust the xml and image
|
||||||
if(image[pixel]!=0){
|
if(image[pixel]!=0 && image[pixel]!=255){
|
||||||
if(image[pixel+1]==0 && image[pixel+2]==0){
|
if((image[pixel+1]==0 && image[pixel+2]==0) || (image[pixel+1]==255 && image[pixel+2]==255)){
|
||||||
std::vector<unsigned int> temp;
|
std::vector<unsigned int> temp;
|
||||||
temp = conv.newComposition(image[pixel], 0.5+rowNum-0.5*height, 0.5+columnNum-0.5*width);
|
temp = conv.newComposition(image[pixel], 0.5+rowNum-0.5*height, 0.5+columnNum-0.5*width);
|
||||||
idFound[temp[0]][temp[1]] = true;
|
idFound[temp[0]][temp[1]] = true;
|
||||||
|
Loading…
Reference in New Issue
Block a user