加入收藏 | 设为首页 | 会员中心 | 我要投稿 李大同 (https://www.lidatong.com.cn/)- 科技、建站、经验、云计算、5G、大数据,站长网!
当前位置: 首页 > 大数据 > 正文

delphi – 如何使用GDI将平方位图呈现给任意的四边形多边形?

发布时间:2020-12-15 10:05:52 所属栏目:大数据 来源:网络整理
导读:我需要绘制一个方形图像,映射或转换为编译时的未知四边形多边形.我该怎么做? 更长的解释 具体的问题是渲染具有非矩形地图投影的地图图块.假设我有以下图块: 我知道四点必须在这里: 鉴于此,我想得到以下输出: 方形瓦可以是: 旋转;和/或 一端比另一端更窄
我需要绘制一个方形图像,映射或转换为编译时的未知四边形多边形.我该怎么做?

更长的解释

具体的问题是渲染具有非矩形地图投影的地图图块.假设我有以下图块:

我知道四点必须在这里:

鉴于此,我想得到以下输出:

方形瓦可以是:

旋转;和/或
>一端比另一端更窄.

我认为第二个项目意味着这需要非仿射变换.

Random extra notes

Four-sided? It is plausible that to be completely correct,the tile should be
mapped to a polygon with more than four points,but for our purposes
and at the scale it is drawn,a square -> other four-cornered-polygon
transformation should be enough.

Why preferably GDI only? All rendering so far is done using GDI,and I want to keep the code (a) fast and (b) requiring as few extra
libraries as possible. I am aware of 07000 and have been experimenting with them
today,but even after experimenting with them I’m not sure if they’re
flexible enough for this purpose. If they are,I haven’t managed to
figure it out,and so I’d really appreciate some sample code.

GDI+ is also ok since we use it elsewhere,but I know it can be slow,and speed is
important here.

One other alternative is anything 07001- /
07002-specific; this program is written mostly in C++ using
the VCL,and the graphics in question are currently painted to a
TCanvas with a mix of 07003 and raw WinAPI/GDI calls.

Overlaying images: One final caveat is that one colour in the tile may be for color-key
transparency: that is,all the white (say) squares in the above tile
should be transparent when drawn over whatever is underneath.
Currently,tiles are drawn to square or axis-aligned rectangular
targets using 07004.

I’m sorry for all the extra caveats that make this question more complicated
than ‘what algorithm should I use?’ But I will happily accept answers with
only algorithmic information too.

解决方法

您可能还想看看 Graphics32. 屏幕截图显示了GR32中的转换演示如何

(编辑:李大同)

【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容!

    推荐文章
      热点阅读