tailieunhanh - PHP and MySQL Web Development - P85

PHP and MySQL Web Development - P85: PHP and MySQL Web Development teaches the reader to develop dynamic, secure, commercial Web sites. Using the same accessible, popular teaching style of the first edition, this best-selling book has been updated to reflect the rapidly changing landscape of MySQL and PHP. | 392 Chapter 19 Generating Images of red green and blue light. Image formats use a color palette that consists of a specified subset of all the possible combinations of the three use a color to draw in an image you need to add this color to the image s must do this for every color you want to use even black and white. You can select colors for your image by calling the ImageColorAllocate function. You need to pass your image identifier and the red green and blue RGB values of the color you want to draw into the function. In Listing we are using two colors black and allocate these by calling white ImageColorAllocate im 255 255 255 black ImageColorAllocate im 0 0 0 The function returns a color identifier that we can use to access the color later on. Second to actually draw into the image a number of different functions are available depending on what you want to draw lines arcs polygons or text. The drawing functions generally require the following as parameters The image identifier The start and sometimes the end coordinates of what you want to draw The color you want to draw in For text the font information In this case we used three of the drawing functions. Let s look at each one in turn. First we painted a black background on which to draw using the ImageFill function ImageFill im 0 0 black This function takes the image identifier the start coordinates of the area to paint x and y and the color to fill in as parameters. Note One thing to note is that the coordinates of the image start from the top-left corner which is x 0 y 0. The bottom-right corner of the image is x width y height. This is the opposite of typical graphing conventions so beware Next we ve drawn a line from the top-left corner 0 0 to the bottom-right corner width height of the image ImageLine im 0 0 width height white This function takes the image identifier the start point x and y for the line the end point and then the color as parameters. Finally we add a .

TỪ KHÓA LIÊN QUAN