Exemple #1
0
 static void register() {
   GraphicsPrimitive[] primitives = {
     new D3DMaskFill(AnyColor, SrcOver),
     new D3DMaskFill(OpaqueColor, SrcNoEa),
     new D3DMaskFill(GradientPaint, SrcOver),
     new D3DMaskFill(OpaqueGradientPaint, SrcNoEa),
     new D3DMaskFill(LinearGradientPaint, SrcOver),
     new D3DMaskFill(OpaqueLinearGradientPaint, SrcNoEa),
     new D3DMaskFill(RadialGradientPaint, SrcOver),
     new D3DMaskFill(OpaqueRadialGradientPaint, SrcNoEa),
     new D3DMaskFill(TexturePaint, SrcOver),
     new D3DMaskFill(OpaqueTexturePaint, SrcNoEa),
   };
   GraphicsPrimitiveMgr.register(primitives);
 }
  static void register() {
    Blit blitIntArgbPreToSurface =
        new D3DSwToSurfaceBlit(SurfaceType.IntArgbPre, D3DSurfaceData.ST_INT_ARGB_PRE);
    Blit blitIntArgbPreToTexture =
        new D3DSwToTextureBlit(SurfaceType.IntArgbPre, D3DSurfaceData.ST_INT_ARGB_PRE);

    GraphicsPrimitive[] primitives = {
      // prevent D3DSurface -> Screen blits
      new D3DSurfaceToGDIWindowSurfaceBlit(),
      new D3DSurfaceToGDIWindowSurfaceScale(),
      new D3DSurfaceToGDIWindowSurfaceTransform(),

      // surface->surface ops
      new D3DSurfaceToSurfaceBlit(),
      new D3DSurfaceToSurfaceScale(),
      new D3DSurfaceToSurfaceTransform(),

      // render-to-texture surface->surface ops
      new D3DRTTSurfaceToSurfaceBlit(),
      new D3DRTTSurfaceToSurfaceScale(),
      new D3DRTTSurfaceToSurfaceTransform(),

      // surface->sw ops
      new D3DSurfaceToSwBlit(SurfaceType.IntArgb, D3DSurfaceData.ST_INT_ARGB),

      // sw->surface ops
      blitIntArgbPreToSurface,
      new D3DSwToSurfaceBlit(SurfaceType.IntArgb, D3DSurfaceData.ST_INT_ARGB),
      new D3DSwToSurfaceBlit(SurfaceType.IntRgb, D3DSurfaceData.ST_INT_RGB),
      new D3DSwToSurfaceBlit(SurfaceType.IntBgr, D3DSurfaceData.ST_INT_BGR),
      new D3DSwToSurfaceBlit(SurfaceType.ThreeByteBgr, D3DSurfaceData.ST_3BYTE_BGR),
      new D3DSwToSurfaceBlit(SurfaceType.Ushort565Rgb, D3DSurfaceData.ST_USHORT_565_RGB),
      new D3DSwToSurfaceBlit(SurfaceType.Ushort555Rgb, D3DSurfaceData.ST_USHORT_555_RGB),
      new D3DSwToSurfaceBlit(SurfaceType.ByteIndexed, D3DSurfaceData.ST_BYTE_INDEXED),
      // REMIND: we don't have a native sw loop to back this loop up
      //            new D3DSwToSurfaceBlit(SurfaceType.ByteIndexedBm,
      //                                   D3DSurfaceData.ST_BYTE_INDEXED_BM),
      new D3DGeneralBlit(
          D3DSurfaceData.D3DSurface, CompositeType.AnyAlpha, blitIntArgbPreToSurface),
      new D3DSwToSurfaceScale(SurfaceType.IntArgb, D3DSurfaceData.ST_INT_ARGB),
      new D3DSwToSurfaceScale(SurfaceType.IntArgbPre, D3DSurfaceData.ST_INT_ARGB_PRE),
      new D3DSwToSurfaceScale(SurfaceType.IntRgb, D3DSurfaceData.ST_INT_RGB),
      new D3DSwToSurfaceScale(SurfaceType.IntBgr, D3DSurfaceData.ST_INT_BGR),
      new D3DSwToSurfaceScale(SurfaceType.ThreeByteBgr, D3DSurfaceData.ST_3BYTE_BGR),
      new D3DSwToSurfaceScale(SurfaceType.Ushort565Rgb, D3DSurfaceData.ST_USHORT_565_RGB),
      new D3DSwToSurfaceScale(SurfaceType.Ushort555Rgb, D3DSurfaceData.ST_USHORT_555_RGB),
      new D3DSwToSurfaceScale(SurfaceType.ByteIndexed, D3DSurfaceData.ST_BYTE_INDEXED),
      // REMIND: we don't have a native sw loop to back this loop up
      //            new D3DSwToSurfaceScale(SurfaceType.ByteIndexedBm,
      //                                    D3DSurfaceData.ST_BYTE_INDEXED_BM),

      new D3DSwToSurfaceTransform(SurfaceType.IntArgb, D3DSurfaceData.ST_INT_ARGB),
      new D3DSwToSurfaceTransform(SurfaceType.IntArgbPre, D3DSurfaceData.ST_INT_ARGB_PRE),
      new D3DSwToSurfaceTransform(SurfaceType.IntRgb, D3DSurfaceData.ST_INT_RGB),
      new D3DSwToSurfaceTransform(SurfaceType.IntBgr, D3DSurfaceData.ST_INT_BGR),
      new D3DSwToSurfaceTransform(SurfaceType.ThreeByteBgr, D3DSurfaceData.ST_3BYTE_BGR),
      new D3DSwToSurfaceTransform(SurfaceType.Ushort565Rgb, D3DSurfaceData.ST_USHORT_565_RGB),
      new D3DSwToSurfaceTransform(SurfaceType.Ushort555Rgb, D3DSurfaceData.ST_USHORT_555_RGB),
      new D3DSwToSurfaceTransform(SurfaceType.ByteIndexed, D3DSurfaceData.ST_BYTE_INDEXED),
      // REMIND: we don't have a native sw loop to back this loop up
      //            new D3DSwToSurfaceTransform(SurfaceType.ByteIndexedBm,
      //                                        D3DSurfaceData.ST_BYTE_INDEXED_BM),

      // texture->surface ops
      new D3DTextureToSurfaceBlit(),
      new D3DTextureToSurfaceScale(),
      new D3DTextureToSurfaceTransform(),

      // sw->texture ops
      blitIntArgbPreToTexture,
      new D3DSwToTextureBlit(SurfaceType.IntRgb, D3DSurfaceData.ST_INT_RGB),
      new D3DSwToTextureBlit(SurfaceType.IntArgb, D3DSurfaceData.ST_INT_ARGB),
      new D3DSwToTextureBlit(SurfaceType.IntBgr, D3DSurfaceData.ST_INT_BGR),
      new D3DSwToTextureBlit(SurfaceType.ThreeByteBgr, D3DSurfaceData.ST_3BYTE_BGR),
      new D3DSwToTextureBlit(SurfaceType.Ushort565Rgb, D3DSurfaceData.ST_USHORT_565_RGB),
      new D3DSwToTextureBlit(SurfaceType.Ushort555Rgb, D3DSurfaceData.ST_USHORT_555_RGB),
      new D3DSwToTextureBlit(SurfaceType.ByteIndexed, D3DSurfaceData.ST_BYTE_INDEXED),
      // REMIND: we don't have a native sw loop to back this loop up
      //            new D3DSwToTextureBlit(SurfaceType.ByteIndexedBm,
      //                                   D3DSurfaceData.ST_BYTE_INDEXED_BM),
      new D3DGeneralBlit(D3DSurfaceData.D3DTexture, CompositeType.SrcNoEa, blitIntArgbPreToTexture),
    };
    GraphicsPrimitiveMgr.register(primitives);
  }