Advertisement
Guest User

Untitled

a guest
Sep 22nd, 2017
66
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.00 KB | None | 0 0
  1. def set_pixmap(self, msg, w_img, h_img):
  2. print msg
  3. print [msg]
  4. self._zoom = 0
  5. self.img_width = w_img
  6. self.img_height = h_img
  7. self.qImg = QImage(msg, w_img, h_img, w_img, QImage.Format_Grayscale8)
  8. self._photo = QGraphicsPixmapItem(QPixmap(self.qImg))
  9. self._photo.mousePressEvent = self.pixelSelect
  10. self._scene.addItem(self._photo)
  11.  
  12. void ImageViewer::setPixmapImage(QByteArray image_data, int image_width, int image_height
  13. {
  14. zoom = 0;
  15. qDebug() << image_data;
  16. }
  17.  
  18. unsigned char data[image_resolution];
  19. qDebug() << data;
  20. memcpy(data, image_data.toStdString().c_str(), image_resolution);
  21. qDebug() << data;
  22. qImg = QImage(data, image_width, image_height, image_width, QImage::Format_Grayscale8);
  23. qDebug() << qImg.byteCount();
  24.  
  25. unsigned char data[image_resolution];
  26. memcpy(data, image_data.toStdString().c_str(), image_resolution);
  27. qImg = QImage(data, image_width, image_height, image_width, QImage::Format_Grayscale8);
  28. QPixmap pixmap = QPixmap::fromImage(qImg);
  29. QGraphicsPixmapItem * Pix = scene->addPixmap(pixmap);
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement