更长的解释
具体的问题是渲染具有非矩形地图投影的地图图块.假设我有以下图块:
我知道四点必须在这里:
鉴于此,我想得到以下输出:
方形瓦可以是:
旋转;和/或
>一端比另一端更窄.
我认为第二个项目意味着这需要非仿射变换.
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.