java2d方法_Java SunGraphics2D.fillRect方法代碼示例

import sun.java2d.SunGraphics2D; //導入方法依賴的package包/類

/**

* Return a non-accelerated BufferedImage of the requested type with the

* indicated subimage of the original image located at 0,0 in the new image.

* If a bgColor is supplied, composite the original image over that color

* with a SrcOver operation, otherwise make a SrcNoEa copy.

*

* Returned BufferedImage is not accelerated for two reasons:

*

*

Types of the image and surface are predefined, because these types

* correspond to the TransformHelpers, which we know we have. And

* acceleration can change the type of the surface

*

Image will be used only once and acceleration caching wouldn't help

*

*/

private BufferedImage makeBufferedImage(Image img, Color bgColor, int type,

int sx1, int sy1, int sx2, int sy2)

{

final int width = sx2 - sx1;

final int height = sy2 - sy1;

final BufferedImage bimg = new BufferedImage(width, height, type);

final SunGraphics2D g2d = (SunGraphics2D) bimg.createGraphics();

g2d.setComposite(AlphaComposite.Src);

bimg.setAccelerationPriority(0);

if (bgColor != null) {

g2d.setColor(bgColor);

g2d.fillRect(0, 0, width, height);

g2d.setComposite(AlphaComposite.SrcOver);

}

g2d.copyImage(img, 0, 0, sx1, sy1, width, height, null, null);

g2d.dispose();

return bimg;

}

本文來自互聯網用戶投稿,該文觀點僅代表作者本人,不代表本站立場。本站僅提供信息存儲空間服務,不擁有所有權,不承擔相關法律責任。
如若轉載,請注明出處:http://www.pswp.cn/news/392403.shtml
繁體地址,請注明出處:http://hk.pswp.cn/news/392403.shtml
英文地址,請注明出處:http://en.pswp.cn/news/392403.shtml

如若內容造成侵權/違法違規/事實不符,請聯系多彩編程網進行投訴反饋email:809451989@qq.com,一經查實,立即刪除!

相關文章

js建立excel表格_建立Excel足球聯賽表格-傳統vs動態數組方法

js建立excel表格介紹 (Introduction) I am going to show you the different ways you can build a football league table in Excel. Some of the methods are old school but others utilise Excel’s new capabilities.我將向您展示在Excel中建立足球聯賽表格的不同方法。 其…

postman+newman生成html報告

作為測試菜鳥,在學習postmannewman的使用過程中真的是頗費周折......沒辦法技術太菜,只能多學習. postman的下載安裝不多言說,下載地址:https://www.getpostman.com/downloads/ newman的安裝過程: 1.首先需要安裝node.js,可以去官網下載,地址:https://nodejs.org/en/#download …

java jdk1.9新特性_JDK1.9-新特性

1. Java平臺級模塊系統該特性使Java9最大的一個特性,Java提供該功能的主要的動機在于,減少內存的開銷,JVM啟動的時候,至少會有30~60MB的內存加載,主要原因是JVM需要加載rt.jar,不管其中的類是否被classload…

如何在10分鐘內讓Redux發揮作用

Hi everyone ??大家好?? For a while now I’ve been hearing my friends and colleagues complaining about how hard it was to get into Redux.一段時間以來,我一直在聽我的朋友和同事抱怨進入Redux有多困難。 I run a freeCodeCamp Study Group in the So…

兩個鏈接合并_如何找到兩個鏈接列表的合并點

兩個鏈接合并了解問題 (Understand the Problem) We are given two singly linked lists and we have to find the point at which they merge.我們給了兩個單鏈表,我們必須找到它們合并的點。 [SLL 1] 1--->3--->5 \ …

安裝veket到移動硬盤NTFS分區

如果你已經看過《手動安裝veket到硬盤》和《簡單的將veket安裝到U盤的方法》兩篇文章并且安裝成功的話,說明不適用本文的安裝環境,就不用往下看了。 《手動安裝veket到硬盤》一文采用grub4dos來引導硬盤上的veket,主要是用來在本機已安裝Wind…

簡書使用小技巧

1、不同字體  在 設置->基礎設置->富文本 模式下可以實現 2、添加圖片,讓文章更生動 3、添加代碼框 !注意:設置為Markdown模式后,只對新創建的文章起作用。轉載于:https://www.cnblogs.com/HMJ-29/p/7049540.html

