SixLabors / ImageSharp

:camera: A modern, cross-platform, 2D Graphics library for .NET

Home Page:https://sixlabors.com/products/imagesharp/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

SetDrawingTransform doesn't seem to affect all Draw calls

RobotGizmo opened this issue · comments

Prerequisites

  • I have written a descriptive issue title
  • I have verified that I am running the latest version of ImageSharp
  • I have verified if the problem exist in both DEBUG and RELEASE mode
  • I have searched open and closed issues to ensure it has not already been reported

ImageSharp version

3.1.1

Other ImageSharp packages and versions

Drawing: 2.1.0

Environment (Operating system, version and so on)

Windows 11

.NET Framework version

.NET 8

Description

If I call SetDrawingTransform to set a rotation then call DrawImage the image isn't drawn with any rotation. Should SetDrawingTransform be affecting all draw calls or is it limited to only some of them?

Steps to Reproduce

This is basically the code, I just set the rotation on context then call DrawImage.

x.SetDrawingTransform(Matrix3x2Extensions.CreateRotationDegrees(60, new PointF(10, 10)));
x.DrawImage(bitmap); 

Images

No response

As a follow-up, I'm not sure if DrawImage counts as a shape or not. Sorry if this is a non-issue. If this is a non-issue is there a way to perform actions on an image when using DrawImage? Like can I tint the colour, scale it into a target rect, rotate it... etc without having to clone the original image, modify it, then dispose the clone?

DrawImage is a member of ImageSharp SetDrawingTransform. Is a member of ImageSharp.Drawing. That’s two separate libraries.

If you want to use the transform use ImageBrush.

This would have been better framed as a question in our Discussions channels.