HSP¥Ý¡¼¥¿¥ë
¥µ¥¤¥È¥Þ¥Ã¥× ¤ªÌ䤤¹ç¤ï¤»


HSPTV!·Ç¼¨ÈÄ


̤²ò·è ²ò·è Ää»ß ºï½üÍ×ÀÁ

2018
1230
dogArtlet2D¤Çʸ»ú¤ò±ï¼è¤ê¤·¤¿¤¤¡£1̤²ò·è


dog

¥ê¥ó¥¯

2018/12/30(Sun) 14:54:40|NO.86209

Artlet2D¤ÎDrawTextÌ¿Îá¤Ç¡¢Ê¸»ú¤Î±ï¼è¤ê¤ò¹Ô¤¤¤¿¤¤¤Ç¤¹¡£
°ÌÃÖ¤ò¤º¤é¤·¤Æµ¼»÷Ū¤ËºÆ¸½¤¹¤ëÊýË¡°Ê³°¤Ç¤ª´ê¤¤¤·¤Þ¤¹¡£



¤³¤Îµ­»ö¤ËÊÖ¿®¤¹¤ë


osakana

¥ê¥ó¥¯

2019/1/20(Sun) 13:32:10|NO.86363

Artlet2D ¥â¥¸¥å¡¼¥ë¡Ê°Ê²¼ a2d¡Ë¤À¤±¤Ç¤Ï½ÐÍè¤Ê¤¤¤ß¤¿¤¤¤Ç¤¹¤Í¡£
¾¯¤·Ä´¤Ù¤Æ¤ß¤ë¤È a2d Æâ¤Ç»ÈÍѤ·¤Æ¤¤¤ë GDI+ ¤Î API ¤Ë¤Ï¡¢
ʸ»úÎó¤ÎÎسԤò¥Ñ¥¹¤Ë¤·¤ÆÉÁ²è¤¹¤ëµ¡Ç½¤¬¤¢¤Ã¤¿¤Î¤Ç a2d ¥â¥¸¥å¡¼¥ë¤ò³ÈÄ¥¤¹¤ì¤Ð½ÐÍ褽¤¦¤Ç¤¹¡£

¤½¤³¤Ç a2d ¤ò»²¹Í¤Ë¤½¤ì¤ò³ÈÄ¥¤¹¤ë¥â¥¸¥å¡¼¥ë¤òºî¤Ã¤Æ¤ß¤Þ¤·¤¿¡¢
Àµ³Î¤Ë¸À¤¨¤Ð¡¢³ÈÄ¥¤È¤¤¤¦¤è¤ê¤â a2d ¤Ë¤ª¤ó¤Ö¤Ë¤À¤Ã¤³¤ÇÅö³ºµ¡Ç½¤À¤±¤òµ­½Ò¤·¤¿¤â¤Î¤Ç¤¹¤¬¡£
¡ÊÌ¿Îá̾¤ä¥â¥¸¥å¡¼¥ë̾¤Ê¤ÉŬÅö¤Ê¥Í¡¼¥ß¥ó¥°¤Ê¤Î¤ÇÉÔ¼«Á³¤À¤Ã¤¿¤éÊѤ¨¤Æ¤¯¤À¤µ¤¤¡Ë
ɬÍ׺Ǿ®¸Â¤Îµ¡Ç½¤·¤«¤¢¤ê¤Þ¤»¤ó¤¬ a2d ¤ÎÎϤò¼Ú¤ê¤ë¤³¤È¤Ç
¥Ú¥ó¤ä¿§¤ÎÀßÄê¤Ê¤É¤ò°ì±þŬÍѤǤ­¤Æ¤¤¤Þ¤¹¡ÊÁ´¤Æ¤Ï»î¤·¤Æ¤Ê¤¤¤Ç¤¹¤¬¡Ë¡£

»È¤¤Êý¤Ï¡¢
a2d.hsp ¤ò¥¤¥ó¥¯¥ë¡¼¥É¤·¤¿¸å¤Ë¡¢¤³¤Î³ÈÄ¥¥â¥¸¥å¡¼¥ë¤ò¥¤¥ó¥¯¥ë¡¼¥É¤¹¤ë¤³¤È¤Ç
¿·¤¿¤Ë¡¢Ê¸»ú¤ÎÎسԤòÉÁ²è¤¹¤ë alDrawTextPath Ì¿Î᤬Äɲ䵤ì¤ë¤Î¤Ç¡¢
¸å¤Ï¤½¤ì¤ò»È¤Ã¤Æ¥Æ¥­¥¹¥È¤òÉÁ²è¤·¤Æ¤¯¤À¤µ¤¤¡£
alDrawTextPath Ì¿Îá¤Î»ÈÍÑË¡¤Ï alDrawText Ì¿Îá¤ÈƱ¤¸¤Ç¤¹
¡Ê¤¿¤À¡¢¤Ê¤Ë¤«É¬Íפʹ©Äø¤¬Â­¤ê¤Æ¤Ê¤¤¤Î¤«¡¢É½¼¨¾ì½ê¤¬ alDrawText ¤ÈÈæ¤Ù¿ô¥Ô¥¯¥»¥ë¤º¤ì¤ë¸½¾Ý¤¬¤¢¤ë¤Î¤Ç
alDrawText ¤È alDrawTextPath ¤òÁȤ߹ç¤ï¤»¤Æ»È¤¦¾ì¹ç¤Ï°ÌÃÖ¤ÎÈùÄ´À°¤¬É¬ÍפǤ¹¡Ë¡£

