HSPポータル
サイトマップ お問い合わせ


HSPTV!掲示板


未解決 解決 停止 削除要請

2015
0807
ぺろ複数の透過処理1解決


ぺろ

リンク

2015/8/7(Fri) 02:44:21|NO.70537

現在メイン画面で描画した図形をサブ画面に透過してコピーをしようとしています。
内容は
① メインで描画した背景色を透明色にする (完全に透明化されて見えない状態)
② メインで描画した図形は透明色付きにする (透明度を指定して、半透明にする)

①、②の処理が済んだ状態でサブ画面にコピーをしたいのですが
何をすればいいのか分かりません。
Artlet2Dを使って透過を試みたのですが画面に表示さえ無い状態です。
結果、サブ画面にコピーした際、メイン画面で描画した背景は透明、図形は半透明でコピーできれば良いです。


3,4時間やって結果分からないままなので質問させて頂きました。
ご教示頂ければなと思います。よろしくお願いします。
途中まで作り上げたサンプルですが挙げておきます。



#module ; GDI+ Flat APIs #uselib "gdiplus" #func GdiplusStartup "GdiplusStartup" int, int, int #func GdiplusShutdown "GdiplusShutdown" int #func GdipCreateFromHDC "GdipCreateFromHDC" int, int #func GdipDeleteGraphics "GdipDeleteGraphics" int #func GdipSetSmoothingMode "GdipSetSmoothingMode" int, int #func GdipSetPixelOffsetMode "GdipSetPixelOffsetMode" int, int #func GdipSetClipRectI "GdipSetClipRectI" int, int, int, int, int, int ; Pen / Brush #func GdipCreatePen1 "GdipCreatePen1" int, float, int, int #func GdipCreateSolidFill "GdipCreateSolidFill" int, int #func GdipDeletePen "GdipDeletePen" int #func GdipDeleteBrush "GdipDeleteBrush" int ; Draw (int) #func GdipDrawLineI "GdipDrawLineI" int, int, int, int, int, int #func GdipDrawEllipseI "GdipDrawEllipseI" int, int, int, int, int, int #func GdipFillEllipseI "GdipFillEllipseI" int, int, int, int, int, int ;----------------------------------------------------------- #deffunc gpexit onexit if gdiplusToken { GdipDeletePen gpmPen ; ペンを削除 GdipDeleteBrush gpmBrush ; ブラシを削除 GdipDeleteGraphics gpmGraphics ; Graphics を削除 GdiplusShutdown gdiplusToken ; GDI+ 終了 gdiplusToken = 0 } return #deffunc gpinit gpexit if varptr(GdiplusStartup) { gdiplusToken = 0 gsi = 1, 0, 0, 0 GdiplusStartup varptr(gdiplusToken), varptr(gsi), 0 ; GDI+ 開始 gpmGraphics = 0 GdipCreateFromHDC hdc, varptr(gpmGraphics) ; Graphics 作成 (現在の screen の hdc) GdipSetSmoothingMode gpmGraphics, 2 ; SmoothingModeHighQuality GdipSetPixelOffsetMode gpmGraphics, 2 ; HighQuality gpmPen = 0 gpmBrush = 0 } return ; color 系命令 #define global gpcolor(%1=0, %2=0, %3=0) color %1, %2, %3 : gpcolor_ #define global gphsvcolor(%1=0, %2=0, %3=0) hsvcolor %1, %2, %3 : gpcolor_ #define global gppalcolor(%1=0) palcolor %1 : gpcolor_ #define global gpsyscolor(%1=0) syscolor %1 : gpcolor_ ;----------------------------------------------------------- #deffunc gpcircle_ int p1, int p2, int p3, int p4, int p5 if hdc_bk ! hdc { hdc_bk = hdc gpinit } if gdiplusToken { if gpmPen { GdipDeletePen gpmPen ; ペンを削除 GdipDeleteBrush gpmBrush ; ブラシを削除 } ARGB = 0xff000000|(ginfo_r<<16)|(ginfo_g<<8)|ginfo_b ; ARGB (a=100%) GdipCreatePen1 ARGB, 1, 2, varptr(gpmPen) ; ペンを作成 (width=1, unit=2=UnitPixel) GdipCreateSolidFill ARGB, varptr(gpmBrush) ; ブラシを作成 ; GdipSetClipRectI gpmGraphics, 0, 0, ginfo_winx, ginfo_winy, 0 ; Clip Rect 設定 } if gdiplusToken { if p5 { GdipFillEllipseI gpmGraphics, gpmBrush, p1, p2, p3-p1, p4-p2 } else { GdipDrawEllipseI gpmGraphics, gpmPen, p1, p2, p3-p1, p4-p2 } } else { circle p1, p2, p3, p4, p5 } return ; circle (パラメータ省略用マクロ) #define global gpcircle(%1=0, %2=0, %3=0, %4=0, %5=1) gpcircle_ %1, %2, %3, %4, %5 #global // 角丸四角形を描画する #module #define ctype max( %1, %2 ) ( %1 )*( %1 > %2 ) + ( %2 )*( %1 <= %2 ) #define ctype min( %1, %2 ) ( %1 )*( %1 < %2 ) + ( %2 )*( %1 >= %2 ) #const DEFAULT_R 20 /* rboxf (左上X座標), (左上Y座標), (右下X座標), (右下Y座標), (角の半径) */ #deffunc rboxf int _x1, int _y1, int _x2, int _y2, int _r x1 = min(_x1, _x2) : x2 = max(_x1, _x2) y1 = min(_y1, _y2) : y2 = max(_y1, _y2) box_width = x2 - x1 : box_height = y2 - y1 if ( _r <= 0 ) { r = DEFAULT_R } else { r = _r } r = min( r, min( box_width / 2, box_height / 2 ) ) boxf x1, y1+r, x2, y2-r boxf x1+r, y1, x2-r, y2 repeat 4 x = x1 + ( cnt \ 2 ) * ( box_width - r * 2 + 1) y = y1 + ( cnt / 2 ) * ( box_height - r * 2 + 1 ) gpcircle x, y, x + r * 2, y + r * 2 loop return #global #include "a2d.hsp" // ここまででモジュール終わり // screen 0,300,300,,0,0 : title "メイン (0)" screen 1,300,300,,310,0 : title "サブ (1)" // 適当な背景を作る repeat 100 color rnd(200),rnd(200),rnd(200) line rnd(300),rnd(300),rnd(300) loop onclick*a stop *a randomize rndcolorR=rnd(254) rndcolorG=rnd(254) rndcolorB=rnd(254) Fx=mousex Fy=mousey repeat -1 gsel 0 redraw 0 color rndcolorR,rndcolorG,rndcolorB : boxf : color 0,0,0 ; メインウィンドウの背景色 rboxf Fx, Fy, mousex, mousey, 15 ; 角が丸い楕円形?を描画する (RBG値 = 0,0,0) redraw 1 wait 1 loop



この記事に返信する


ぺろ

リンク

2015/8/7(Fri) 23:07:24|NO.70551

自己解決しました



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