【发布时间】:2017-09-24 13:34:24
【问题描述】:
如果我有一个 1px 厚的图像,我将如何复制它以使其变得更大,或者我将如何拉伸它。
因为正如您在我的代码中看到的那样,它不是最好的循环 DrawImage
colorMatrixEffect->SetInput(0, texture); //texture = ID2D1Bitmap*
D2D1_MATRIX_5X4_F matrix = D2D1::Matrix5x4F(color->r, 0, 0, 0, 0, color->g, 0, 0, 0, 0, color->b, 0, 0, 0, 0, 1, 0, 0, 0, 0);
colorMatrixEffect->SetValue(D2D1_COLORMATRIX_PROP_COLOR_MATRIX, matrix);
if (rect.right == 0)
{
device_context_d2d1->DrawImage(colorMatrixEffect.get(),
D2D1::Point2F(newRect.left + offsetX, newRect.top + offsetY));
}
else
{
for (int i = 0; i < static_cast<int>(newRect.right); i++)
{
device_context_d2d1->DrawImage(colorMatrixEffect.get(),
D2D1::Point2F(newRect.left + offsetX + i, newRect.top + offsetY));
}
}
【问题讨论】: