Exemple #1
0
        //
        //	copied the source file by https://github.com/stackprobe/Factory/blob/master/SubTools/CopyLib.c
        //
        public static void DrawFree(DDPicture picture, double ltx, double lty, double rtx, double rty, double rbx, double rby, double lbx, double lby)
        {
            FreeInfo layout = new FreeInfo()
            {
                LTX = ltx,
                LTY = lty,
                RTX = rtx,
                RTY = rty,
                RBX = rbx,
                RBY = rby,
                LBX = lbx,
                LBY = lby,
            };

            DrawPic(picture, layout);
        }
Exemple #2
0
        public static DDCrash DrawGetCrash()
        {
            if (DB.Picture == null)
            {
                throw new DDError();
            }

            FreeInfo layout = (FreeInfo)DB.Layout;

            {
                double l = layout.LTX;
                double t = layout.LTY;
                double r = layout.LTX;
                double b = layout.LTY;

                l = Math.Min(l, layout.RTX);
                l = Math.Min(l, layout.RBX);
                l = Math.Min(l, layout.LBX);

                t = Math.Min(t, layout.RTY);
                t = Math.Min(t, layout.RBY);
                t = Math.Min(t, layout.LBY);

                r = Math.Max(r, layout.RTX);
                r = Math.Max(r, layout.RBX);
                r = Math.Max(r, layout.LBX);

                b = Math.Max(b, layout.RTY);
                b = Math.Max(b, layout.RBY);
                b = Math.Max(b, layout.LBY);

                l += DB.X;
                t += DB.Y;
                r += DB.X;
                b += DB.Y;

                return(DDCrashUtils.Rect(new D4Rect(
                                             l,
                                             t,
                                             r - l,
                                             b - t
                                             )));
            }
        }
Exemple #3
0
        //
        //	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

            // < app
        }
Exemple #4
0
        //
        //	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
        }