亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频

? 歡迎來到蟲蟲下載站! | ?? 資源下載 ?? 資源專輯 ?? 關于我們
? 蟲蟲下載站

?? ch5.htm

?? 有關于游戲開發的教程我閱讀后感覺不錯所以就拿出來與大家共享。
?? HTM
?? 第 1 頁 / 共 4 頁
字號:
<HTML>

<HEAD>
   <TITLE>Chapter 5 -- Java Graphics Techniques</TITLE>
   <META>
</HEAD>
<BODY TEXT="#000000" BGCOLOR="#FFFFFF" LINK="#0000EE" VLINK="#551A8B" ALINK="#CE2910">
<H1><FONT COLOR=#FF0000>Chapter 5</FONT></H1>
<H1><B><FONT SIZE=5 COLOR=#FF0000>Java Graphics Techniques</FONT></B>
</H1>
<P>
<HR WIDTH="100%"></P>
<P>
<H3 ALIGN=CENTER><FONT COLOR="#000000"><FONT SIZE=+2>CONTENTS<A NAME="CONTENTS"></A>
</FONT></FONT></H3>

<UL>
<LI><A HREF="#TheGraphicsCoordinateSystem" >The Graphics Coordinate System</A>
<LI><A HREF="#TheBasicsofColor" >The Basics of Color</A>
<LI><A HREF="#TheGraphicsClass" >The Graphics Class</A>
<UL>
<LI><A HREF="#DrawingGraphicsPrimitives" >Drawing Graphics Primitives</A>
<LI><A HREF="#DrawingText" >Drawing Text</A>
<LI><A HREF="#DrawingImages" >Drawing Images</A>
</UL>
<LI><A HREF="#TrackingImages" >Tracking Images</A>
<UL>
<LI><A HREF="#TheMediaTrackerClass" >The MediaTracker Class</A>
<LI><A HREF="#UsingtheMediaTracker" >Using the Media Tracker</A>
</UL>
<LI><A HREF="#Summary" >Summary</A>
<LI><A HREF="#QA" >Q&amp;A</A>
<LI><A HREF="#Workshop" >Workshop</A>
<UL>
<LI><A HREF="#Quiz" >Quiz</A>
<LI><A HREF="#Exercises" >Exercises</A>
</UL>
</UL>
<HR>
<P>
Graphics are at the heart of most games. Knowing this, you need
to understand a certain degree of Java graphics fundamentals before
you get into full-blown game graphics. Today's lesson focuses
on some of the basic Java graphics techniques that will be important
as you move on to programming game graphics. You aren't going
to get into too many gritty details today, because this lesson
is meant to only lay the groundwork of using Java graphics. Don't
worry, you'll build some serious Java graphics skills throughout
the rest of the book.
<P>
You begin today's lesson by learning about the Java graphics coordinate
system and the class used as the basis for most of the Java graphics
operations. You then move on to images and how they are used in
the context of a Java applet. The lesson finishes with an in-depth
discussion of how to track the loading of images over a Web connection,
which is a very important topic in regard to game graphics.
<P>
The following topics are covered in today's lesson:
<UL>
<LI>The graphics coordinate system
<LI>The basics of color
<LI>The graphics class
<LI>Tracking images
</UL>
<H2><A NAME="TheGraphicsCoordinateSystem"><B><FONT SIZE=5 COLOR=#FF0000>The
Graphics Coordinate System</FONT></B></A></H2>
<P>
All graphical computing systems use some sort of coordinate system
to specify the nature of points in the system. Coordinate systems
typically spell out the origin (0,0) of a graphical system, as
well as the axes and directions of increasing value for each of
the axes. The traditional mathematical coordinate system familiar
to most of us is shown in Figure 5.1.
<P>
<A HREF="f5-1.gif" ><B>Figure 5.1 : </B><I>The traditional coordinate system.</I></A>
<P>
The graphical system in Java uses a coordinate system of its own
to specify how and where drawing operations take place. Because
all drawing in Java takes place within the confines of an applet
window, the Java coordinate system is realized by the applet window.
The coordinate system in Java has an origin that is located in
the upper-left corner of the window; positive X values increase
to the right and positive Y values increase down. All values in
the Java coordinate system are positive integers. Figure 5.2 shows
how this coordinate system looks.
<P>
<A HREF="f5-2.gif" ><B>Figure 5.2 : </B><I>The Java graphics coordinate system.</I></A>
<H2><A NAME="TheBasicsofColor"><B><FONT SIZE=5 COLOR=#FF0000>The
Basics of Color</FONT></B></A></H2>
<P>
A topic that impacts almost every area of Java graphics is color.
Therefore, it's important to understand the underlying nature
of color and how it is modeled in Java and in computer systems
in general. Most computer systems take a similar approach to representing
color. The main function of color in a computer system is to accurately
reflect the physical nature of color within the confines of a
graphical system. This physical nature isn't hard to figure out;
anyone who has experienced the joy of Play-Doh can tell you that
colors react in different ways when they are combined with each
other. Like Play-Doh, a computer color system needs to be able
to mix colors with accurate, predictable results.
<P>
Color computer monitors provide possibly the most useful insight
into how software systems implement color. A color monitor has
three electron guns: red, green, and blue. The output from these
three guns converges on each pixel of the screen, exciting phosphors
to produce the appropriate color (see Figure 5.3). The combined
intensities of each gun determine the resulting pixel color. This
convergence of different colors from the monitor guns is very
similar to the convergence of different colored Play-Doh.
<P>
<A HREF="f5-3.gif" ><B>Figure 5.3 : </B><I>Electron guns in a color monitor converging to create a unique color.</I></A>
<P>
<CENTER><TABLE BORDERCOLOR=#000000 BORDER=1 WIDTH=80%>
<TR><TD><B>Note</B></TD></TR>
<TR><TD>
<BLOCKQUOTE>
Technically speaking, the result of combining colors on a monitor is different than that of combining similarly colored Play Doh. The reason for this is that color combinations on a monitor are additive, meaning that mixed colors are emitted by the 
monitor; Play oh color combinations are subtractive, meaning that mixed colors are absorbed. The additive or subtractive nature of a color combination is dependent on the physical properties of the particular medium involved.</BLOCKQUOTE>

