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.mzph.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 对象是不可变的,所以可以共享。例如…