1.void setDotsPerMeterX(int);
设置每米有多少个像素
/*!
Sets the number of pixels that fit horizontally in a physical
meter, to \a x.
Together with dotsPerMeterY(), this number defines the intended
scale and aspect ratio of the image, and determines the scale
at which QPainter will draw graphics on the image. It does not
change the scale or aspect ratio of the image when it is rendered
on other paint devices.
\sa dotsPerMeterX(), {QImage#Image Information}{Image Information}
*/
void QImage::setDotsPerMeterX(int x)
{
if (!d || !x)
return;
detach();
if (d)
d->dpmx = x;
}
2.void setDotsPerMeterY(int);
/*!
Sets the number of pixels that fit vertically in a physical meter,
to \a y.
Together with dotsPerMeterX(), this number defines the intended
scale and aspect ratio of the image, and determines the scale
at which QPainter will draw graphics on the image. It does not
change the scale or aspect ratio of the image when it is rendered
on other paint devices.
\sa dotsPerMeterY(), {QImage#Image Information}{Image Information}
*/
void QImage::setDotsPerMeterY(int y)
{
if (!d || !y)
return;
detach();
if (d)
d->dpmy = y;
}

本文介绍了如何在QImage中设置每米像素数(dotsPerMeterX和dotsPerMeterY),以及如何使用fill函数填充颜色,包括不同深度格式的处理。重点在于理解图像分辨率和像素密度对绘图的影响及像素操作技巧。
最低0.47元/天 解锁文章
1万+

被折叠的 条评论
为什么被折叠?



