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 )); }
/// <summary> /// 画像リソースを追加する。 /// </summary> /// <param name="picture">画像リソース</param> public static void Add(DDPicture picture) { Add(() => picture.GetHandle()); }
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(); } }