scaling

Drawing transform independent layout bounds in JavaFX

女生的网名这么多〃 提交于 2019-11-28 12:48:52
For a simple vector drawing app I am looking to implement a "Selection Box", that is a graphic representation of the layoutBounds of a Node. Example: example http://i61.tinypic.com/ou4p3t.png Thanks to jewelsea and his BoundsExample , I have a good understanding now on how to get the data for the box. The part I am struggling with is actually drawing the box on the scene, in a way that correctly respects the transformations on the nodes. Correctly in this case means the bounds logical size get scaled with a node, but the stroke of the selection box stays constant. Meaning a selection box

Android: Notify Scrollview that it's child's size has changed: how?

别等时光非礼了梦想. 提交于 2019-11-28 11:38:08
When I enlarge the size of the content of a scrollview, the scrollview takes a while to get to "know" this size change of it's child. How can I order the ScrollView to check it's child immediately? I have an ImageView in a LinearLayout in a ScrollView. In my ScaleListener.onScale, I change the size of my LinearLayout. I then try to order a scroll on the scrollview. In the ScaleListener.onScale: LinearLayout.LayoutParams params = (LinearLayout.LayoutParams) imageView.getLayoutParams(); params.width = (int) (startX * scaleFactor); params.height = (int) (startY * scaleFactor); imageView

Android image scaling to support multiple resolutions

非 Y 不嫁゛ 提交于 2019-11-28 10:37:29
I've coded my game for 320x480 and I figure that the easiest way to support multiple resolutions is to scale the end image. What are your thoughts on this? Would it be cpu efficient to do it this way? I have all my images placed in the mdpi folder, I'll have it drawn unscaled on the screen onto a buffer, then scale it to fit the screen. all the user inputs will be scaled as well. I have these 2 questions: -How do you draw a bitmap without android automatically scaling it -How do you scale a bitmap? I have stumbled upon the same problem a number of times in my projects and each time due to lack

Scale measurement data

醉酒当歌 提交于 2019-11-28 10:17:34
问题 I have some measured data, experiment.dat which goes like this: 1 2 2 3 Now I want to plot them via some command line plot "experiment.dat" using 1:2 title "experiment" with lines lw 3 Is there some way how to scale the different lines with some scaling factor like -1? 回答1: Yes, you can do any kind of calculations inside the using statement. To scale the y -value (the second column) with -1 , use plot "experiment.dat" using 1:(-1*$2) 来源: https://stackoverflow.com/questions/19583526/scale

Scaling to a fixed point in KineticJS

依然范特西╮ 提交于 2019-11-28 07:03:32
I'm having some problems with scaling a container to a fixed point. In my case I'm trying to scale (zoom) a stage to the mouse cursor. Here is a way to do with pure canvas: http://phrogz.net/tmp/canvas_zoom_to_cursor.html (as discussed at Zoom Canvas to Mouse Cursor ) I just can't get figure out how to apply the same logic while using the KineticJS API. Sample code: var position = this.stage.getUserPosition(); var scale = Math.max(this.stage.getScale().x + (0.05 * (scaleUp ? 1 : -1)), 0); this.stage.setScale(scale); // Adjust scale to position...? this.stage.draw(); juan.facorro After a lot of

PIL how to scale text size in relation to the size of the image

北战南征 提交于 2019-11-28 06:20:36
I'm trying to dynamically scale text to be placed on images of varying but known dimensions. The text will be applied as a watermark. Is there any way to scale the text in relation to the image dimensions? I don't require that the text take up the whole surface area, just to be visible enough so its easily identifiable and difficult to remove. I'm using Python Imaging Library version 1.1.7. on Linux. I would like to be able to set the ratio of the text size to the image dimensions, say like 1/10 the size or something. I have been looking at the font size attribute to change the size but I have

Stop Firefox DPI Scaling (when Windows setting is at 125%)

喜欢而已 提交于 2019-11-28 06:17:39
I'm currently making a webpage and testing it in chrome works fine, but in Firefox - it is zoomed in. This is because my DPI in Windows is set to 125%, and Firefox detects this, and adjusts every webpage accordingly. However, my webpage is not meant to be viewed at such a zoom level, the images aren't made to be displayed that big, and hence it looked blurred/pixelated. The general layout of the page is messed up too, because everything is so big. Now, this doesn't affect most people - as their DPI would be at 100% in Windows. However, I want it to be the same on all browsers. I've searched

How to “scale” a numpy array?

房东的猫 提交于 2019-11-28 05:22:45
I would like to scale an array of shape (h, w) by a factor of n, resulting in an array of shape (h*n, w*n), with the. Say that I have a 2x2 array: array([[1, 1], [0, 1]]) I would like to scale the array to become 4x4: array([[1, 1, 1, 1], [1, 1, 1, 1], [0, 0, 1, 1], [0, 0, 1, 1]]) That is, the value of each cell in the original array is copied into 4 corresponding cells in the resulting array. Assuming arbitrary array size and scaling factor, what's the most efficient way to do this? You should use the Kronecker product , numpy.kron : Computes the Kronecker product, a composite array made of

Android: high quality image resizing / scaling

别等时光非礼了梦想. 提交于 2019-11-28 04:42:36
I need to scale down images coming from a Network stream without losing quality. I am aware of this solution Strange out of memory issue while loading an image to a Bitmap object but it is too coarse - inSampleSize is an integer and does not allow finer control over the resulting dimensions. That is, I need to scale images to specific h/w dimensions (and keeping aspect ratio). I dont mind having a DIY bicubic/lancoz algorithm in my code but I cant find any examples that would work on Android as they all rely on Java2D (JavaSE). EDIT: Ive attached a quick source. The original is 720x402 HD

Making Sense of Android meta-viewport scaling: What am I missing?

你离开我真会死。 提交于 2019-11-28 03:08:31
I have been trying to determine how the viewport -- and the contents within -- are affected by the viewport meta tag used for drawing content with WebView or with the native browser. What I have run in to are some apparent inconsistencies. I created a small page (see below) with an image and some javascript for displaying the viewport size so I can visually see the scaling with the image as well as get the exact numbers. First, a some observations: None of the viewport width numbers are exactly what I expected, just close. When the numbers are close to the device pixel count, the drawing is