// // copied the source file by https://github.com/stackprobe/Factory/blob/master/SubTools/CopyLib.c // public static void DrawBegin(DDPicture picture, double x, double y) { if (DB.Picture != null) { throw new DDError(); } double w = picture.Get_W(); double h = picture.Get_H(); w /= 2.0; h /= 2.0; DB.Picture = picture; DB.X = x; DB.Y = y; DB.Layout = new FreeInfo() { LTX = -w, LTY = -h, RTX = w, RTY = -h, RBX = w, RBY = h, LBX = -w, LBY = h, }; }
public static DDPicture GetPicture(DDPicture picture, int l, int t, int w, int h) { if ( l < 0 || IntTools.IMAX < l || t < 0 || IntTools.IMAX < t || w < 1 || IntTools.IMAX - l < w || h < 1 || IntTools.IMAX - t < h ) { throw new DDError(); } // ? 範囲外 if ( picture.Get_W() < l + w || picture.Get_H() < t + h ) { throw new DDError(); } return(new DDPicture( () => { int handle = DX.DerivationGraph(l, t, w, h, picture.GetHandle()); if (handle == -1) // ? 失敗 { throw new DDError(); } return new DDPicture.PictureInfo() { Handle = handle, W = w, H = h, }; }, DDPictureLoaderUtils.ReleaseInfo, // やる事同じなので共用しちゃう。 DDDerivationUtils.Add )); }
// // copied the source file by https://github.com/stackprobe/Factory/blob/master/SubTools/CopyLib.c // private static void DrawPic_Main(DDPicture picture, ILayoutInfo layout) { // app > @ enter DrawPic // < app if (Extra.A != -1) { SetBlend(DX.DX_BLENDMODE_ALPHA, Extra.A); } else if (Extra.BlendAdd != -1) { SetBlend(DX.DX_BLENDMODE_ADD, Extra.BlendAdd); } else if (Extra.BlendInv) { SetBlend(DX.DX_BLENDMODE_INVSRC, 255); } if (Extra.Mosaic) { DX.SetDrawMode(DX.DX_DRAWMODE_NEAREST); } if (Extra.Bright.R != -1) { SetBright(Extra.Bright.R, Extra.Bright.G, Extra.Bright.B); } { FreeInfo u = layout as FreeInfo; if (u != null) { // ? 失敗 if ( Extra.IntPos ? DX.DrawModiGraph( DoubleTools.ToInt(u.LTX), DoubleTools.ToInt(u.LTY), DoubleTools.ToInt(u.RTX), DoubleTools.ToInt(u.RTY), DoubleTools.ToInt(u.RBX), DoubleTools.ToInt(u.RBY), DoubleTools.ToInt(u.LBX), DoubleTools.ToInt(u.LBY), picture.GetHandle(), 1 ) != 0 : DX.DrawModiGraphF( (float)u.LTX, (float)u.LTY, (float)u.RTX, (float)u.RTY, (float)u.RBX, (float)u.RBY, (float)u.LBX, (float)u.LBY, picture.GetHandle(), 1 ) != 0 ) { if (Extra.IgnoreError == false) { throw new DDError(); } } goto endDraw; } } { RectInfo u = layout as RectInfo; if (u != null) { // ? 失敗 if ( Extra.IntPos ? DX.DrawExtendGraph( DoubleTools.ToInt(u.L), DoubleTools.ToInt(u.T), DoubleTools.ToInt(u.R), DoubleTools.ToInt(u.B), picture.GetHandle(), 1 ) != 0 : DX.DrawExtendGraphF( (float)u.L, (float)u.T, (float)u.R, (float)u.B, picture.GetHandle(), 1 ) != 0 ) { if (Extra.IgnoreError == false) { throw new DDError(); } } goto endDraw; } } { SimpleInfo u = layout as SimpleInfo; if (u != null) { // ? 失敗 if ( Extra.IntPos ? DX.DrawGraph( DoubleTools.ToInt(u.X), DoubleTools.ToInt(u.Y), picture.GetHandle(), 1 ) != 0 : DX.DrawGraphF( (float)u.X, (float)u.Y, picture.GetHandle(), 1 ) != 0 ) { if (Extra.IgnoreError == false) { throw new DDError(); } } goto endDraw; } } throw new DDError(); // ? 不明なレイアウト endDraw: if (Extra.A != -1 || Extra.BlendAdd != -1 || Extra.BlendInv) { ResetBlend(); } if (Extra.Mosaic) { DX.SetDrawMode(DX.DX_DRAWMODE_BILINEAR); } if (Extra.Bright.R != -1) { ResetBright(); } // app > @ leave DrawPic { FreeInfo u = layout as FreeInfo; if (u != null) { double l = u.LTX; double t = u.LTY; double r = u.LTX; double b = u.LTY; l = Math.Min(l, u.RTX); l = Math.Min(l, u.RBX); l = Math.Min(l, u.LBX); t = Math.Min(t, u.RTY); t = Math.Min(t, u.RBY); t = Math.Min(t, u.LBY); r = Math.Max(r, u.RTX); r = Math.Max(r, u.RBX); r = Math.Max(r, u.LBX); b = Math.Max(b, u.RTY); b = Math.Max(b, u.RBY); b = Math.Max(b, u.LBY); Charlotte.Games.NamedCrashMgr.LastDrawedCrash = Charlotte.Common.Options.DDCrashUtils.Rect(new D4Rect( l, t, r - l, b - t )); goto endPostDraw; } } { RectInfo u = layout as RectInfo; if (u != null) { double l = u.L; double t = u.T; double r = u.R; double b = u.B; Charlotte.Games.NamedCrashMgr.LastDrawedCrash = Charlotte.Common.Options.DDCrashUtils.Rect(new D4Rect( l, t, r - l, b - t )); goto endPostDraw; } } { SimpleInfo u = layout as SimpleInfo; if (u != null) { Charlotte.Games.NamedCrashMgr.LastDrawedCrash = Charlotte.Common.Options.DDCrashUtils.Rect(new D4Rect( u.X, u.Y, picture.Get_W(), picture.Get_H() )); goto endPostDraw; } } throw new DDError(); // ? 不明なレイアウト endPostDraw: ; // < app }