private void DrawImageVertex(ImageInfo info) { // CCW from bottom left var tl = new Vector2(-info.Width / 2, info.Height / 2); var br = new Vector2(info.Width / 2, -info.Height / 2); var transform = info.Angle != 0 ? Matrix3x2.Rotation(info.Angle) : Matrix3x2.Identity; var offTL = tl * info.Scale; var offBR = br * info.Scale; var offTR = new Vector2(offBR.X, offTL.Y); var offBL = new Vector2(offTL.X, offBR.Y); BillboardVertices.Add(new BillboardVertex() { Position = info.Position.ToVector4(), Foreground = Color.White, Background = maskColor, TexTL = info.UV_TopLeft, TexBR = info.UV_BottomRight, OffTL = Matrix3x2.TransformPoint(transform, offTL), OffBL = Matrix3x2.TransformPoint(transform, offBL), OffBR = Matrix3x2.TransformPoint(transform, offBR), OffTR = Matrix3x2.TransformPoint(transform, offTR) }); }
private void MainWindow_Paint(object sender, PaintEventArgs e) { _renderTarget.BeginDraw(); _renderTarget.Clear(Color.FromKnown(Colors.Blue, 1)); PointF center = new PointF(ClientSize.Width / 2, ClientSize.Height / 2); _renderTarget.Transform = Matrix3x2.Rotation(_angle, center); RoundedRect rr = new RoundedRect(new RectF(30, 30, ClientSize.Width - 60, ClientSize.Height - 60), ClientSize.Width / 2.5f, ClientSize.Height / 2.5f); _renderTarget.FillRoundedRect(RectBrush, rr); _renderTarget.DrawRoundedRect(_strokeBrush, 5, _strokeStyle, rr); Ellipse ellipse = new Ellipse(ClientSize.Width / 2, ClientSize.Height / 2, ClientSize.Width / 4, ClientSize.Height / 4); using (EllipseGeometry eg = _factory.CreateEllipseGeometry(ellipse)) { using (Brush b = CreateEllipseBrush(ellipse)) { _renderTarget.FillGeometry(b, eg); _renderTarget.DrawGeometry(_strokeBrush, 5, _strokeStyle, eg); } } RectF textBounds = new RectF(0, 0, ClientSize.Width, ClientSize.Height); _renderTarget.DrawText("Hello, world!", _textFormat, textBounds, _strokeBrush, DrawTextOptions.None, MeasuringMode.Natural); _renderTarget.DrawLine(_strokeBrush, 5, _strokeStyle, new PointF(0, 0), new PointF(ClientSize.Width, ClientSize.Height)); _renderTarget.EndDraw(); }
private void DrawArrow(Brush brush, Brush borderBrush, RawVector2 arrowTip, float rotAngle, float flowSize, bool moveForward, float borderWidth) { var transform = Surface.RenderTarget2D.Transform; var scaleVector = new Vector2(flowSize, flowSize); if (!moveForward) { rotAngle -= (float)Math.PI; } var translationVector = arrowTip + ((Matrix3x2)Surface.RenderTarget2D.Transform).TranslationVector; var scale = Matrix3x2.Scaling(scaleVector); var rotation = Matrix3x2.Rotation(rotAngle, Vector2.Zero); var translation = Matrix3x2.Translation(translationVector); Surface.RenderTarget2D.Transform = scale * rotation * translation; if (brush != null) { Surface.RenderTarget2D.FillGeometry(LineFlow, brush); } if (borderBrush != null) { Surface.RenderTarget2D.DrawGeometry(LineFlow, borderBrush, borderWidth); } Surface.RenderTarget2D.Transform = transform; }
/// <summary> /// Called when [draw texture]. /// </summary> /// <param name="deviceResources">The device resources.</param> protected override void OnUpdateTextureAndBillboardVertices(IDeviceResources deviceResources) { var w = Width; var h = Height; // CCW from bottom left var tl = new Vector2(-w / 2, h / 2); var br = new Vector2(w / 2, -h / 2); var uv_tl = new Vector2(0, 0); var uv_br = new Vector2(1, 1); var transform = Angle != 0 ? Matrix3x2.Rotation(Angle) : Matrix3x2.Identity; var tr = new Vector2(br.X, tl.Y); var bl = new Vector2(tl.X, br.Y); BillboardVertices.Add(new BillboardVertex() { Position = Center.ToVector4(), Foreground = Color.White, Background = MaskColor, TexTL = uv_tl, TexBR = uv_br, OffTL = Matrix3x2.TransformPoint(transform, tl), OffBR = Matrix3x2.TransformPoint(transform, br), OffBL = Matrix3x2.TransformPoint(transform, bl), OffTR = Matrix3x2.TransformPoint(transform, tr) }); }
public void DrawTexture(string textureKey, RectangleF rect, float rotation = 0.0f, float opacity = 1.0f) { var textureEntry = this.textureManager.GetTexture(textureKey); if (textureEntry == null) { throw new TextureNotFoundException(textureKey); } if (rotation == 0.0f) { this.context.RenderTarget.DrawBitmap(textureEntry.Bitmap, rect, opacity, BitmapInterpolationMode.Linear); } else { var mtx = this.context.RenderTarget.Transform; var scaling = new Vector2((float)rect.Width / textureEntry.Bitmap.Size.Width, (float)rect.Height / textureEntry.Bitmap.Size.Height); this.context.RenderTarget.Transform = Matrix3x2.Translation(-textureEntry.Center) * Matrix3x2.Rotation(rotation) * Matrix3x2.Translation(textureEntry.Center) * Matrix3x2.Scaling(scaling) * Matrix3x2.Translation(rect.Location); this.context.RenderTarget.DrawBitmap(textureEntry.Bitmap, opacity, BitmapInterpolationMode.Linear); this.context.RenderTarget.Transform = mtx; } }
private void DrawCharacter(string text, Vector3 origin, float w, float h, TextInfo info) { // CCW from bottom left var tl = new Vector2(-w / 2, h / 2); var br = new Vector2(w / 2, -h / 2); var uv_tl = new Vector2(0, 0); var uv_br = new Vector2(1, 1); var transform = info.Angle != 0 ? Matrix3x2.Rotation(info.Angle) : Matrix3x2.Identity; var offTL = tl * info.Scale; var offBR = br * info.Scale; var offTR = new Vector2(offBR.X, offTL.Y); var offBL = new Vector2(offTL.X, offBR.Y); BillboardVertices.Add(new BillboardVertex() { Position = info.Origin.ToVector4(), Foreground = FontColor, Background = BackgroundColor, TexTL = uv_tl, TexBR = uv_br, OffTL = Matrix3x2.TransformPoint(transform, offTL), OffBL = Matrix3x2.TransformPoint(transform, offBL), OffBR = Matrix3x2.TransformPoint(transform, offBR), OffTR = Matrix3x2.TransformPoint(transform, offTR) }); }
public void Rotation() { float x = Rect.Left; float x1 = Rect.Right; float y = Rect.Top; float y1 = Rect.Bottom; vertex = new Vector2[4]; vertex[0].X = x; vertex[0].Y = y; vertex[1].X = x1; vertex[1].Y = y; vertex[2].X = x1; vertex[2].Y = y1; vertex[3].X = x; vertex[3].Y = y1; float w = x1 - x; float h = y1 - y; Center = new Vector2(x + 0.5f * w, y + h + 5); vertex = MathF.RotatePoint2(vertex, Center, 360 - Angle); float a = Angle * 0.01666666f; Center = new Vector2(x + 0.5f * w, y + 0.5f * h); Matri = Matrix3x2.Rotation(a, Center); Origin = Center; }
public void DrawString(string text, System.Drawing.PointF origin, System.Drawing.Font font, System.Drawing.Color color, System.Drawing.ContentAlignment alignment, float angle) { var size = MeasureString(text, font, alignment); var format = CreateTextFormat(font); format.TextAlignment = ToTextAlignment(alignment); format.ParagraphAlignment = ToParagraphAlignment(alignment); var transform = Math.Abs(angle) > Math.PI / 180 ? Matrix3x2.Rotation(angle, ToRawVector2(origin)) : (Matrix3x2?)null; var layout = new TextLayout(_writeFactory, text, format, size.Width * 2, size.Height * 2, 1, transform, true); layout.ParagraphAlignment = ToParagraphAlignment(alignment); layout.TextAlignment = ToTextAlignment(alignment); var brush = CreateSolidColorBrush(color); var alignedOrigin = AlignTextOrigin(origin, size, alignment); if (transform.HasValue) { _renderTarget.Transform = transform.Value; } _renderTarget.DrawTextLayout(SnapToGrid(ToRawVector2(alignedOrigin)), layout, brush, DrawTextOptions.None); _renderTarget.Transform = Matrix3x2.Identity; // 2cache? _frameResources.Add(layout); }
protected override void OnRender(ChartControl chartControl, ChartScale chartScale) { // Create a Font, Brush and TextFormat to draw our text. // For more information on drawing Text, please see the source code for the Text DrawingTool var font = new Gui.Tools.SimpleFont("Arial", 20); SharpDX.Direct2D1.Brush tmpBrush = Brushes.Red.ToDxBrush(RenderTarget); SharpDX.DirectWrite.TextFormat textFormat = font.ToDirectWriteTextFormat(); // Create a TextLayout for our text to draw. var cachedTextLayout = new SharpDX.DirectWrite.TextLayout(Core.Globals.DirectWriteFactory, "Hello, I am sideways text.", textFormat, 600, textFormat.FontSize); // Rotate the RenderTarget by setting the Matrix3x2 Transform property // Matrix3x2.Rotation() will return a rotated Matrix3x2 based off of the angle specified, and the center point where you draw the object RenderTarget.Transform = Matrix3x2.Rotation(1.5708f, new Vector2(100, 100)); // Draw the text on the rotated RenderTarget RenderTarget.DrawTextLayout(new SharpDX.Vector2(100, 100), cachedTextLayout, tmpBrush, SharpDX.Direct2D1.DrawTextOptions.NoSnap); // Dispose of resources textFormat.Dispose(); cachedTextLayout.Dispose(); tmpBrush.Dispose(); // Rotate the RenderTarget back RenderTarget.Transform = Matrix3x2.Identity; // Return rendering to base class base.OnRender(chartControl, chartScale); }
public void DrawText(WindowRenderTarget renderTarget, string titleText, string xAxisText, string yAxisText, float baseTextSize) { var sgOffsetY = renderTarget.Size.Height * 1 / 15; var sgOffsetX = renderTarget.Size.Width * 1 / 15; var containerHeight = renderTarget.Size.Height - sgOffsetY * 2; var containerWidth = renderTarget.Size.Width - sgOffsetX * 2; // not used? var textWidth = (int)containerHeight; var textHeight = (int)sgOffsetY; var factoryDWrite = new SharpDX.DirectWrite.Factory(); _textFormatTitle = new TextFormat(factoryDWrite, "Segoe", baseTextSize * 5 / 4) { TextAlignment = TextAlignment.Center, ParagraphAlignment = ParagraphAlignment.Center }; _textFormatHorizontal = new TextFormat(factoryDWrite, "Segoe", baseTextSize) { TextAlignment = TextAlignment.Center, ParagraphAlignment = ParagraphAlignment.Far }; _textFormatVertical = new TextFormat(factoryDWrite, "Segoe", baseTextSize) { TextAlignment = TextAlignment.Center, ParagraphAlignment = ParagraphAlignment.Far }; renderTarget.AntialiasMode = AntialiasMode.PerPrimitive; renderTarget.TextAntialiasMode = SharpDX.Direct2D1.TextAntialiasMode.Cleartype; var ClientRectangleTitle = new RectangleF(0, 0, textWidth, textHeight); var ClientRectangleXAxis = new RectangleF(0, containerHeight - textHeight + sgOffsetY * 2, textWidth, textHeight); var ClientRectangleYAxis = new RectangleF(-sgOffsetX, containerHeight - textHeight + sgOffsetY, textWidth, textHeight); _textSceneColorBrush.Color = _black; // Draw title and x axis text. renderTarget.BeginDraw(); renderTarget.Clear(_white); renderTarget.DrawText(titleText, _textFormatTitle, ClientRectangleTitle, _textSceneColorBrush); renderTarget.DrawText(xAxisText, _textFormatHorizontal, ClientRectangleXAxis, _textSceneColorBrush); renderTarget.EndDraw(); // Rotate render target to draw y axis text. renderTarget.Transform = Matrix3x2.Rotation((float)(-Math.PI / 2), new SharpDX.Vector2(0, containerHeight)); renderTarget.BeginDraw(); renderTarget.DrawText(yAxisText, _textFormatVertical, ClientRectangleYAxis, _textSceneColorBrush); renderTarget.EndDraw(); // Rotate the RenderTarget back. renderTarget.Transform = Matrix3x2.Identity; }
public static Matrix3x2 Rotate(this Matrix3x2 target, float radians) { Matrix3x2 vMatrix = Matrix3x2.Multiply(Matrix3x2.Rotation(radians), target); /* target.M31 += dx; * target.M32 += dy;*/ return(vMatrix); }
public override void Render() { DeviceContext.Clear(Color.MediumPurple); DeviceContext.Transform = Matrix3x2.Rotation(position * 0.018f, new Vector2(position + 100, 200)); DeviceContext.DrawBitmap(Resource, "Image", new RawRectangleF(position, 100, position + 200, 300)); DeviceContext.Transform = Matrix3x2.Identity; }
public void Draw(BitmapManager bmp, RenderTarget ctx) { ctx.Transform = Matrix3x2.Translation(-24, -24) * Matrix3x2.Rotation(RotationAngle) * Matrix3x2.Scaling(Scale) * Matrix3x2.Translation(X, Y); ctx.DrawBitmap(bmp[_snow], 1.0f, BitmapInterpolationMode.Linear); }
/** * Given a point that has already had bone total-transform applied to it, retransform it as the rotation of this bone was adjusted by a delta. */ public Vector2 RetransformPoint(SkeletonInputs inputs, float rotationDelta, Vector2 point) { Matrix3x2 parentTransform = GetChainedTransform(Parent, inputs); Vector2 transformedCenter = Matrix3x2.TransformPoint(parentTransform, Center); var retransform = Matrix3x2.Rotation(rotationDelta, transformedCenter); return(Matrix3x2.TransformPoint(retransform, point)); }
private void DrawSprite(SharpDX.RectangleF destinationRectangle, SharpDX.Direct2D1.Bitmap bitmap, SharpDX.RectangleF sourceRectangle, float angle) { SharpDX.Vector2 center = new SharpDX.Vector2 { X = destinationRectangle.X + (destinationRectangle.Width / 2f), Y = destinationRectangle.Y + (destinationRectangle.Height / 2f) }; this.device.Transform = Matrix3x2.Rotation(angle, center); this.device.DrawBitmap(bitmap, new SharpDX.RectangleF?(destinationRectangle), 1f, BitmapInterpolationMode.Linear, new SharpDX.RectangleF?(sourceRectangle)); this.device.Transform = Matrix3x2.Rotation(0f); }
private Matrix3x2 GetCenterRenderTransform(float scaleFactor, float xLocation, float yLocation, float rotation) { var scaleTransform = Matrix3x2.Scaling(scaleFactor); var geometryBounds = GetBounds(scaleTransform); float centerScalingOffset = scaleFactor * 4; float xTranslate = xLocation - (geometryBounds.Right - geometryBounds.Left) + centerScalingOffset; float yTranslate = yLocation - (geometryBounds.Bottom - geometryBounds.Top) + centerScalingOffset; return(scaleTransform * Matrix3x2.Rotation(rotation) * Matrix3x2.Translation(xTranslate, yTranslate)); }
private void DrawSprite(RectangleF destinationRectangle, Bitmap bitmap, RectangleF sourceRectangle, float angle) { Vector2 center = new Vector2(); center.X = destinationRectangle.X + destinationRectangle.Width / 2; center.Y = destinationRectangle.Y + destinationRectangle.Height / 2; device.Transform = Matrix3x2.Rotation(angle, center); device.DrawBitmap(bitmap, destinationRectangle, 1.0f, BitmapInterpolationMode.Linear, sourceRectangle); device.Transform = Matrix3x2.Rotation(0); }
/// <summary> /// 计算转换矩阵。 /// </summary> private void CalculateMatrix() { matrix = new Matrix3x2(1, 0, 0, 1, -shape.Center.X, -shape.Center.Y); if (rotate != 0) { matrix *= Matrix3x2.Rotation(this.rotateRadian); } if (this.scale != 1) { matrix *= Matrix3x2.Scaling(scale); } matrix *= Matrix3x2.Translation(offset.X + scale * shape.Center.X, offset.Y + scale * shape.Center.Y); }
// 進行と描画 public void 進行描画する(DeviceContext d2ddc) { var count = this._回転カウンタ.現在値; // 0~_回転段数-1 var 換行列2D = Matrix3x2.Rotation( angle: (float)(2.0 * Math.PI * ((double)count / _回転段数)), center: new Vector2(this._Spinner画像.サイズ.Width / 2f, this._Spinner画像.サイズ.Height / 2f)) * Matrix3x2.Translation( (Global.GraphicResources.設計画面サイズ.Width - this._Spinner画像.サイズ.Width) / 2f, (Global.GraphicResources.設計画面サイズ.Height - this._Spinner画像.サイズ.Height) / 2f); this._Spinner画像.描画する(d2ddc, 換行列2D); }
private void CalculateMatrix() { matrix = new Matrix3x2(1, 0, 0, 1, -orignalCenter.X, -orignalCenter.Y); if (rotate != 0) { float rotateRadian = (float)(lastrotate * Math.PI / 180); matrix *= Matrix3x2.Rotation(rotateRadian); } if (this.scale != 1) { matrix *= Matrix3x2.Scaling(scale); } matrix *= Matrix3x2.Translation(offset.X + scale * orignalCenter.X, offset.Y + scale * orignalCenter.Y); }
public void Render(DeviceContext context) { //todo 画面外の場合は描画しないほうがいいのでは var Width = Location.Right - Location.Left; var Height = Location.Bottom - Location.Top; //拡大縮小して先頭分ずらして回転して本来の位置に戻すついでにオフセット付加 context.Transform = Matrix3x2.Scaling(Width / (Sprite.Rect.Right - Sprite.Rect.Left), Height / (Sprite.Rect.Bottom - Sprite.Rect.Top)) * Matrix3x2.Translation(-(RotateOrigin.X * Width), -(RotateOrigin.Y * Height)) * Matrix3x2.Rotation(Rotate) * Matrix3x2.Translation((RotateOrigin.X * Width) + Location.Left, (RotateOrigin.Y * Height) + Location.Top); Sprite.Render(context); }
public override void Render() { DeviceContext.Clear(Color.CornflowerBlue); DeviceContext.Transform = Matrix3x2.Rotation(position * 0.018f, new Vector2(position + 50, position + 150)); DeviceContext.DrawBitmap(Resource, "Image", new RawRectangleF(position, position + 100, position + 100, position + 200)); DeviceContext.Transform = Matrix3x2.Transformation(1, 1, 0, 10, 10); DeviceContext.DrawSprite(Resource, "Sprite"); DeviceContext.Transform = Matrix3x2.Identity; SpriteBatch.Begin(); SpriteBatch.Draw(Resource.Get <SpriteResource>("Saikoro"), new Vector2(position + 100, 150), position * 0.018f); SpriteBatch.End(); }
protected override void OnRender(DateTime time) { var radian = Rotate * Math.PI / 180; Renderer.Device.Transform = Matrix3x2.Rotation((float)radian, new Vector2(Size.Width / 2, Size.Height / 2)) * Matrix3x2.Scaling(Scale) * Matrix3x2.Translation(Location); if (Source != null) { Renderer.Device.DrawBitmap(Source, new RawRectangleF(0, 0, Size.Width, Size.Height), Opacity, d2.BitmapInterpolationMode.Linear); } Renderer.Device.Transform = Matrix3x2.Identity; }
protected override void OnRender(WindowRenderTarget renderTarget) { if (this._image != null) { renderTarget.Transform = Matrix3x2.Rotation(this.RotationAngle, new PointF(ClientSize.Width / 2, ClientSize.Height / 2)); SizeU imageSize = this._image.PixelSize; double scale = Math.Min((double)(ClientSize.Width - 20) / imageSize.Width, (double)(ClientSize.Height - 20) / imageSize.Height); int imageWidth = (int)(imageSize.Width * scale); int imageHeight = (int)(imageSize.Height * scale); RectF imageBounds = new RectF((ClientSize.Width - imageWidth) / 2, (ClientSize.Height - imageHeight) / 2, imageWidth, imageHeight); renderTarget.DrawBitmap(this._image, imageBounds, 1, BitmapInterpolationMode.Linear); if (ShowBorder) { renderTarget.DrawRect(this._borderBrush, 8, imageBounds); } } }
public void EndDraw() { if (!IsFinished) { if (Offset >= MinTime) { _target.Transform = Matrix3x2.Translation(-_x.RealTime, -_y.RealTime) * Matrix3x2.Scaling(_vx.RealTime, _vy.RealTime) * Matrix3x2.Rotation(_r.RealTime) * Matrix3x2.Translation(_x.RealTime, _y.RealTime); if (_f.RealTime > 0) { _target.DrawBitmap(_bitmap, new RectangleF(Rect.RealTime.Left - _originOffsetX, Rect.RealTime.Top - _originOffsetY, Rect.RealTime.Right - Rect.RealTime.Left, Rect.RealTime.Bottom - Rect.RealTime.Top), _f.RealTime, D2D.BitmapInterpolationMode.Linear); #if DEBUG //Target.DrawRectangle(Rect.RealTime, _redBrush, 1); #endif } _target.Transform = new Matrix3x2(1, 0, 0, 1, 0, 0); } } else { //Dispose(); // Target.Transform = Matrix3x2.Translation(-_x.RealTime - _originOffsetX, -_y.RealTime - _originOffsetY) * // Matrix3x2.Scaling(_vx.RealTime, _vy.RealTime) * // Matrix3x2.Rotation(_r.RealTime) * // Matrix3x2.Translation(_x.RealTime + _originOffsetX, _y.RealTime + _originOffsetY); // //if (EnableLog) LogUtil.LogInfo(string.Format("[{0},{1},{2},{3}]", InRect.RealTime.Left, // // InRect.RealTime.Top, InRect.RealTime.Right, InRect.RealTime.Bottom)); // //Target.FillOpacityMask(Bitmap, _brush, D2D.OpacityMaskContent.TextGdiCompatible, Rect.Target, null); // if (_f.Target > 0) // { // Target.DrawBitmap(Bitmap, Rect.Target, _f.Target, D2D.BitmapInterpolationMode.Linear/*, TarInRect*/); //todo: bug //#if DEBUG // Target.DrawRectangle(Rect.Target, _redBrush, 1); //#endif // } // Target.Transform = new Matrix3x2(1, 0, 0, 1, 0, 0); } }
private Brush CreateEllipseBrush(Ellipse ellipse) { RectF bounds = ellipse.Bounds; RadialGradientBrushProperties properties = new RadialGradientBrushProperties(bounds.Center, new PointF(), ellipse.RadiusX, ellipse.RadiusY); using (GradientStopCollection collection = _renderTarget.CreateGradientStopCollection(new GradientStop[] { new GradientStop(0, Color.FromKnown(Colors.Blue, 1)), new GradientStop(0.5f, Color.FromKnown(Colors.Green, 1)), new GradientStop(1, Color.FromKnown(Colors.Blue, 1)) })) { Brush brush = _renderTarget.CreateRadialGradientBrush(properties, BrushProperties.Default, collection); brush.Transform = Matrix3x2.Rotation(_angle, bounds.Center); return(brush); } }
protected override void OnRender(NinjaTrader.Gui.Chart.ChartControl chartControl, NinjaTrader.Gui.Chart.ChartScale chartScale) { //SetZOrder(int.MaxValue); //base.OnRender(chartControl, chartScale); if (RenderTarget == null || Bars == null || Bars.Instrument == null || myBitmap == null) { return; } if (!IsInHitTest) { RenderTarget.Transform = Matrix3x2.Rotation(myfloat, new Vector2((float)ChartPanel.W / 2, (float)ChartPanel.H / 2)); RenderTarget.DrawBitmap(myBitmap, new SharpDX.RectangleF((float)ChartPanel.W / 2 - W / 2, (float)ChartPanel.H / 2 - H / 2, W, H), 1.0f, SharpDX.Direct2D1.BitmapInterpolationMode.Linear); RenderTarget.Transform = Matrix3x2.Identity; RenderTarget.Transform = Matrix3x2.Rotation(-myfloat, new Vector2((float)ChartPanel.W / 2, (float)ChartPanel.H / 2)); } }
public override void 進行描画する(DeviceContext d2ddc, float x, float y, double 達成率0to100) { if (this._初めての進行描画) { this._初めての進行描画 = false; this._アイコン.開始する(); this._下線.開始する(); this._数値.開始する(達成率0to100); var start = Global.Animation.Timer.Time; foreach (var anim in this._黒帯アニメーション) { anim.ストーリーボード?.Schedule(start); } } var preTrans = d2ddc.Transform; // 黒帯 foreach (var 黒帯 in this._黒帯アニメーション) { d2ddc.Transform = Matrix3x2.Rotation((float)黒帯.回転角rad.Value) * Matrix3x2.Translation((float)黒帯.中心位置X.Value, (float)黒帯.中心位置Y.Value) * preTrans; using var brush = new SolidColorBrush(d2ddc, new Color4(0f, 0f, 0f, (float)黒帯.透明度.Value)); float w = (float)黒帯.太さ.Value; float h = 1600.0f; var rc = new RectangleF(-w / 2f, -h / 2f, w, h); d2ddc.FillRectangle(rc, brush); } d2ddc.Transform = preTrans; this._アイコン.進行描画する(d2ddc, x, y); this._数値.進行描画する(d2ddc, x + 150f, y + 48f); this._下線.進行描画する(d2ddc, x + 33f, y + 198f); }
private void DrawImageVertex(ImageInfo info) { GetQuadOffset(info.Width, info.Height, info.HorizontalAlignment, info.VerticalAlignment, out var tl, out var br); var transform = info.Angle != 0 ? Matrix3x2.Rotation(info.Angle) : Matrix3x2.Identity; var offTL = tl * info.Scale; var offBR = br * info.Scale; var offTR = new Vector2(offBR.X, offTL.Y); var offBL = new Vector2(offTL.X, offBR.Y); BillboardVertices.Add(new BillboardVertex() { Position = info.Position.ToVector4(), Foreground = Color.White, Background = maskColor, TexTL = info.UV_TopLeft, TexBR = info.UV_BottomRight, OffTL = Matrix3x2.TransformPoint(transform, offTL), OffBL = Matrix3x2.TransformPoint(transform, offBL), OffBR = Matrix3x2.TransformPoint(transform, offBR), OffTR = Matrix3x2.TransformPoint(transform, offTR) }); }
/// <summary> /// Called when [draw texture]. /// </summary> /// <param name="deviceResources">The device resources.</param> protected override void OnUpdateTextureAndBillboardVertices(IDeviceResources deviceResources) { GetQuadOffset(Width, Height, HorizontalAlignment, VerticalAlignment, out var tl, out var br); var uv_tl = new Vector2(0, 0); var uv_br = new Vector2(1, 1); var transform = Angle != 0 ? Matrix3x2.Rotation(Angle) : Matrix3x2.Identity; var tr = new Vector2(br.X, tl.Y); var bl = new Vector2(tl.X, br.Y); BillboardVertices.Add(new BillboardVertex() { Position = Center.ToVector4(), Foreground = Color.White, Background = MaskColor, TexTL = uv_tl, TexBR = uv_br, OffTL = Matrix3x2.TransformPoint(transform, tl), OffBR = Matrix3x2.TransformPoint(transform, br), OffBL = Matrix3x2.TransformPoint(transform, bl), OffTR = Matrix3x2.TransformPoint(transform, tr) }); }