# a2d ¤â GDI+ ¤â¤½¤ó¤Ê¤Ë»ä¤ÏÍý²ò¤·¤Æ̵¤¤¤Î¤Ç
# ²¿¤«¤·¤é´Ö°ã¤¤¤¬¤¢¤ë¤«¤â¤·¤ì¤Þ¤»¤ó¡£Æͤùþ¤ß´¿·Þ¡£

³ÈÄ¥¥â¥¸¥å¡¼¥ë¡£
¥Õ¥¡¥¤¥ë̾¤Ï²¾¤È¤·¤Æ "a2d_add_textpath.hsp" ¤È¤·¤Æ¤ª¤­¤Þ¤¹¡£

#ifndef alInitModule_add_textpath #module a2d_add_textpath #uselib "gdiplus.dll" #func GdipGetFontStyle "GdipGetFontStyle" sptr,sptr #func GdipGetFontSize "GdipGetFontSize" sptr,sptr #func GdipCreatePath "GdipCreatePath" sptr,sptr #func GdipGetFamily "GdipGetFamily" sptr,sptr #func GdipAddPathStringI "GdipAddPathStringI" sptr,wstr,sptr,sptr,sptr,sptr,sptr,sptr #func GdipAddPathString "GdipAddPathString" sptr,wptr,sptr,sptr,sptr,sptr,sptr,sptr #func GdipDrawPath "GdipDrawPath" sptr,sptr,sptr #func GdipFillPath "GdipFillPath" sptr,sptr,sptr #func GdipGetSolidFillColor "GdipGetSolidFillColor" sptr,sptr #func GdipSetSolidFillColor "GdipSetSolidFillColor" sptr,sptr #func GdipDeleteFontFamily "GdipDeleteFontFamily" sptr #func GdipDeletePath "GdipDeletePath" sptr #func GdipGetBrushType "GdipGetBrushType" sptr,sptr #enum FillModeAlternate = 0 #enum FillModeWinding ; ʸ»úÎó¤Î¥Ñ¥¹¤òÉÁ²è¤¹¤ë¡Ê¤¤¤ï¤æ¤ëÂÞʸ»ú¡¢wiki¤Ë¤è¤ë¤ÈÇòÈ´¤­Ê¸»ú¡¢±ï¼è¤êʸ»ú¡¢¥¢¥¦¥È¥é¥¤¥óʸ»ú¤È¤â¸Æ¤Ö¤é¤·¤¤¡Ë #deffunc alDrawTextPath_ str p1, int px, int py, int pw, int ph, int pah, int pav if imgFont@a2d { GdipGetFontSize imgFont@a2d, varptr(fontSize) GdipGetFontStyle imgFont@a2d, varptr(fontStyle) GdipCreatePath FillModeAlternate, varptr(pPath) GdipGetFamily imgFont@a2d, varptr(pFontFamily) GdipCreateStringFormat@a2d 0, 0, varptr(tmpFormat) GdipSetStringFormatAlign@a2d tmpFormat, pah GdipSetStringFormatLineAlign@a2d tmpFormat, pav rectf = px, py, pw, ph GdipAddPathStringI pPath, p1, -1, pFontFamily, fontStyle, fontSize, varptr(rectf), tmpFormat if stat = 0 { GdipDrawPath imgGraphics@a2d, imgPen@a2d, pPath ; ¥Ñ¥¹¤ÎÉÁ²è } // ³«Êü GdipDeleteStringFormat@a2d tmpFormat GdipDeleteFontFamily pFontFamily GdipDeletePath pPath } return #define global alDrawTextPath(%1="", %2=0, %3=0, %4=9999, %5=9999, %6=0, %7=0) alDrawTextPath_ %1, %2, %3, %4, %5, %6, %7 #global
¾åµ­¤Î¥â¥¸¥å¡¼¥ë¤òÊݸ¤·¡¢Æ±¤¸¥Õ¥©¥ë¥À¡¼¤Ç°Ê²¼¤Î¥µ¥ó¥×¥ë¤ò¼Â¹Ô¤·¤Æ¤¯¤À¤µ¤¤¡£

