scale

How to get the stage dimensions with StageScaleMode.SHOW_ALL?

杀马特。学长 韩版系。学妹 提交于 2019-12-05 01:06:43
问题 If you set the stage.scaleMode to StageScaleMode.SHOW_ALL, your swf may be scaled up or down, and may be padded on the top/bottom or left/right. However, stage.width + height always return the width and height as defined by your swf, and stage.scaleX + Y always return 1. As I understand it, resize events are not thrown. So how do I get the actual scale and dimensions? I want them for two problems: I want to fill that padding on the top/bottom or left/right with something only if the user can

Scale images with PIL preserving transparency and color?

冷暖自知 提交于 2019-12-04 20:14:26
问题 Say you want to scale a transparent image but do not yet know the color(s) of the background you will composite it onto later. Unfortunately PIL seems to incorporate the color values of fully transparent pixels leading to bad results. Is there a way to tell PIL-resize to ignore fully transparent pixels? import PIL.Image filename = "trans.png" # http://qrc-designer.com/stuff/trans.png size = (25,25) im = PIL.Image.open(filename) print im.mode # RGBA im = im.resize(size, PIL.Image.LINEAR) # the

ggplot2 Color Scale Over Affected by Outliers

萝らか妹 提交于 2019-12-04 17:48:12
问题 I'm having difficulty with a few outliers making the color scale useless. My data has a Length variable that is based in a range, but will usually have a few much larger values. The below example data has 95 values between 500 and 1500, and 5 values over 50,000. The resulting color legends tend to use 10k, 20k, ... 70k for the color changes when I want to see color changes between 500 and 1500. Really, anything over around 1300 should be the same solid color (probably median +/- mad), but I

matplotlib: Setting both major and minor ticks forces same x and y scale

一个人想着一个人 提交于 2019-12-04 17:19:54
This question is related to the earlier question I asked " matplotlib: Change grid interval and specify tick labels " but now I want to change the scale for x and y axes. When I set the range for x and y axes and then specify the intervals for major and minor ticks, it forces the x and y axes to be the same. This is my code. import matplotlib.pyplot as plt import numpy as np fig = plt.figure() ax = fig.add_subplot(111) for key, value in sorted(data.items()): x = value[0][2] y = value[0][3] count = value[0][4] ax.annotate(count, xy = (x, y), size = 3) plt.suptitle('Number of counts', fontsize =

How to do Joint tracking in Kinect with a scaled Image

放肆的年华 提交于 2019-12-04 17:19:45
I trying to do some Joint Tracking with kinect (just put a ellipse inside my right hand) everything works fine for a default 640x480 Image, i based myself in this channel9 video. My code, updated to use the new CoordinateMapper classe is here ... CoordinateMapper cm = new CoordinateMapper(this.KinectSensorManager.KinectSensor); ColorImagePoint handColorPoint = cm.MapSkeletonPointToColorPoint(atualSkeleton.Joints[JointType.HandRight].Position, ColorImageFormat.RgbResolution640x480Fps30); Canvas.SetLeft(elipseHead, (handColorPoint.X) - (elipseHead.Width / 2)); // center of the ellipse in center

How to animate scale of TextBlock in UWP

我与影子孤独终老i 提交于 2019-12-04 17:10:06
When I use Storyboard to zoom in TextBlock it pixelates while zooming and rerenders only on complete. <DoubleAnimationUsingKeyFrames Storyboard.TargetName="TextBlock" Storyboard.TargetProperty="(UIElement.RenderTransform).(CompositeTransform.ScaleY)"> <EasingDoubleKeyFrame KeyTime="0:0:0.5" Value="1.5"/> Is there a way the TextBlock is rerendered each frame? I found a solution though it's not about TextBlock anymore but for me it worked: private void CreateText(string text) { _compositor = ElementCompositionPreview.GetElementVisual(this).Compositor; CreateDevice(); _spriteTextVisual =

ImageView Center in position with ScaleType Matrix

假如想象 提交于 2019-12-04 17:03:50
I am using Zoom effect with ImageView so I need to use scaletype=matrix. Now, I want to set Center position to ImageView but I am not able to set it. Please help me regarding this. layout.xml : <?xml version="1.0" encoding="utf-8"?> <RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="match_parent" android:layout_height="match_parent" > <ImageView android:id="@+id/imgImage" android:layout_width="fill_parent" android:layout_height="fill_parent" android:contentDescription="@string/imgdesc" android:scaleType="matrix" android:src="@drawable/ic_answer" />

Rails: Cannot add :precision or :scale options with change_column in a migration?

柔情痞子 提交于 2019-12-04 16:56:10
问题 This seems to have been asked before: rails decimal precision and scale But when running a change_column migration for :precision or :scale they don't actually affect the schema or database, but db:migrate runs without errors. My migration file looks like this: class ChangePrecisionAndScaleOfPaybackPeriodInTags < ActiveRecord::Migration def self.up change_column :tags, :payback_period, :decimal, { :scale => 3, :precision => 10 } end def self.down change_column :tags, :payback_period, :decimal

Possible Combination of Knapsack problem and?

瘦欲@ 提交于 2019-12-04 16:19:44
Alright quick overview I have looked into the knapsack problem http://en.wikipedia.org/wiki/Knapsack_problem and i know it is what i need for my project, but the complicated part of my project would be that i need multiple sacks inside a main sack. The large knapsack that holds all the "bags" can only carry x amount of "bags" (lets say 9 for sake of example). Each bag has different values; Weight Cost Size Capacity and so on, all of those values are integer numbers. Lets assume from 0-100. The inner bag will also be assigned a type, and there can only be one of that type within the outer bag,

Android scale animation flickering

时光毁灭记忆、已成空白 提交于 2019-12-04 14:57:43
I have frame layout in my app. In frame I have ImageView and TextView. I need to frame layout bounce all the time. I've made this animation in xml: <scale android:duration="100" android:fromXScale="0.1" android:fromYScale="0.1" android:pivotX="50%" android:pivotY="50%" android:toXScale="1.0" android:toYScale="1.0" /> <scale xmlns:android="http://schemas.android.com/apk/res/android" android:duration="1200" android:fillAfter="false" android:fromXScale="1.0" android:fromYScale="1.0" android:interpolator="@android:anim/accelerate_decelerate_interpolator" android:pivotX="50%" android:pivotY="50%"