</TD></TR>
</TABLE></CENTER>
<P>
<P>
The Java color system is very similar to the physical system used
by color monitors; it forms unique colors by using varying intensities
of the colors red, green, and blue. Therefore, Java colors are
represented by the combination of the numeric intensities of the
primary colors (red, green, and blue). This color system is known
as RGB (Red Green Blue) and is standard across most graphical
computer systems.
<P>
<CENTER><TABLE BORDERCOLOR=#000000 BORDER=1 WIDTH=80%>
<TR><TD><B>Note</B></TD></TR>
<TR><TD>
<BLOCKQUOTE>
Although RGB is the most popular computer color system in use, there are others. Another popular color system is HSB, which stands for Hue Saturation Brightness. In this system, colors are defined by varying degrees of hue, saturation, and brightness. The 
HSB color system is also supported by Java.</BLOCKQUOTE>

</TD></TR>
</TABLE></CENTER>
<P>
<P>
Table 5.1 shows the numeric values for the red, green, and blue
components of some basic colors. Notice that the intensities of
each color component range from 0 to 255 in value.
<BLOCKQUOTE>
<B><CENTER>Table 5.1. RGB component values for some basic colors.<BR>
</B></CENTER>
</BLOCKQUOTE>
<P>
<CENTER><TABLE BORDERCOLOR=#000000 BORDER=1 WIDTH=80%>
<TR><TD><I>Color</I></TD><TD WIDTH=46><I><CENTER>Red</CENTER></I></TD>
<TD WIDTH=58><I><CENTER>Green</CENTER></I></TD><TD WIDTH=48><I><CENTER>Blue</CENTER></I></TD></TR>
<TR><TD WIDTH=87>White</TD><TD WIDTH=46><CENTER>255</CENTER></TD><TD WIDTH=58><CENTER>255</CENTER>
</TD><TD WIDTH=48><CENTER>255</CENTER></TD></TR>
<TR><TD WIDTH=87>Black</TD><TD WIDTH=46><CENTER>0</CENTER></TD><TD WIDTH=58><CENTER>0</CENTER></TD>
<TD WIDTH=48><CENTER>0</CENTER></TD></TR>
<TR><TD WIDTH=87>Light Gray</TD><TD WIDTH=46><CENTER>192</CENTER></TD><TD WIDTH=58><CENTER>192</CENTER>
</TD><TD WIDTH=48><CENTER>192</CENTER></TD></TR>
<TR><TD WIDTH=87>Dark Gray</TD><TD WIDTH=46><CENTER>128</CENTER></TD><TD WIDTH=58><CENTER>128</CENTER>
</TD><TD WIDTH=48><CENTER>128</CENTER></TD></TR>
<TR><TD WIDTH=87>Red</TD><TD WIDTH=46><CENTER>255</CENTER></TD><TD WIDTH=58><CENTER>0</CENTER></TD>
<TD WIDTH=48><CENTER>0</CENTER></TD></TR>
<TR><TD WIDTH=87>Green</TD><TD WIDTH=46><CENTER>0</CENTER></TD><TD WIDTH=58><CENTER>255</CENTER>
</TD><TD WIDTH=48><CENTER>0</CENTER></TD></TR>
<TR><TD WIDTH=87>Blue</TD><TD WIDTH=46><CENTER>0</CENTER></TD><TD WIDTH=58><CENTER>0</CENTER></TD>
<TD WIDTH=48><CENTER>255</CENTER></TD></TR>
<TR><TD WIDTH=87>Yellow</TD><TD WIDTH=46><CENTER>255</CENTER></TD><TD WIDTH=58><CENTER>255</CENTER>
</TD><TD WIDTH=48><CENTER>0</CENTER></TD></TR>
<TR><TD WIDTH=87>Purple</TD><TD WIDTH=46><CENTER>255</CENTER></TD><TD WIDTH=58><CENTER>0</CENTER>
</TD><TD WIDTH=48><CENTER>255</CENTER></TD></TR>
</TABLE></CENTER>
<P>
<P>
Java provides a class, <TT><FONT FACE="Courier">Color</FONT></TT>,
for modeling colors. The <TT><FONT FACE="Courier">Color</FONT></TT>
class represents an RGB color and provides methods for extracting
and manipulating the primary color components. <TT><FONT FACE="Courier">Color</FONT></TT>
also includes constant members representing many popular colors.
You typically use the <TT><FONT FACE="Courier">Color</FONT></TT>
class to specify the color when you are using many of Java's graphical
functions, about which you learn next.
<H2><A NAME="TheGraphicsClass"><B><FONT SIZE=5 COLOR=#FF0000>The
</FONT></B><TT><B><FONT SIZE=5 COLOR=#FF0000 FACE="Courier">Graphics</FONT></B></TT><B><FONT SIZE=5 COLOR=#FF0000>
Class</FONT></B></A></H2>
<P>
Most of Java's graphics functions are accessible through a single
class, <TT><FONT FACE="Courier">Graphics</FONT></TT>, found in
the Java awt (Advanced Windowing Toolkit) package. The <TT><FONT FACE="Courier">Graphics</FONT></TT>
class models a graphics context.
<P>
A <I>graphics context</I> is an abstract representation of a graphical
surface that can be drawn upon.
<P>
An abstract drawing surface (graphics context) is basically a
way to allow you to draw in a generic manner, without worrying
about where the drawing is physically taking place. Graphics contexts
are necessary so that the same graphics routines can be used regardless
of whether you are drawing to the screen, to memory, or to a printer.
The <TT><FONT FACE="Courier">Graphics</FONT></TT> class provides
you with a graphics context to which you perform all graphics
funtions. As you learn about the functionality provided by the
<TT><FONT FACE="Courier">Graphics</FONT></TT> class, keep in mind
that its output is largely independent of the ultimate destination
thanks to graphics contexts.
<P>
Graphical output code in a Java applet is usually implemented
in the applet's <TT><FONT FACE="Courier">paint</FONT></TT> method.
A <TT><FONT FACE="Courier">Graphics</FONT></TT> object is passed
into the <TT><FONT FACE="Courier">paint</FONT></TT> method, which
is then used to perform graphical output to the applet window
(output surface). Because the <TT><FONT FACE="Courier">Graphics</FONT></TT>
object is provided by <TT><FONT FACE="Courier">paint</FONT></TT>,
you never explicitly create a <TT><FONT FACE="Courier">Graphics</FONT></TT>
object.
<P>
<CENTER><TABLE BORDERCOLOR=#000000 BORDER=1 WIDTH=80%>
<TR><TD><B>Note</B></TD></TR>
<TR><TD>
<BLOCKQUOTE>
Actually, you couldn't explicitly create a <TT><FONT FACE="Courier">Graphics</FONT></TT> object even if you wanted to because it is an abstract class. If you recall from <A HREF="ch3.htm" >Day 3</A>, an abstract class is a class containing unimplemented 
methods, meaning that objects can't be directly created from the class.
</BLOCKQUOTE>