¥µ¥ó¥×¥ë¤½¤Î£±

#include "a2d.hsp" #include "a2d_add_textpath.hsp" alCreateImage 0, GINFO_WINX, GINFO_WINY alPenWidth 2 ; ¢«ÏÈÀþ¤ÎÂÀ¤µ¤òÊѤ¨¤é¤ì¤ë alPenStyle DashStyleSolid ; ¢«ÅÀÀþ¤Ë¤â½ÐÍè¤ë // ŬÅö¤ÊÇطʤòÉÁ²è size = 20 repeat 480 / size + 1 alColor 180, 255, 220 :alFillRect 0, cnt * size, 640, size / 2 loop // ¥Æ¥­¥¹¥È¤Î¥Õ¥©¥ó¥È¤È¿§ fsize = 55 alFont "¥á¥¤¥ê¥ª", fsize, 1 alColor 0, 0, 0, 255 // a2d ¥â¥¸¥å¡¼¥ë¤ÎÌ¿Îá¤Ç¥Æ¥­¥¹¥È¤òÉÁ²è text = "¡úÄ̾ï¤Îʸ»ú" alDrawText text, 0, 0 // Æȼ«¤Ë³ÈÄ¥¤·¤¿Ì¿Îá¤Ç¡¢¥Æ¥­¥¹¥È¤ÎÏÈÀþ¤òÉÁ²è text = "¡ú±ï¼è¤êʸ»ú" alDrawTextPath text, 0, fsize * 1 // ÏÈÀþ¤òÅÀÀþ¤Ë¤·¤Æ¤ß¤ë text = "¡úÏÈÀþ¤òÅÀÀþ¤Ë" alPenWidth 1 alPenStyle DashStyleDash alDrawTextPath text, 0, fsize * 2 alPenWidth 2 alPenStyle DashStyleSolid // Ãæ¤òÅɤë text = "¡úÃæ¤òÅɤêÄÙ¤¹" alColor 255, 255, 255 :alDrawText text, 0, fsize * 3 alColor 0, 0 ,0 :alDrawTextPath text, -2, fsize * 3 // ÏȤ˥°¥é¥Ç¡¼¥·¥ç¥ó¤òŬÍÑ text = "¡úÏȤò¥°¥é¥Ç¡¼¥·¥ç¥ó" alPenWidth 4 alGradientColor 0, 0, 20, 20, RGBA(255, 127, 255), RGBA(255, 200, 0), WrapModeTileFlipX alDrawTextPath text, 0, fsize * 4 // Ãæ¿È¤ÈÎسԤˤ½¤ì¤¾¤ìÊ̤Υ°¥é¥Ç¡¼¥·¥ç¥ó¤òŬÍÑ text = "¡úÃæ¤ÈÏÈ¥°¥é¥Ç¡¼¥·¥ç¥ó" alPenWidth 4 alGradientColor 0, 0, 0, 44, RGBA(200, 0, 0), RGBA(255, 220, 50), WrapModeTileFlipXY alDrawText text, 2, fsize * 5 alGradientColor 0, 0, 0, 44, RGBA(60, 50, 30), RGBA(180, 150, 0), WrapModeTileFlipXY alDrawTextPath text, 0, fsize * 5 // ÏȤ˥ƥ¯¥¹¥Á¥ã¡¼¤òŬÍÑ text = "¡úÏȤò¥Æ¥¯¥¹¥Á¥ã¡¼" alCreateImageByFile 1, DIR_EXE + "\\sample\\Artlet2D\\texture.jpg" alSelectImage 0 alTextureImage 1, WrapModeTileFlipXY alDrawTextPath text, 0, fsize * 6 // Ãæ¿È¤ÈÎسԤˤ½¤ì¤¾¤ìÊ̤Υƥ¯¥¹¥Á¥ã¡¼¤òŬÍÑ text = "¡úÃæ¤ÈÏȥƥ¯¥¹¥Á¥ã¡¼" alPenWidth 5 alCreateImageByFile 2, DIR_EXE + "\\sample\\game\\bg.bmp" alSelectImage 0 alTextureImage 1, WrapModeTileFlipXY alDrawText text, 1, fsize * 7 alTextureImage 2, WrapModeTileFlipXY alDrawTextPath text, 0, fsize * 7 // ºÇ¸å¤Ë HSP ¤Î¥¦¥£¥ó¥É¥¦¤Ë²èÌ̤ò¥³¥Ô¡¼ alCopyImageToScreen 0, 0 redraw 1 ; ²èÌ̹¹¿·

