This commit is contained in:
yukun 2019-11-28 17:55:59 +01:00
parent 2db7745cf7
commit 6d8964243c
3 changed files with 24 additions and 24 deletions

View File

@ -76,7 +76,7 @@ int main(){
std::cout <<"picture" << std::endl;
vkvm::Color backgroundColor = vkvm::getBackgroundColor();
for(int i = 0; i<1000; i++) {
Imagedisplay imagedisplay("../src/P6.bmp");
Imagedisplay imagedisplay("../src/P7.bmp");
for (int w = 0; w < vkvm::getWidth(); w++) {
for (int h = 0; h < vkvm::getHeight(); h++) {
unsigned int a ;
@ -89,7 +89,7 @@ int main(){
sleep(5);
vkvm::setDefaultValues();
Imagedisplay imagedisplay2("../src/P7.bmp");
Imagedisplay imagedisplay2("../src/P6.bmp");
for (int w = 0; w < vkvm::getWidth(); w++) {
for (int h = 0; h < vkvm::getHeight(); h++) {
@ -101,28 +101,28 @@ int main(){
sleep(5);
vkvm::setDefaultValues();
Imagedisplay imagedisplay3("../src/P6.bmp");
for (int w = 0; w < vkvm::getWidth(); w++) {
for (int h = 0; h < vkvm::getHeight(); h++){
unsigned int a ;
a = imagedisplay3.getPixel(w, h);
vkvm::setPixel(w,h,vkvm::Color(a));
}
// Imagedisplay imagedisplay3("../src/P6.bmp");
// for (int w = 0; w < vkvm::getWidth(); w++) {
// for (int h = 0; h < vkvm::getHeight(); h++){
// unsigned int a ;
// a = imagedisplay3.getPixel(w, h);
// vkvm::setPixel(w,h,vkvm::Color(a));
// }
//
// }
// sleep(5);
// vkvm::setDefaultValues();
}
sleep(5);
vkvm::setDefaultValues();
Imagedisplay imagedisplay4("../src/P7.bmp");
for (int w = 0; w < vkvm::getWidth(); w++) {
for (int h = 0; h < vkvm::getHeight(); h++){
unsigned int a ;
a = imagedisplay4.getPixel(w, h);
vkvm::setPixel(w,h,vkvm::Color(a));
}
}
sleep(5);
// Imagedisplay imagedisplay4("../src/P7.bmp");
// for (int w = 0; w < vkvm::getWidth(); w++) {
// for (int h = 0; h < vkvm::getHeight(); h++){
// unsigned int a ;
// a = imagedisplay4.getPixel(w, h);
// vkvm::setPixel(w,h,vkvm::Color(a));
// }
//
// }
// sleep(5);
}
});

View File

@ -57,7 +57,7 @@ unsigned int Imagedisplay::getPixel(int x, int y) {
char *ptr = getData() + ((getHeight() - 1 - y) * getWidth() + x) * (getBitsPerPixel() / 8);
for(int i = 0; i < getBitsPerPixel() / 8;i++){
*((char*)&pixel+i) = ptr[i];
std::cout<< "hi: im" << (unsigned int) ptr[i]<< std::endl;
// std::cout<< "hi: im" << (unsigned int) ptr[i]<< std::endl;
}
if(pixel != 0){
return pixel;

BIN
src/P8.bmp Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 844 KiB