</TD></TR>
</TABLE></CENTER>
<P>
<P>
Even though graphics operations often take place within the context
of an applet window, the output of the <TT><FONT FACE="Courier">Graphics</FONT></TT>
object is really tied to a component.
<P>
A <I>component</I> is a generic graphical window that forms the
basis for all other graphical elements in the Java system. Java
components are modeled at the highest level by the <TT><FONT FACE="Courier">Component</FONT></TT>
class, which is defined in the awt package.
<P>
An applet window is just a specific type of component. Thinking
of graphics in terms of the <TT><FONT FACE="Courier">Component</FONT></TT>
class rather than an applet window shows you that graphics can
be output to any object that is derived from <TT><FONT FACE="Courier">Component</FONT></TT>.
As a matter of fact, every <TT><FONT FACE="Courier">Component</FONT></TT>
object contains a corresponding <TT><FONT FACE="Courier">Graphics</FONT></TT>
object that is used to render graphics on its surface.
<P>
Java graphics contexts (<TT><FONT FACE="Courier">Graphics</FONT></TT>
objects) have a few attributes that determine how different graphical
operations are carried out. The most important of these attributes
is the color attribute, which determines the color used in graphics
operations such as drawing lines. You set this attribute using
the <TT><FONT FACE="Courier">setColor</FONT></TT> method defined
in the <TT><FONT FACE="Courier">Graphics</FONT></TT> class. <TT><FONT FACE="Courier">setColor</FONT></TT>
takes a <TT><FONT FACE="Courier">Color</FONT></TT> object as its
only parameter. Similar to <TT><FONT FACE="Courier">setColor</FONT></TT>
is <TT><FONT FACE="Courier">setBackground</FONT></TT>, which is
a method in the <TT><FONT FACE="Courier">Component</FONT></TT>
class that determines the color of the component's background.
<TT><FONT FACE="Courier">Graphics</FONT></TT> objects also have
a font attribute that determines the size and appearance of text.
This attribute is set using the <TT><FONT FACE="Courier">setFont</FONT></TT>
method, which takes a <TT><FONT FACE="Courier">Font</FONT></TT>
object as its only parameter. You learn more about drawing text
and using the <TT><FONT FACE="Courier">Font</FONT></TT> object,
which is covered a little later today in the &quot;Drawing Text&quot;
section.
<P>
Most of the graphics operations provided by the <TT><FONT FACE="Courier">Graphics</FONT></TT>
class fall into one of the following categories:
<UL>
<LI>Drawing graphics primitives
<LI>Drawing text
<LI>Drawing images
</UL>
<H3><A NAME="DrawingGraphicsPrimitives"><B>Drawing Graphics Primitives</B></A>
</H3>
<P>
<I>Graphics primitives</I> consist of lines, rectangles, circles,
polygons, ovals, and arcs. You can create pretty impressive graphics
by using these primitives in conjunction with each other; the
<TT><FONT FACE="Courier">Graphics</FONT></TT> class provides methods
for drawing these primitives. Certain methods also act on primitives
that form closed regions. You can use these methods to erase the
area defined by a primitive or fill it with a particular color.
<P>
<I>Closed regions</I> are graphical elements with a clearly distinctive
inside and outside. For example, circles and rectangles are closed
regions, whereas lines and points are not.
<P>
I'm not going to go through an exhaustive explanation of how to

