Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

error demo:Sample-DrawWaterMarkOnImage-LongText #348

Open
AryaOline opened this issue Dec 31, 2024 · 1 comment
Open

error demo:Sample-DrawWaterMarkOnImage-LongText #348

AryaOline opened this issue Dec 31, 2024 · 1 comment

Comments

@AryaOline
Copy link

var brush = new RecolorBrush(color, color, 1f);
// Use the optimal font size found
Font scaledFont = new(font, minFontSize);

// Create text options with adjusted font
RichTextOptions textOptions = new(scaledFont)
{
Origin = new Vector2(padding, imageSize.Height * .5f),
HorizontalAlignment = HorizontalAlignment.Left,
VerticalAlignment = VerticalAlignment.Center,
WrappingLength = targetWidth
};

//I Want Rotate 30°
DrawingOptions drawingOptions = new DrawingOptions
{
Transform = Matrix3x2Extensions.CreateRotationDegrees(30, new PointF(targetWidth / 2, targetHeight / 2))
};
// Draw the text on the image
return processingContext.DrawText(drawingOptions, textOptions, text, brush, null);

error:System.ArgumentOutOfRangeException:“Specified argument was out of the range of valid values. Arg_ParamName_Name”

企业微信截图_17356308615728

@AryaOline
Copy link
Author

I want to rotate 30 degrees at the center of the picture.
The problem now found is that the watermark content is larger than the width of the image will report an error.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant