31QPixmap QHaikuScreen::grabWindow(WId winId,
int x,
int y,
int width,
int height)
const
33 if (width == 0 || height == 0)
36 BScreen screen(
nullptr);
37 BBitmap *bitmap =
nullptr;
38 screen.GetBitmap(&bitmap);
40 const BRect frame = (winId ? ((BWindow*)winId)->Frame() : screen.Frame());
42 const int absoluteX = frame.left + x;
43 const int absoluteY = frame.top + y;
46 width = frame.Width() - x;
48 height = frame.Height() - y;
50 const QImage::Format format = QHaikuUtils::colorSpaceToImageFormat(bitmap->ColorSpace());
53 QImage image((uchar*)bitmap->Bits(), screen.Frame().Width() + 1, screen.Frame().Height() + 1, bitmap->BytesPerRow(), format);
56 QRect grabRect(absoluteX, absoluteY, width, height);
57 image = image.copy(grabRect);
61 return QPixmap::fromImage(image);
64QRect QHaikuScreen::geometry()
const
66 const BRect frame = m_screen->Frame();
67 return QRect(frame.left, frame.top, frame.right - frame.left, frame.bottom - frame.top);