yangys
2024-03-28 25475f31cd0d52ff328bbea9e80f15647dedd80b
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
package com.qianwen.core.tool.support;
 
/* loaded from: blade-core-tool-9.3.0.0-SNAPSHOT.jar:org/springblade/core/tool/support/ImagePosition.class */
public class ImagePosition {
    public static final int TOP = 32;
    public static final int MIDDLE = 16;
    public static final int BOTTOM = 8;
    public static final int LEFT = 4;
    public static final int CENTER = 2;
    public static final int RIGHT = 1;
    private static final int PADDING_HORI = 6;
    private static final int PADDING_VERT = 6;
    private int boxPosX;
    private int boxPosY;
 
    public ImagePosition(int width, int height, int boxWidth, int boxHeight, int style) {
        switch (style & 7) {
            case 1:
                this.boxPosX = (width - boxWidth) - 6;
                break;
            case CENTER /* 2 */:
            case 3:
            default:
                this.boxPosX = (width - boxWidth) / 2;
                break;
            case LEFT /* 4 */:
                this.boxPosX = 6;
                break;
        }
        switch ((style >> 3) << 3) {
            case BOTTOM /* 8 */:
            default:
                this.boxPosY = (height - boxHeight) - 6;
                return;
            case MIDDLE /* 16 */:
                this.boxPosY = (height - boxHeight) / 2;
                return;
            case 32:
                this.boxPosY = 6;
                return;
        }
    }
 
    public int getX() {
        return getX(0);
    }
 
    public int getX(int x) {
        return this.boxPosX + x;
    }
 
    public int getY() {
        return getY(0);
    }
 
    public int getY(int y) {
        return this.boxPosY + y;
    }
}