¥µ¥ó¥×¥ë¤½¤Î£²

#include "a2d.hsp" #include "a2d_add_textpath.hsp" alCreateImage 0, GINFO_WINX, GINFO_WINY alGradientColor 0, 0, GINFO_WINX, 0, RGBA(255, 255, 255), RGBA(160, 220, 255), WrapModeTileFlipX alFillRect 0, 0, GINFO_WINX, GINFO_WINY // ¥Õ¥©¥ó¥È¤È¿§ fsize = 51 :margin = 6 alFont "¥á¥¤¥ê¥ª", fsize, 1 alPenWidth 1 text = "¡ù¤¢¤«¤µ¤¿¤ÊabcXYZ­ß" y = 0 // ʸ»ú¤ÎÃæ¤òÅɤ俸å¤Ë±ï¤òÉÁ¤¯ alColor 255, 255, 255 :alDrawText text, 0, y alColor 0, 0, 0 :alDrawTextPath text, -1, y y += fsize + margin // ʸ»ú¤Î±ï¤òÉÁ¤¤¤¿¸å¤ËÃæ¤òÅɤë alColor 0, 0, 0 :alDrawTextPath text, -1, y alColor 255, 255, 255 :alDrawText text, 0, y y += fsize + margin // ¾¯¤·¤º¤é¤·¤Æɽ¼¨¤¹¤ë¤È¤Á¤ç¤Ã¤ÈΩÂÎŪ¤Ë¸«¤¨¤ë¡©¤Î½Ñ¡£±Æ¤¬Çò¡¦Ê¸»ú¤¬¹õ alColor 255, 255, 255 :alDrawText text, 2, y alColor 0, 0, 0 :alDrawTextPath text, 1, y :alDrawText text, 0, y y += fsize + margin // ¾¯¤·¤º¤é¤·¤Æɽ¼¨¤¹¤ë¤È¤Á¤ç¤Ã¤ÈΩÂÎŪ¤Ë¸«¤¨¤ë¡©¤Î½Ñ¡£±Æ¤¬¹õ¡¦Ê¸»ú¤¬Çò alColor 0, 0, 0 :alDrawText text, 3, y alColor 255, 255, 255 :alDrawText text, 0, y alColor 0, 0, 0 :alDrawTextPath text, -1, y y += fsize + margin // ÏÈÀþ¤òÊ£¿ô¤¢¤ë¤è¤¦¤Ë¸«¤»¤ë¡£¹õ¡¦Çò¡¦¹õ alPenWidth 6 :alColor 0, 0, 0 :alDrawTextPath text, -1, y alPenWidth 4 :alColor 255, 255, 255 :alDrawTextPath text, -1, y :alColor 0, 0, 0 :alDrawText text, 0, y y += fsize + margin // ÏÈÀþ¤òÊ£¿ô¤¢¤ë¤è¤¦¤Ë¸«¤»¤ë¡£¹õ¡¦Çò¡¦ÎС¦²«¿§ alPenWidth 8 :alColor 0, 0, 0 :alDrawTextPath text, -1, y alPenWidth 6 :alColor 255, 255, 255 :alDrawTextPath text, -1, y alPenWidth 2 :alColor 0, 255, 0 :alDrawTextPath text, -1, y :alColor 255, 255, 0 :alDrawText text, 0, y y += fsize + margin // ¸å¤í¤ò¤Ü¤«¤·¤¿É÷¤ÎÜô¿§¡¦Çò alColor 255, 120, 0, 30 repeat 12 alPenWidth cnt :alDrawTextPath text, -1, y loop alPenWidth 1 :alColor 255, 255, 255 :alDrawText text, 0, y y += fsize + margin // ¸å¤í¤ò¤Ü¤«¤·¤¿É÷¤Î¥Ô¥ó¥¯¡¦Çò¡¦¥Ô¥ó¥¯ alColor 255, 130, 200, 30 repeat 12 alPenWidth cnt :alDrawTextPath text, 0, y loop alPenWidth 3 :alColor 255, 255, 255 :alDrawTextPath text, -1, y :alColor 255, 120, 200 :alDrawText text, 0, y y += fsize + margin // ºÇ¸å¤Ë HSP ¤Î¥¦¥£¥ó¥É¥¦¤Ë²èÌ̤ò¥³¥Ô¡¼ alCopyImageToScreen 0, 0 redraw 1 ; ²èÌ̹¹¿·

´Êñ¤Ê³ÈÄ¥¤Ç¤¹¤¬¡¢¹©Éפ·¤À¤¤¤Ç¤Ï¿§¡¹¤Ç¤­¤½¤¦¤Ç¤Ï¤¢¤ê¤Þ¤¹¡£



ONION software Copyright 1997-2023(c) All rights reserved.