2

Photoshop で透明なぼかし効果を持つウィジェットのボタン/長方形を作成して、長方形を通して背景画像を表示する方法はありますが、ぼやけていますか?

この脱獄tweekの例のように:ここに画像の説明を入力

透明にする不透明度で遊んでみましたが、このぼやけた外観を実現する方法がわかりません。

4

3 に答える 3

1

これは、QImageの高速ブラー用に切り取られたコードです。背景を一度ぼかして、背景として設定するだけです

QImage MainWindow::blurred(const QImage& image, const QRect& rect, int radius, bool          alphaOnly)
{
int tab[] = { 14, 10, 8, 6, 5, 5, 4, 3, 3, 3, 3, 2, 2, 2, 2, 2, 2 };
int alpha = (radius < 1) ? 16 : (radius > 17) ? 1 : tab[radius-1];

QImage result = image.convertToFormat(QImage::Format_ARGB32_Premultiplied);
int r1 = rect.top();
int r2 = rect.bottom();
int c1 = rect.left();
int c2 = rect.right();

int bpl = result.bytesPerLine();
int rgba[4];
unsigned char* p;

int i1 = 0;
int i2 = 3;

if (alphaOnly)
i1 = i2 = (QSysInfo::ByteOrder == QSysInfo::BigEndian ? 0 : 3);

for (int col = c1; col <= c2; col++) {
    p = result.scanLine(r1) + col * 4;
    for (int i = i1; i <= i2; i++)
        rgba[i] = p[i] << 4;

    p += bpl;
    for (int j = r1; j < r2; j++, p += bpl)
        for (int i = i1; i <= i2; i++)
            p[i] = (rgba[i] += ((p[i] << 4) - rgba[i]) * alpha / 16) >> 4;
}

for (int row = r1; row <= r2; row++) {
    p = result.scanLine(row) + c1 * 4;
    for (int i = i1; i <= i2; i++)
        rgba[i] = p[i] << 4;

    p += 4;
    for (int j = c1; j < c2; j++, p += 4)
        for (int i = i1; i <= i2; i++)
            p[i] = (rgba[i] += ((p[i] << 4) - rgba[i]) * alpha / 16) >> 4;
}

for (int col = c1; col <= c2; col++) {
    p = result.scanLine(r2) + col * 4;
    for (int i = i1; i <= i2; i++)
        rgba[i] = p[i] << 4;

    p -= bpl;
for (int j = r1; j < r2; j++, p -= bpl)
    for (int i = i1; i <= i2; i++)
        p[i] = (rgba[i] += ((p[i] << 4) - rgba[i]) * alpha / 16) >> 4;
}

for (int row = r1; row <= r2; row++) {
    p = result.scanLine(row) + c2 * 4;
    for (int i = i1; i <= i2; i++)
        rgba[i] = p[i] << 4;

    p -= 4;
    for (int j = c1; j < c2; j++, p -= 4)
        for (int i = i1; i <= i2; i++)
            p[i] = (rgba[i] += ((p[i] << 4) - rgba[i]) * alpha / 16) >> 4;
}

return result;
}
于 2013-04-29T08:59:42.607 に答える
1

写真でレイヤーを複製し、ぼかしたくない部分を削除します(またはマスクで非表示にします)。ぼかし効果は、ぼかしフィルターを使用して実現されます。その写真はレンズのぼやけのように見えます。[フィルター] > [ぼかし] > [レンズぼかし] に移動します。ダイアログ ボックスのスライダー オプションで、[半径] スライダーを右 (約 24) に動かします。次に、不透明度を約 15% に設定した黒い四角形で上に新しいレイヤーを適用します。黒い四角形とぼやけた写真の複製が同じサイズで、レイヤーが一緒にロックされている限り、そのぼやけた効果が得られます。ボタンが背景をぼかしているように見えます。

于 2013-04-29T13:38:11.507 に答える
0

を使用して何かを引き出すことができると思いますQGraphicsEffect

基本的QGraphicsOpacityEffectに、最上位のウィジェットに適用QGraphicsBlurEffectし、下位のウィジェットに適用できます。

ドキュメントを読んで、明確に理解してください。

于 2013-04-29T04:20:01.807 に答える