scaling

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

[亡魂溺海] 提交于 2019-11-27 11:36:20
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(canvas); canvas.save(); //canvas.translate(mPosX, mPosY); canvas.scale(mScaleFactor, mScaleFactor, super

Android imageview not respecting maxWidth?

杀马特。学长 韩版系。学妹 提交于 2019-11-27 10:58:58
So, I have an imageview that should display an arbitrary image, a profile picture downloaded from the internet. I want this the ImageView to scale its image to fit inside the height of the parent container, and a set max width of 60dip. However, if the image is tall ratio-wise, and doesn't need the full 60dip of width, the ImageView's width should decrease so the view's background fits snugly around the image. I tried this, <ImageView android:id="@+id/menu_profile_picture" android:layout_width="wrap_content" android:maxWidth="60dip" android:layout_height="fill_parent" android:layout_marginLeft

Service Oriented Architecture - AMQP or HTTP

天涯浪子 提交于 2019-11-27 10:27:51
A little background. Very big monolithic Django application. All components use the same database. We need to separate services so we can independently upgrade some parts of the system without affecting the rest. We use RabbitMQ as a broker to Celery. Right now we have two options: HTTP Services using a REST interface. JSONRPC over AMQP to a event loop service My team is leaning towards HTTP because that's what they are familiar with but I think the advantages of using RPC over AMQP far outweigh it. AMQP provides us with the capabilities to easily add in load balancing, and high availability,

Why isn't my vector drawable scaling as expected?

痴心易碎 提交于 2019-11-27 10:23:15
I am attempting to use vector drawables in my Android app. From http://developer.android.com/training/material/drawables.html (emphasis mine): In Android 5.0 (API Level 21) and above, you can define vector drawables, which scale without losing definition. Using this drawable: <vector xmlns:android="http://schemas.android.com/apk/res/android" android:height="24dp" android:width="24dp" android:viewportWidth="24" android:viewportHeight="24"> <path android:fillColor="@color/colorPrimary" android:pathData="M14,20A2,2 0 0,1 12,22A2,2 0 0,1 10,20H14M12,2A1,1 0 0,1 13,3V4.08C15.84,4.56 18,7.03 18

Resizing images to fit the parent node

半腔热情 提交于 2019-11-27 09:01:01
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(); } @Override public void start(Stage stage) throws Exception { BorderPane pane = new BorderPane(); ImageView img = new ImageView("http://...

Pinterest架构之路-两年内从0到10亿月访问量

梦想与她 提交于 2019-11-27 07:37:58
前言 Pinterest已经可以驾驭每2.5个月流量就翻一倍的指数增长,他们实现了在2年内每月pv从0到10亿的结果。从2个创始人加1位工程师到超过40名工程师,从只有1台MySQL服务器到180台web服务器、240 API引擎、88个MYSQL DB和1个从库、110个Redis实例、200个Memcache实例。 令人吃惊的增长!他们是如何做到的呢?1年半年 Yashwanth Nelapati 和 Marty Weiner 演讲过这个富有戏剧性的架构进化故事,当初为求快,选择又多,他们也做了很多错误的选择(接下来是教训与经验总结)。 这是一个伟大的演讲,非常详情,但同时很接地气,架构的策略适合每个普通的你我,强烈推荐! 我从演讲中主要学到两条原则: 1.架构是当业务增长时可以方便的添加同样的东西就搞定。如果你认为扩展架构是只要扔更多的钱、加更多服务器(Boxs)的话,但如果你的架构能做到,那就是金钱。 2.当到达极限时所有的技术都会以自已特有的方式失败, 这就引出我们选型时的原则:成熟的、简单实用的、广为人知和喜欢的、社区支持友好的、性能向来表现优异的、尽可能不会出现失效且是免费的。根据这些原则,他们选择了:MySQL、 Solr 、 Memcache 和 Redis 。 Cassandra 和 MongoDB 丢掉了。 这两条原则是互相关联的

Chrome, Safari ignoring max-width in table

痞子三分冷 提交于 2019-11-27 07:21:33
I've got HTML code like this: <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-Type" content="text/html; charset=windows-1251" /> <title></title> </head> <body> <table style="width:100%;"> <tr> <td> <table style="width:100%; max-width:1000px; background:#000099;"> <tr> <td> 001 </td> </tr> </table> </td> </tr> </table> </body> </html> The problem is that Chrome and Safari are ignoring "max-width:1000px" My friend has found that we can prevent it

Drawing transform independent layout bounds in JavaFX

这一生的挚爱 提交于 2019-11-27 07:12:51
问题 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: 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

Scaled Bitmap maintaining aspect ratio

梦想的初衷 提交于 2019-11-27 06:52:37
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 pixel data. Here is how I'm doing it: Bitmap background = Bitmap.createBitmap((int)width, (int)height,

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

一世执手 提交于 2019-11-27 06:21:53
问题 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