掩碼 項目編碼_每天進行20天的編碼項目

掩碼 項目編碼by Angela He通過何安佳 每天進行20天的編碼項目 (A coding project a day for 20 days) 我如何在20天內自學Web開發 (How I taught myself web development in 20 days) It was the first day of winter break for Stanford students. Back at home, I opened a…

java循環一年月份天數和_javawhile循環編寫輸入某年某月某日,判斷這一天是這一年的第幾…...

該樓層疑似違規已被系統折疊 隱藏此樓查看此樓public class ZuoYe9 {public static void main(String[] args) {int days0; //存儲變量這一年的第幾天//1.輸入年,月,日Scanner inputnew Scanner(System.in);System.out.println("請輸入年份&#xf…

leetcode 605. 種花問題(貪心算法)

假設你有一個很長的花壇,一部分地塊種植了花,另一部分卻沒有。可是,花卉不能種植在相鄰的地塊上,它們會爭奪水源,兩者都會死去。 給定一個花壇(表示為一個數組包含0和1,其中0表示沒種植花&…

工程師的成熟模型_數據工程師的成熟度

工程師的成熟模型數據科學與機器學習 (DATA SCIENCE AND MACHINE LEARNING) What does a data engineer do?數據工程師做什么? Let’s start with three big wars that we need to understand before understanding what a data engineer does.讓我們從理解數據工…

杭電2064

此題是一道簡單的遞歸 此題是一道遞歸運算題,這題又是一道漢諾塔問題!!!只要了解其規律,呵呵,你就可以很快AC了!! 這是一般的漢諾塔問題的解題方法照片!!&…

/ ./ ../ 的區別

/ 根目錄 (絕對路徑) ./ 當前目錄 ../父級目錄 (相對路徑) ./home是當前目錄下的一個叫home的目錄/home是絕對路徑的/home就是根下的home目錄轉載于:https://www.cnblogs.com/sjd1118/p/7055475.html

java設置表格列不可修改_Java DefaultTableModel使單元格不可編輯JTable

參見英文答案 >How to make a JTable non-editable 7個我有一個JAVA項目,并希望使用DefaultTableModel使我的JTable不可編輯.我知道一個解決方法,稱為:JTable table new JTable(...){public boolean isCellEditable(int row…

阻塞隊列實現

? 作者:小胡_不糊涂 🌱 作者主頁:小胡_不糊涂的個人主頁 📀 收錄專欄:JavaEE 💖 持續更文,關注博主少走彎路,謝謝大家支持 💖 阻塞隊列 1. 什么是阻塞隊列2. 標準庫中的…

graphql入門_GraphQL入門指南

graphql入門by Leonardo Maldonado萊昂納多馬爾多納多(Leonardo Maldonado) GraphQL入門指南 (A Beginner’s Guide to GraphQL) One of the most commonly discussed terms today is the API. A lot of people don’t know exactly what an API is. Basically, API stands fo…

leetcode 239. 滑動窗口最大值(單調隊列)

給你一個整數數組 nums,有一個大小為 k 的滑動窗口從數組的最左側移動到數組的最右側。你只可以看到在滑動窗口內的 k 個數字。滑動窗口每次只向右移動一位。 返回滑動窗口中的最大值。 示例 1: 輸入:nums [1,3,-1,-3,5,3,6,7], k 3 輸出…

scrape創建_確實在2分鐘內對Scrape公司進行了評論和評分

scrape創建網頁搜羅,數據科學 (Web Scraping, Data Science) In this tutorial, I will show you how to perform web scraping using Anaconda Jupyter notebook and the BeautifulSoup library.在本教程中,我將向您展示如何使用Anaconda Jupyter筆記本…

ArcGIS自定義高程

沒寫呢。 轉載于:https://www.cnblogs.com/jiangyuanjia/p/11220183.html

Java基礎——String類(一)

一、String 類代表字符串 Java 程序中的所有字符串字面值(如 "abc" )都作為此類的實例實現。 字符串是常量;它們的值在創建之后不能更改。字符串緩沖區支持可變的字符串。因為 String 對象是不可變的,所以可以共享。例如…