Not logged in.  Login/Logout/Register | List snippets | | Create snippet | Upload image | Upload data

26
LINES

< > BotCompany Repo | #1005675 // darkenScreenArea

JavaX fragment (include)

static float darkenScreenArea_factor = 0.5f;

static JWindow darkenScreenArea(Rectangle r, double seconds) {
  ret disposeWindowAfter(iround(seconds*1000),
    darkenScreenArea(r));
}

static JWindow darkenScreenArea(final Rectangle r) {
  ret (JWindow) swingAndWait(func {
    Rectangle r2 = maxWindowBounds().intersection(r);
    if (neq(r, r2)) warn("darkenScreenArea: Rectangle cropped");
    if (r2.isEmpty()) null;
    
    BufferedImage img = shootScreen2(r2);
    RescaleOp op = new RescaleOp(darkenScreenArea_factor, 0, null);
    img = op.filter(img, null);
    
    JLabel label = new JLabel(imageIcon(img));
    new JWindow w;
    w.setBounds(r2);
    w.add(label);
    w.setAlwaysOnTop(true);
    w.setVisible(true);
    ret w;
  });
}

Author comment

Began life as a copy of #1005626

download  show line numbers  debug dex  old transpilations   

Travelled to 14 computer(s): aoiabmzegqzx, bhatertpkbcr, cbybwowwnfue, cfunsshuasjs, ddnzoavkxhuk, gwrvuhgaqvyk, ishqpsrjomds, lpdgvwnxivlt, mqqgnosmbjvj, pyentgdyhuwx, pzhvpgtvlbxg, tslmcundralx, tvejysmllsmz, vouqrxazstgt

No comments. add comment

Snippet ID: #1005675
Snippet name: darkenScreenArea
Eternal ID of this version: #1005675/1
Text MD5: f8c7a6860a7dcc8d35e6da116fdb4bbe
Author: stefan
Category: javax / gui
Type: JavaX fragment (include)
Public (visible to everyone): Yes
Archived (hidden from active list): No
Created/modified: 2016-12-02 20:23:32
Source code size: 773 bytes / 26 lines
Pitched / IR pitched: No / No
Views / Downloads: 585 / 584
Referenced in: [show references]