scaling

Get Canvas coordinates after scaling up/down or dragging in android

北城以北 提交于 2019-11-26 15:36:04
问题 I'm developing an application in which I'm pasting images, doing drawing and painting on canvas. This app can also Scale up/down the canvas or drag it to different location. My problem is: I can't get the correct canvas coordinates after scaling or dragging the canvas. I want to draw finger paint after the canvas is scaled or dragged but unable to retrieve the right place where i've touched..:( Also I'm new bee. Here is the code. @Override public void onDraw(Canvas canvas) { super.onDraw

Disable DPI awareness for WPF application

邮差的信 提交于 2019-11-26 12:17:12
问题 Good day! I\'ve been working on a WPF app for some time now (as a learning experience and oh boy it was a learning experience) and it\'s finally ready for release. Release means installing it on my HTPC where it will be used to browse my movie collection. I designed it on my PC which runs 1920*1080 but at the normal DPI setting, while the HTPC/TV is running at the same resolution but a higher DPI setting for obvious reasons. The problem is my app goes bonkers on the HTPC, messing up pretty

Scaled Bitmap maintaining aspect ratio

随声附和 提交于 2019-11-26 12:10:29
问题 I would like to scale a Bitmap to a runtime dependant width and height, where the aspect ratio is maintained and the Bitmap fills the entire width and centers the image vertically, either cropping the excess or filling in the gap with 0 alpha pixels. I\'m currently redrawing the bitmap myself by creating a Bitmap of all 0 alpha pixels and drawing the image Bitmap on top of it, scaling to the exact specified width and maintaining the aspect ratio, however, it ends up losing/screwing up the

How to scale down a UIImage and make it crispy / sharp at the same time instead of blurry?

我只是一个虾纸丫 提交于 2019-11-26 12:02:13
I need to scale down an image, but in a sharp way. In Photoshop for example there are the image size reduction options "Bicubic Smoother" (blurry) and "Bicubic Sharper". Is this image downscaling algorithm open sourced or documented somewhere or does the SDK offer methods to do this? Merely using imageWithCGImage is not sufficient. It will scale, but the result will be blurry and suboptimal whether scaling up or down. If you want to get the aliasing right and get rid of the "jaggies" you need something like this: http://vocaro.com/trevor/blog/2009/10/12/resize-a-uiimage-the-right-way/ . My

Image scaling by CSS: is there a webkit alternative for -moz-crisp-edges?

怎甘沉沦 提交于 2019-11-26 11:57:55
问题 I have an image that is 100x100 in pixels. I want to show it twice the size, so 200x200 and I want to do it by CSS and (explicitly) not by the server. Since a few years, images get anti-aliased by all browsers instead of doing a by-pixel scale. Mozilla allows to specify the algorithm: image-rendering: -moz-crisp-edges; So does IE: -ms-interpolation-mode: nearest-neighbor; Any known webkit alternative? 回答1: Unfortunately, it looks like this feature is absent in WebKit. See this recent bug

Android Webview - Webpage should fit the device screen

被刻印的时光 ゝ 提交于 2019-11-26 11:31:25
I have tried the following to fit the webpage based on the device screen size. mWebview.setInitialScale(30); and then set the metadata viewport <meta name="viewport" content="width=320, initial-scale=1.0, maximum-scale=1.0, user-scalable=no" /> <meta name="viewport" content="width=device-width; initial-scale=1.0; maximum-scale=1.0; minimum-scale=1.0; user-scalable=0;"/> <meta name="viewport" content="width=device-width, target-densityDpi=medium-dpi"/> But nothing works, webpage is not fixed to the device screen size. Can anyone tell me how to get this? You have to calculate the scale that you

How can I make an svg scale with its parent container?

ぃ、小莉子 提交于 2019-11-26 11:29:35
I want to have an inline svg element's contents scale when size is non-native. Of course I could have it as a separate file and scale it like that. index.html: <img src="foo.svg" style="width: 100%;" /> foo.svg: <svg width="123" height="456"></svg> However, I want to add additional styles to the SVG thru CSS, so linking an external one is not an option. How do I make an inline SVG scale? To specify the coordinates within the SVG image independently of the scaled size of the image, use the viewBox attribute on the SVG element to define what the bounding box of the image is in the coordinate

Resizing images to fit the parent node

岁酱吖の 提交于 2019-11-26 11:24:29
问题 How do I get an image in an ImageView to automatically resize such that it always fits the parent node? Here is a small code example: @Override public void start(Stage stage) throws Exception { BorderPane pane = new BorderPane(); ImageView img = new ImageView(\"http://...\"); //didn\'t work for me: //img.fitWidthProperty().bind(new SimpleDoubleProperty(stage.getWidth())); pane.setCenter(img); Scene scene = new Scene(pane); stage.setScene(scene); stage.show(); } 回答1: @Override public void

How to scale down a range of numbers with a known min and max value

不想你离开。 提交于 2019-11-26 10:58:45
So I am trying to figure out how to take a range of numbers and scale the values down to fit a range. The reason for wanting to do this is that I am trying to draw ellipses in a java swing jpanel. I want the height and width of each ellipse to be in a range of say 1-30. I have methods that find the minimum and maximum values from my data set, but I won't have the min and max until runtime. Is there an easy way to do this? Let's say you want to scale a range [min,max] to [a,b] . You're looking for a (continuous) function that satisfies f(min) = a f(max) = b In your case, a would be 1 and b

Scale a series between two points

感情迁移 提交于 2019-11-26 10:31:46
How do I scale a series such that the first number in the series is 0 and last number is 1. I looked into 'approx', 'scale' but they do not achieve this objective. # generate series from exponential distr s = sort(rexp(100)) # scale/interpolate 's' such that it starts at 0 and ends at 1? # approx(s) # scale(s) It's straight-forward to create a small function to do this using basic arithmetic: s = sort(rexp(100)) range01 <- function(x){(x-min(x))/(max(x)-min(x))} range01(s) [1] 0.000000000 0.003338782 0.007572326 0.012192201 0.016055006 0.017161145 [7] 0.019949532 0.023839810 0.024421602 0