こんにちわ
a2d(GDI+)にはグラフィックに対して補間モードを設定できるのですが、
このモジュールの場合、内部にアクセスして拡張する形でないと難しいですね。。。
よろしかったらどうぞ。
#include "a2d.hsp"
;★追加
#module a2dEx
#uselib "gdiplus"
#func GdipSetInterpolationMode "GdipSetInterpolationMode" int, int
#deffunc alStretchImageToScreenNN int p2, int p1, int psx, int psy, int psw, int psh, int pdx, int pdy, int pdw, int pdh
if imgValidArr@a2d(p2) {
gsel p1
GdipCreateFromHDC@a2d hdc, varptr(tmpGraphics@a2d)
if tmpGraphics@a2d {
GdipSetInterpolationMode tmpGraphics@a2d, 5 ; ★最近傍補間(InterpolationModeNearestNeighborモード)ホントはここだけ追加したい
GdipDrawImageRectRectI@a2d tmpGraphics@a2d, imgImageArr@a2d(p2), pdx, pdy, pdw, pdh, psx, psy, psw, psh, UnitPixel@a2d, pImageAttr@a2d, 0, 0
GdipDeleteGraphics@a2d tmpGraphics@a2d
tmpGraphics@a2d = 0
return 0
}
}
return -1
#global
;★ここまで
screen 0, 1024, 512
alCreateImage 0, 512, 512
if stat = -1 : dialog "GDI+ を初期化できませんでした。" : end
alCreateImage 1, 128, 128
alLoadFile dir_exe+"\\hsptv\\tamane16.png"
alStretchImageToScreen 1, 0, 0, 0, 128, 128, 0, 0, 512, 512
alStretchImageToScreenNN 1, 0, 0, 0, 128, 128, 512, 0, 512, 512
redraw