ImageLoader.toImage(Icon, ScaleContext) usage in Plugins
已回答
Hi, I need to scale an svg icon, and found the perfect method in ImageLoader for that:
ImageLoader.toImage(icon: javax.swing.Icon, scaleContext: com.intellij.ui.scale.ScaleContext)
It works fine, and I'd like to use it for my plugin. But, to create the ScaleContext you need to instantiate Scale class, which is marked Internal. The code looks something like this:
Scale sc = new Scale(0.5, ScaleType.USR_SCALE);
ScaleContext sct = ScaleContext.create(sc);
Image img = IconLoader.toImage(sessionIcon, sct);
So, my question is: Can I use the Imageload.toImage without the need to use internal code? Or Is there another way to scale an svg icon in the Intellij framework?
Thx
请先登录再写评论。
See
com.intellij.util.ImageLoader#scaleImage()variants, orcom.intellij.util.IconUtil#scale()