373 @param evt reference to the paint event object (QPaintEvent) |
373 @param evt reference to the paint event object (QPaintEvent) |
374 """ |
374 """ |
375 painter = QPainter(self) |
375 painter = QPainter(self) |
376 |
376 |
377 if self.__zoom >= 3 and self.__gridEnabled: |
377 if self.__zoom >= 3 and self.__gridEnabled: |
378 painter.setPen(self.palette().foreground().color()) |
378 painter.setPen(self.palette().windowText().color()) |
379 i = 0 |
379 i = 0 |
380 while i <= self.__image.width(): |
380 while i <= self.__image.width(): |
381 painter.drawLine(self.__zoom * i, 0, |
381 painter.drawLine(self.__zoom * i, 0, |
382 self.__zoom * i, self.__zoom * self.__image.height()) |
382 self.__zoom * i, self.__zoom * self.__image.height()) |
383 i += 1 |
383 i += 1 |
385 while j <= self.__image.height(): |
385 while j <= self.__image.height(): |
386 painter.drawLine(0, self.__zoom * j, |
386 painter.drawLine(0, self.__zoom * j, |
387 self.__zoom * self.__image.width(), self.__zoom * j) |
387 self.__zoom * self.__image.width(), self.__zoom * j) |
388 j += 1 |
388 j += 1 |
389 |
389 |
|
390 col = QColor("#aaa") |
390 painter.setPen(Qt.DashLine) |
391 painter.setPen(Qt.DashLine) |
391 for i in range(0, self.__image.width()): |
392 for i in range(0, self.__image.width()): |
392 for j in range(0, self.__image.height()): |
393 for j in range(0, self.__image.height()): |
393 rect = self.__pixelRect(i, j) |
394 rect = self.__pixelRect(i, j) |
394 if evt.region().intersects(rect): |
395 if evt.region().intersects(rect): |
395 color = QColor.fromRgba(self.__image.pixel(i, j)) |
396 color = QColor.fromRgba(self.__image.pixel(i, j)) |
396 painter.fillRect(rect, QBrush(Qt.white)) |
397 painter.fillRect(rect, QBrush(Qt.white)) |
397 painter.fillRect(rect, QBrush(Qt.Dense5Pattern)) |
398 painter.fillRect(QRect(rect.topLeft(), rect.center()), col) |
|
399 painter.fillRect(QRect(rect.center(), rect.bottomRight()), col) |
398 painter.fillRect(rect, QBrush(color)) |
400 painter.fillRect(rect, QBrush(color)) |
399 |
401 |
400 if self.__isMarked(i, j): |
402 if self.__isMarked(i, j): |
401 painter.drawRect(rect.adjusted(0, 0, -1, -1)) |
403 painter.drawRect(rect.adjusted(0, 0, -1, -1)) |
402 |
404 |