Skip to content

This issue was moved to a discussion.

You can continue the conversation there. Go to discussion →

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

WpfDrawingSettings PixelWidth PixelHeight Have no effect #256

Closed
dongzhaosheng73 opened this issue Jul 4, 2023 · 3 comments
Closed

WpfDrawingSettings PixelWidth PixelHeight Have no effect #256

dongzhaosheng73 opened this issue Jul 4, 2023 · 3 comments

Comments

@dongzhaosheng73
Copy link

dongzhaosheng73 commented Jul 4, 2023

var setting = new WpfDrawingSettings() { IncludeRuntime = true, TextAsGeometry = true };
setting.PixelWidth = 100;
setting.PixelHeight = 100;
using (FileSvgReader converter = new FileSvgReader(setting))
{
	var draw = new DrawingImage(converter.Read(net.Stream));
	draw.Freeze();
	return draw;
}            

The DrawingImage generated is not width = 100 height = 100. The DrawingImage is still the original size of the vector image. Is there any problem with my setting?

@paulushub
Copy link
Contributor

Currently, we do not transform the DrawingGroup, so this feature only works when creating static images.
You can try rescaling the output of the converter.Read(net.Stream).

@dongzhaosheng73
Copy link
Author

dongzhaosheng73 commented Jul 5, 2023

Currently, we do not transform the DrawingGroup, so this feature only works when creating static images.
You can try rescaling the output of the converter.Read(net.Stream).

I want to make sure if changing the size of DrawingImage can reduce the memory usage?
I tried to change the DrawingGroup directly by modifying the Transform, and the size of the DrawingImage did change, but it didn't seem to decay at all when it was filled into the control. Memory is not reduced.

 var setting = new WpfDrawingSettings() { IncludeRuntime = true, TextAsGeometry = true,EnsureViewboxSize = false};
          
using (FileSvgReader converter = new FileSvgReader(setting))
{
	var drawGroup = converter.Read(net.Stream);
	drawGroup.Transform = new ScaleTransform(0.1, 0.1);
	var draw = new DrawingImage(drawGroup);
	draw.Freeze();
	return draw;
}

@paulushub
Copy link
Contributor

I want to make sure if changing the size of DrawingImage can reduce the memory usage?

I am not sure it will. DrawingImage is basically still a vector drawing implementation of the ImageSource. It is not the actual rendered image, just the source of the image and applying a transformation only add a projection definition.

@ElinamLLC ElinamLLC locked and limited conversation to collaborators Jul 16, 2023
@paulushub paulushub converted this issue into discussion #258 Jul 16, 2023

This issue was moved to a discussion.

You can continue the conversation there. Go to discussion →

Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants