示例#1
0
        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,
            };
        }
示例#2
0
        public DDPicture ToPicture()
        {
            if (this.Picture == null)
            {
                this.Picture = DDPictureLoaders2.Wrapper(this);
            }

            return(this.Picture);
        }
示例#3
0
 public static IEnumerable <DDPicture> GetAnimation_XY(DDPicture parentPicture, int x, int y, int w, int h, int xNum, int yNum, int xStep, int yStep)
 {
     for (int xc = 0; xc < xNum; xc++)
     {
         for (int yc = 0; yc < yNum; yc++)
         {
             yield return(GetPicture(parentPicture, x + xc * xStep, y + yc * yStep, w, h));
         }
     }
 }
示例#4
0
        public static void DrawCenter(DDPicture picture, double x, double y)
        {
            if (
                x < -(double)SCommon.IMAX || (double)SCommon.IMAX < x ||
                y < -(double)SCommon.IMAX || (double)SCommon.IMAX < y
                )
            {
                throw new DDError();
            }

            DrawBegin(picture, x, y);
            DrawEnd();
        }
示例#5
0
        public static DDPicture[,] GetAnimation(DDPicture parentPicture, int x, int y, int w, int h)
        {
            if (parentPicture.Get_W() % w != 0)
            {
                throw new DDError();
            }
            if (parentPicture.Get_H() % h != 0)
            {
                throw new DDError();
            }

            return(GetAnimation(parentPicture, x, y, w, h, parentPicture.Get_W() / w, parentPicture.Get_H() / h));
        }
示例#6
0
        public static DDPicture[,] GetAnimation(DDPicture parentPicture, int x, int y, int w, int h, int xNum, int yNum, int xStep, int yStep)
        {
            DDPicture[,] table = new DDPicture[xNum, yNum];

            for (int xc = 0; xc < xNum; xc++)
            {
                for (int yc = 0; yc < yNum; yc++)
                {
                    table[xc, yc] = GetPicture(parentPicture, x + xc * xStep, y + yc * yStep, w, h);
                }
            }

            return(table);
        }
示例#7
0
        public static void DrawDummyScreenAll()
        {
            DDPicture picture = Ground.I.Picture.DummyScreen;

            foreach (DDSubScreen subScreen in SubScreens)
            {
                using (subScreen.Section())
                {
                    DDDraw.DrawRect(
                        picture,
                        DDUtils.AdjustRectExterior(picture.GetSize().ToD2Size(), new D4Rect(new D2Point(0, 0), subScreen.GetSize().ToD2Size()))
                        );
                }
            }
        }
示例#8
0
        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);
        }
示例#9
0
        public static IEnumerable <DDPicture> GetAnimation_YX(DDPicture parentPicture, int x, int y, int w, int h)
        {
            if (parentPicture.Get_W() % w != 0)
            {
                throw null;
            }
            if (parentPicture.Get_H() % h != 0)
            {
                throw null;
            }

            int xNum = parentPicture.Get_W() / w;
            int yNum = parentPicture.Get_H() / h;

            return(GetAnimation_YX(parentPicture, x, y, w, h, xNum, yNum));
        }
示例#10
0
        public static DDPicture[,] GetAnimation(DDPicture parentPicture, int x, int y, int w, int h)
        {
            if (parentPicture.Get_W() % w != 0)
            {
                throw null;
            }
            if (parentPicture.Get_H() % h != 0)
            {
                throw null;
            }

            int xNum = parentPicture.Get_W() / w;
            int yNum = parentPicture.Get_H() / h;

            return(GetAnimation(parentPicture, x, y, w, h, xNum, yNum));
        }
示例#11
0
        public static void DrawSimple(DDPicture picture, double x, double y)
        {
            if (
                x < -(double)SCommon.IMAX || (double)SCommon.IMAX < x ||
                y < -(double)SCommon.IMAX || (double)SCommon.IMAX < y
                )
            {
                throw new DDError();
            }

            SimpleInfo layout = new SimpleInfo()
            {
                X = x,
                Y = y,
            };

            DrawPic(picture, layout);
        }
示例#12
0
        public static DDPicture GetPicture(DDPicture picture, int l, int t, int w, int h)
        {
            if (
                l < 0 || SCommon.IMAX < l ||
                t < 0 || SCommon.IMAX < t ||
                w < 1 || SCommon.IMAX - l < w ||
                h < 1 || SCommon.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
                       ));
        }
示例#13
0
        private static void DrawPic(DDPicture picture, ILayoutInfo layout)
        {
            if (Extra.TL == null)
            {
                DrawPic_Main(picture, layout);
            }
            else
            {
                ExtraInfo storedExtra = Extra;

                Extra.TL.Add(() =>
                {
                    ExtraInfo currExtra = Extra;

                    Extra = storedExtra;
                    DrawPic_Main(picture, layout);
                    Extra = currExtra;

                    return(false);
                });
            }
        }
示例#14
0
        public static void DrawRect_LTRB(DDPicture picture, double l, double t, double r, double b)
        {
            if (
                l < -(double)SCommon.IMAX || (double)SCommon.IMAX - 1.0 < l ||
                t < -(double)SCommon.IMAX || (double)SCommon.IMAX - 1.0 < t ||
                r < l + 1.0 || (double)SCommon.IMAX < r ||
                b < t + 1.0 || (double)SCommon.IMAX < b
                )
            {
                throw new DDError();
            }

            RectInfo layout = new RectInfo()
            {
                L = l,
                T = t,
                R = r,
                B = b,
            };

            DrawPic(picture, layout);
        }
示例#15
0
 /// <summary>
 /// 画像リソースを追加する。
 /// </summary>
 /// <param name="picture">画像リソース</param>
 public static void Add(DDPicture picture)
 {
     Add(() => picture.GetHandle());
 }
示例#16
0
 public static DDPicture[,] GetAnimation(DDPicture parentPicture, int x, int y, int w, int h, int xNum, int yNum)
 {
     return(GetAnimation(parentPicture, x, y, w, h, xNum, yNum, w, h));
 }
示例#17
0
 public static void DrawBeginRect(DDPicture picture, double l, double t, double w, double h)
 {
     DrawBegin(picture, l + w / 2.0, t + h / 2.0);
     DrawSetSize(w, h);
 }
示例#18
0
 public static void DrawBeginRect_LTRB(DDPicture picture, double l, double t, double r, double b)
 {
     DrawBeginRect(picture, l, t, r - l, b - t);
 }
示例#19
0
 public static void Add(DDPicture picture)
 {
     Pictures.Add(picture);
 }
示例#20
0
 public static void Add(DDPicture derivation)
 {
     Derivations.Add(derivation);
 }
示例#21
0
 public static void DrawRect(DDPicture picture, D4Rect rect)
 {
     DrawRect(picture, rect.L, rect.T, rect.W, rect.H);
 }
示例#22
0
 public static void DrawRect(DDPicture picture, double l, double t, double w, double h)
 {
     DrawRect_LTRB(picture, l, t, l + w, t + h);
 }
示例#23
0
 public static void DrawFree(DDPicture picture, P4Poly poly)
 {
     DrawFree(picture, poly.LT, poly.RT, poly.RB, poly.LB);
 }
示例#24
0
 public static void DrawFree(DDPicture picture, D2Point lt, D2Point rt, D2Point rb, D2Point lb)
 {
     DrawFree(picture, lt.X, lt.Y, rt.X, rt.Y, rb.X, rb.Y, lb.X, lb.Y);
 }
示例#25
0
 public static IEnumerable <DDPicture> GetAnimation_XY(DDPicture parentPicture, int x, int y, int w, int h, int xNum, int yNum)
 {
     return(GetAnimation_XY(parentPicture, x, y, w, h, xNum, yNum, w, h));
 }
示例#26
0
        private static void DrawPic_Main(DDPicture picture, ILayoutInfo layout)
        {
            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(
                            SCommon.ToInt(u.LTX),
                            SCommon.ToInt(u.LTY),
                            SCommon.ToInt(u.RTX),
                            SCommon.ToInt(u.RTY),
                            SCommon.ToInt(u.RBX),
                            SCommon.ToInt(u.RBY),
                            SCommon.ToInt(u.LBX),
                            SCommon.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)
                        {
                            throw new DDError();
                        }
                    }
                    goto endDraw;
                }
            }

            {
                RectInfo u = layout as RectInfo;

                if (u != null)
                {
                    // ? 失敗
                    if (
                        Extra.IntPos ?
                        DX.DrawExtendGraph(
                            SCommon.ToInt(u.L),
                            SCommon.ToInt(u.T),
                            SCommon.ToInt(u.R),
                            SCommon.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)
                        {
                            throw new DDError();
                        }
                    }
                    goto endDraw;
                }
            }

            {
                SimpleInfo u = layout as SimpleInfo;

                if (u != null)
                {
                    // ? 失敗
                    if (
                        Extra.IntPos ?
                        DX.DrawGraph(
                            SCommon.ToInt(u.X),
                            SCommon.ToInt(u.Y),
                            picture.GetHandle(),
                            1
                            )
                        != 0
                                                :
                        DX.DrawGraphF(
                            (float)(u.X),
                            (float)(u.Y),
                            picture.GetHandle(),
                            1
                            )
                        != 0
                        )
                    {
                        if (!Extra.IgnoreError)
                        {
                            throw new DDError();
                        }
                    }
                    goto endDraw;
                }
            }

            throw new DDError();             // ? 不明なレイアウト
endDraw:

            if (Extra.A != -1 || Extra.BlendAdd != -1 || Extra.BlendInv)
            {
                ResetBlend();
            }
            if (Extra.Mosaic)
            {
                DX.SetDrawMode(DDConsts.DEFAULT_DX_DRAWMODE);
            }
            if (Extra.Bright.R != -1)
            {
                ResetBright();
            }
        }