标签: scaling

在 JavaFX 中将 ImageView 缩放到特定高度

我的菜单中有一个Imageview显示所选地图的预览。

但这些地图的大小可能会有所不同,在我的菜单中我有足够的水平空间,但垂直方向上我有限制。所以,我想要的是以某种方式缩放ImageView它的高度,使其变为 40 像素(我这里也有一个问题),并且它的宽度以不变形的方式相应变化。

另外,如果有一种方法可以让高度自动适应其行的高度,我将非常感激。(其父级)这是我的代码:

Label mapChooserLabel = new Label("This is the map you will play on, click to change");
try {
    mapPreview = new ImageView(
        new Image(getClass().getResource("/files/images/maps/" + chosenMapName + ".gif").toURI().toURL().toString())
    );
    mapPreview.setFitHeight(40);
    mapPreview.setOnMouseClicked(event -> System.out.println("towerChooserPopup should open now!"));
} catch (MalformedURLException | URISyntaxException e) {
    e.printStackTrace();
}
HBox mapChooserWrapper = new HBox(mapChooserLabel, mapPreview);
mapChooserWrapper.setId("lineWrapper");
Run Code Online (Sandbox Code Playgroud)

这是我的CSS:

#lineWrapper{
    -fx-alignment: center;
    -fx-spacing: 2px;
}
Run Code Online (Sandbox Code Playgroud)

java scaling javafx imageview

2
推荐指数
1
解决办法
7546
查看次数

如何缩放轮播中的图像?

我已经构建了一个轮播,如果图像的宽度大于高度,我希望图像在一维宽度上最大化屏幕,反之亦然。

最大高度应该为页眉/导航栏和页脚留出空间,并且我希望它们按比例缩放。目前,它们正在缩放到宽度,但它们在垂直方向上极大地溢出了视口。

HTML:

<div id="frontimages" class="carousel slide" data-ride="carousel">

    <ul class="carousel-indicators">
        <li data-target="#frontimages", data-slide-to="0" class="active"></li>
    </ul>

    <div class="carousel-inner">
        <div class="carousel-item active">
            <img class="d-block img-fluid" src="url" alt="title">
        </div>
    </div>

    <a class="carousel-control-prev" href="#frontimages" data-slide="prev">
        <span class="carousel-control-prev-icon"></span>
    </a>

    <a class="carousel-control-next" href="#frontimages" data-slide="next">
        <span class="carousel-control-next-icon"></span>
    </a>

</div>
Run Code Online (Sandbox Code Playgroud)

CSS:

.carousel-inner img {
    width: 100%;
    height: 100%;
}
Run Code Online (Sandbox Code Playgroud)

css scaling carousel twitter-bootstrap

2
推荐指数
1
解决办法
9974
查看次数

Java - 获取 Windows 缩放百分比

我需要弄清楚缩放比例设置为多少。Windows 缩放中的这个答案提供了 c/c++/c# 中的代码,但我需要 Java 中的代码,并且更愿意不必执行 JNI。有没有办法使用 JNA 来获取该信息?

java scaling jna display

2
推荐指数
1
解决办法
1536
查看次数

Windows 10 上的模糊 Dev C++

90% 的应用程序显示正确清晰,就像我的超高清笔记本电脑屏幕上应有的那样。我的缩放比例是 150%(也是默认值)(由于 15.6 英寸笔记本电脑的超高清屏幕,100% 对我的眼睛来说效率太低。)

但 dev c++ 和一些旧软件看起来很模糊。

模糊开发 C++

Windows 10 设置中有一个名为“高级缩放”的修复程序已启用。有什么方法可以修复模糊的 dev c++ 或者您是否推荐更好的带有编译器的最新 ide for c++?

Windows 10 高级缩放设置

(带有 mingw 的 eclipse-cpp 很慢,clion 很棒,但使用 Visual C++ 编译器(我不知道编译器是否有任何设置,Microsoft Visual C++ 很好,但没有显示一些错误,实际上说“没有错误”而不是编译)有一段时间)

ide scaling dev-c++ visual-c++ windows-10

2
推荐指数
1
解决办法
4704
查看次数

列表对象没有属性列

我正在尝试对简单数据集执行最小-最大缩放

data2 = [10, 20, 35, 70, 100]
Run Code Online (Sandbox Code Playgroud)

以下代码给我一个错误

AttributeError:“列表”对象没有属性“列”

def min_max_scaling(df):
df_norm = df.copy()
for col in df_norm.columns:
    df_norm[col] = (df_norm[col] - df_norm[col].min()) / (df_norm[col].max() - df_norm[col].min())
return df_norm

df_normalized = min_max_scaling(data3)

df_normalized
Run Code Online (Sandbox Code Playgroud)

python scaling pandas

2
推荐指数
1
解决办法
2万
查看次数

如何使用不平衡的分类数据缩放seaborn联合图的边际kdeplot

