[問題] Qt QPixmap

看板C_and_CPP (C/C++)作者 (吳)時間14年前 (2012/02/01 21:00), 編輯推噓0(003)
留言3則, 2人參與, 最新討論串1/1
開發平台(Platform): (Ex: VC++, GCC, Linux, ...) Qt Creator based on Qt 4.7.4 一開始先利用QPixmap的grabWindow擷取桌面 screenPixmap = QPixmap::grabWindow(QApplication::desktop()->winId()); 轉成BMP格式存在buffer裡 screenPixmap.save(&buffer, "BMP"); 使用QImage的ctor取讀取buffer產生一個QImage image = new QImage( buffer, screenRectangle.width(), screenRectangle.height(), screenRectangle.width()*3, QImage::Format_RGB888 ); 最後把image畫出來 painter.drawImage( rect(), *image, screenRectangle ); 畫出來的結果上下顛倒, 而且紅色跟藍色對調了 這樣的結果感覺怪怪的 有人遇過這樣的問題嗎? -- ※ 發信站: 批踢踢實業坊(ptt.cc) ◆ From: 124.12.8.232 ※ 編輯: bull975 來自: 124.12.8.232 (02/01 21:01)

02/02 01:22, , 1F
不奇怪,因為BMP是這樣存的,這樣應該是要用loadFromData
02/02 01:22, 1F

02/19 12:37, , 2F
*.bmp本來就是BGR 由左下角開始吧? 而且你要小心整除4的
02/19 12:37, 2F

02/19 12:37, , 3F
問題
02/19 12:37, 3F
文章代碼(AID): #1FAJThzd (C_and_CPP)
文章代碼(AID): #1FAJThzd (C_and_CPP)