?? 快捷鍵說明

復制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
蜜臂av日日欢夜夜爽一区| 91福利区一区二区三区| 99久久精品国产精品久久| 欧美日韩色一区| 日韩av二区在线播放| 国产69精品久久久久777| 7777精品伊人久久久大香线蕉最新版 | 欧美乱妇一区二区三区不卡视频| 久久丝袜美腿综合| 蜜桃传媒麻豆第一区在线观看| 成人美女在线视频| 久久综合久久综合九色| 午夜精品福利久久久| 91一区在线观看| 欧美激情一区二区在线| 国产乱码精品1区2区3区| 日韩欧美一级精品久久| 天天影视涩香欲综合网| 精品视频一区 二区 三区| 亚洲欧美一区二区不卡| 成人av免费在线观看| 久久久无码精品亚洲日韩按摩| 日韩精品一二三区| 欧美电影一区二区三区| 午夜精品一区二区三区免费视频| 91美女福利视频| 亚洲日韩欧美一区二区在线| 成人一区二区视频| 国产欧美综合色| 国产99久久精品| 欧美激情综合网| 大桥未久av一区二区三区中文| 亚洲国产精品精华液ab| 成人免费va视频| 国产精品沙发午睡系列990531| 国产精品一二三四五| 国产亚洲一区二区三区| 懂色av一区二区三区蜜臀| 中文在线资源观看网站视频免费不卡| 国产激情精品久久久第一区二区 | 成人白浆超碰人人人人| 亚洲天堂久久久久久久| 91久久精品国产91性色tv| 亚洲一区二区在线视频| 777奇米成人网| 国产精品影视天天线| 国产精品色哟哟| 日本丶国产丶欧美色综合| 性欧美疯狂xxxxbbbb| 欧美一级夜夜爽| 国产丶欧美丶日本不卡视频| 中文字幕综合网| 欧美日韩国产小视频在线观看| 9人人澡人人爽人人精品| 国产精品乱码一区二区三区软件| 99久久精品久久久久久清纯| 亚洲国产视频直播| 欧美电影免费观看完整版| 国产成人在线视频播放| 一区二区三区蜜桃| 日韩精品最新网址| 99这里只有久久精品视频| 亚洲国产精品久久久男人的天堂| 日韩免费福利电影在线观看| 国产成人8x视频一区二区| 亚洲图片欧美综合| 久久久久久久久久久久久久久99| 色综合色综合色综合色综合色综合 | 香港成人在线视频| 久久精品一区八戒影视| 在线日韩一区二区| 精品制服美女久久| 亚洲黄色免费电影| 久久久久久久久久久久久女国产乱 | 久久久久久久久久久黄色| 欧洲一区二区三区在线| 国产精品自拍网站| 亚洲 欧美综合在线网络| 国产欧美中文在线| 日韩一区二区三区四区| 91丨九色丨黑人外教| 精品亚洲porn| 视频在线观看一区| 成人欧美一区二区三区黑人麻豆 | 一区二区三区美女| 久久久久久久久久美女| 色婷婷久久久久swag精品| 精品盗摄一区二区三区| 久久99精品视频| 精品综合久久久久久8888| 久久激情五月婷婷| 精品少妇一区二区三区日产乱码| 日韩一区二区三区三四区视频在线观看 | 亚洲精品一区二区三区在线观看 | 精品美女在线观看| 欧美在线色视频| 99re8在线精品视频免费播放| 久久精品国产一区二区| 性做久久久久久久久| 天堂蜜桃一区二区三区 | 在线观看av不卡| www.欧美.com| 国产夫妻精品视频| 国产一区二区三区在线观看免费 | 中文字幕精品一区| 久久精品一区八戒影视| 久久品道一品道久久精品| 欧美tickling挠脚心丨vk| 56国语精品自产拍在线观看| 欧美亚洲国产一区二区三区| 91麻豆国产精品久久| 99re这里都是精品| 成人av午夜影院| 成人晚上爱看视频| 成人av电影在线观看| 成人深夜福利app| caoporn国产一区二区| 成人性生交大片免费看中文 | 亚洲一区二区高清| 一个色妞综合视频在线观看| 亚洲视频精选在线| 一区二区在线看| 亚洲小说欧美激情另类| 午夜欧美在线一二页| 日韩电影一区二区三区四区| 另类小说综合欧美亚洲| 精品一区在线看| 高清不卡在线观看| 色婷婷精品久久二区二区蜜臀av | 一区二区国产视频| 亚洲国产色一区| 美国av一区二区| 国产成人综合网| 色一情一伦一子一伦一区| 欧美一区二区三区小说| 欧美日韩高清一区二区三区| 制服丝袜激情欧洲亚洲| 久久综合九色综合欧美98 | 日韩色在线观看| www国产成人| 亚洲欧美乱综合| eeuss鲁片一区二区三区在线看| av资源站一区| 欧美猛男男办公室激情| 久久综合五月天婷婷伊人| 国产精品国产三级国产aⅴ无密码| 亚洲制服丝袜一区| 精品一区二区免费| 一本久久a久久免费精品不卡| 欧美日韩一区小说| 久久综合999| 亚洲图片一区二区| 国产精品资源网| 欧美人伦禁忌dvd放荡欲情| 久久久777精品电影网影网| 亚洲综合在线第一页| 激情深爱一区二区| 在线国产亚洲欧美| 欧美国产日产图区| 日日摸夜夜添夜夜添亚洲女人| 成人中文字幕合集| 日韩午夜激情视频| 亚洲欧美日韩成人高清在线一区| 激情综合五月婷婷| 欧美视频一区二| 国产精品热久久久久夜色精品三区 | 欧美一区二区网站| 中文字幕亚洲一区二区av在线| 香蕉加勒比综合久久 | 本田岬高潮一区二区三区| 欧美群妇大交群中文字幕| 成人欧美一区二区三区白人| 久久国产尿小便嘘嘘尿| 在线观看av不卡| 亚洲天堂av老司机| 国产xxx精品视频大全| 欧美成人一区二区三区在线观看| 亚洲激情自拍视频| 91免费看视频| 国产精品污网站| 国产二区国产一区在线观看| 精品日韩一区二区三区| 日本va欧美va瓶| 欧美人妇做爰xxxⅹ性高电影| 一区二区成人在线| 91色视频在线| 国产精品白丝jk黑袜喷水| 日韩欧美一区在线| 日韩国产欧美在线视频| 欧美日韩视频第一区| 亚洲国产乱码最新视频| 欧美亚洲图片小说| 亚洲自拍都市欧美小说| 欧洲一区二区三区在线| 亚洲大片精品永久免费| 欧美天天综合网| 日韩成人一级片| 日韩一区二区三区视频在线| 久久精品国产网站| 久久美女高清视频|