如何缩放seaborn联合图的边际kdeplot?

假设我们有 1000 个类型“a”的数据、100 个类型“b”的数据和“100”个类型“c”的数据。

在这种情况下,边际 kdeplot 的尺度看起来并不相同,因为分类数据的大小完全不同。

我如何使这些相同?

我制作了一个玩具脚本,如下所示:

import seaborn as sns
import numpy as np
import pandas as pd
import matplotlib.pylab as plt

ax, ay = 1 * np.random.randn(1000) + 2, 1 * np.random.randn(1000) + 2
bx, by = 1 * np.random.randn(100) + 3, 1 * np.random.randn(100) + 3
cx, cy = 1 * np.random.randn(100) + 4, 1 * np.random.randn(100) + 4

a = [{'x': x, 'y': y, 'kind': 'a'} for x, y in zip(ax, ay)]
b …
Run Code Online (Sandbox Code Playgroud)

scaling matplotlib kernel-density seaborn jointplot

2
推荐指数
1
解决办法
1108
查看次数

如何缩放图像边缘以填充android中的背景?

我有一个带有背景渐变的徽标图像.但是,这个图像没有填满被黑色条纹包围的屏幕,使它看起来很糟糕.无论如何在android中我可以指定缩放图像的边缘(即每侧的最后一个像素)并将颜色拉伸直到它填满屏幕?

scaling android android-imageview

1
推荐指数
1
解决办法
215
查看次数

用cocos2d缩放渲染图像会破坏图像质量

使用Cocos2d(v 1.01),如果我按原样显示精灵,我的质量很好,但如果我使用CCRenderTexture,图像质量很差.仅当我放大图像时才会发生这种情况.

参见随附的屏幕截图,原始图像在左侧. 在此输入图像描述 这是我的代码:

CCScene* pScene = CCDirector::sharedDirector()->getRunningScene();

CCSprite* origSprite = CCSprite::spriteWithFile("jigsaw/11.png");
origSprite->setPosition(CCPoint(250,250));
origSprite->setScale(1.3);
pScene->addChild(origSprite, 500);

CCSprite* imageSprite = CCSprite::spriteWithFile("jigsaw/11.png");
CCSize imageSize = imageSprite->boundingBox().size;
CCRenderTexture *rt = CCRenderTexture::renderTextureWithWidthAndHeight(imageSize.width, imageSize.height);
imageSprite->setPosition(ccp(imageSize.width/2, imageSize.height/2));
rt->begin();
imageSprite->visit();
rt->end();
CCSprite *newSprite = CCSprite::spriteWithTexture(rt->getSprite()->getTexture());
delete rt;
newSprite->setFlipY(true);
newSprite->setPosition(CCPoint(750,750));
newSprite->setScale(1.3);
pScene->addChild(newSprite, 500);
Run Code Online (Sandbox Code Playgroud)

scaling image opengl-es cocos2d-iphone

1
推荐指数
1
解决办法
1153
查看次数

ImageView具有过多的垂直填充

我注意到,当我在我的图像中显示ImageView自动按比例缩小以适应窗口时,即使缩放的ImageView图像占用不到可见屏幕的1/4 ,它们也会在图像的上方和下方添加至少50%的填充.当显示适合而不调整大小的图像时,不会发生这种情况.

为什么会发生这种情况,我该怎么做才能解决这个问题?

如果它的事项,顶层布局是一个LinearLayout含有一个ScrollView,其中包括以下ImageView:

<ImageView
    android:id="@+id/image"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    />
Run Code Online (Sandbox Code Playgroud)

为什么会这样?

scaling android padding android-layout android-imageview

1
推荐指数
1
解决办法
668
查看次数

geog_ribbon用于ggplot2中的多个密度

我有一个数据框(aa),其每日值为7个变量,我想使用R中的ggplot在一个图中创建所有变量的密度图。

date                1       2      3       4         5        6      7
1/1/1951 1:00   576.568 308.596 501.752 359.868 772.522 475.146 307.991
1/2/1951 1:00   722.986 461.295 652.33  525.561 1806.75 724.128 460.697
1/3/1951 1:00   859.542 582.949 910.248 642.133 2388.73 959.896 579.396
1/4/1951 1:00   1136.49 704.732 1047.04 1304.73 2619.04 1545.61 690.574
1/5/1951 1:00   1747.84 769.764 1099.24 1828.5  2695.6  2052.11 790.35
1/6/1951 1:00   1842.66 811.765 1130.44 2031.97 2747.14 2532.89 860.417
1/7/1951 1:00   2734.15 895.825 1158.42 2145.6  2772.58 2826.31 944.181
1/8/1951 1:00   2870.02 996.17  1159.5  2123.04 2773.86 3385.17 …
Run Code Online (Sandbox Code Playgroud)

scaling r area ggplot2 density-plot

1
推荐指数
1
解决办法
474
查看次数