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

Closed
AryaOline opened this issue Dec 31, 2024 · 3 comments · Fixed by #350
Closed

error demo:Sample-DrawWaterMarkOnImage-LongText #348

AryaOline opened this issue Dec 31, 2024 · 3 comments · Fixed by #350
Labels
bug Something isn't working

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.

@JimBobSquarePants
Copy link
Member

@AryaOline I'm not sure what you expect anyone to do with this.

You haven't provided enough information to replicate the issue, your code relies on dynamic variables.

Please update the code sample to do so and additionally provide a stack trace and library version numbers. Also please ensure your code is formatted correctly and enclosed in a code block.

@JimBobSquarePants
Copy link
Member

OK... I've figured out. Please provide more information next time.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants