{"id":719,"date":"2021-01-10T23:08:20","date_gmt":"2021-01-10T23:08:20","guid":{"rendered":"https:\/\/bhiggs.x10hosting.com\/PracticalJavaProgramming\/?page_id=719"},"modified":"2021-01-11T16:57:13","modified_gmt":"2021-01-11T16:57:13","slug":"images","status":"publish","type":"page","link":"https:\/\/bhiggs.x10hosting.com\/PracticalJavaProgramming\/course-topics\/graphics-programming\/images\/","title":{"rendered":"Images"},"content":{"rendered":"<div id=\"ez-toc-container\" class=\"ez-toc-v2_0_84 counter-hierarchy ez-toc-counter ez-toc-grey ez-toc-container-direction\">\n<p class=\"ez-toc-title\" style=\"cursor:inherit\">Table of Contents<\/p>\n<label for=\"ez-toc-cssicon-toggle-item-6a21c46f48592\" class=\"ez-toc-cssicon-toggle-label\"><span class=\"\"><span class=\"eztoc-hide\" style=\"display:none;\">Toggle<\/span><span class=\"ez-toc-icon-toggle-span\"><svg style=\"fill: #999;color:#999\" xmlns=\"http:\/\/www.w3.org\/2000\/svg\" class=\"list-377408\" width=\"20px\" height=\"20px\" viewBox=\"0 0 24 24\" fill=\"none\"><path d=\"M6 6H4v2h2V6zm14 0H8v2h12V6zM4 11h2v2H4v-2zm16 0H8v2h12v-2zM4 16h2v2H4v-2zm16 0H8v2h12v-2z\" fill=\"currentColor\"><\/path><\/svg><svg style=\"fill: #999;color:#999\" class=\"arrow-unsorted-368013\" xmlns=\"http:\/\/www.w3.org\/2000\/svg\" width=\"10px\" height=\"10px\" viewBox=\"0 0 24 24\" version=\"1.2\" baseProfile=\"tiny\"><path d=\"M18.2 9.3l-6.2-6.3-6.2 6.3c-.2.2-.3.4-.3.7s.1.5.3.7c.2.2.4.3.7.3h11c.3 0 .5-.1.7-.3.2-.2.3-.5.3-.7s-.1-.5-.3-.7zM5.8 14.7l6.2 6.3 6.2-6.3c.2-.2.3-.5.3-.7s-.1-.5-.3-.7c-.2-.2-.4-.3-.7-.3h-11c-.3 0-.5.1-.7.3-.2.2-.3.5-.3.7s.1.5.3.7z\"\/><\/svg><\/span><\/span><\/label><input type=\"checkbox\"  id=\"ez-toc-cssicon-toggle-item-6a21c46f48592\"  aria-label=\"Toggle\" \/><nav><ul class='ez-toc-list ez-toc-list-level-1 ' ><li class='ez-toc-page-1 ez-toc-heading-level-3'><a class=\"ez-toc-link ez-toc-heading-1\" href=\"https:\/\/bhiggs.x10hosting.com\/PracticalJavaProgramming\/course-topics\/graphics-programming\/images\/#Image_Display_Example\" >Image Display Example<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-3'><a class=\"ez-toc-link ez-toc-heading-2\" href=\"https:\/\/bhiggs.x10hosting.com\/PracticalJavaProgramming\/course-topics\/graphics-programming\/images\/#Finding_Image_Files\" >Finding Image Files<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-3'><a class=\"ez-toc-link ez-toc-heading-3\" href=\"https:\/\/bhiggs.x10hosting.com\/PracticalJavaProgramming\/course-topics\/graphics-programming\/images\/#Using_ImageIO\" >Using ImageIO<\/a><\/li><\/ul><\/nav><\/div>\n\n<p class=\"wp-block-paragraph\">An important part of graphics programming is the ability to display images.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">That is, instead of drawing the components of the image at run time, create the image ahead of time, store it in a file (such as a <strong><code>.jpg<\/code>,<\/strong> <code><strong>.gif<\/strong><\/code>, or <strong><code>.png<\/code><\/strong> file), and then render it at run time.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\"><span class=\"ez-toc-section\" id=\"Image_Display_Example\"><\/span>Image Display Example<span class=\"ez-toc-section-end\"><\/span><\/h3>\n\n\n\n<p class=\"wp-block-paragraph\">Here&#8217;s an example of displaying images.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">The trickiest thing about displaying images in Java is figuring out how to find the image file, and figuring out what class to use to access that image.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">In a Java application, we use the&nbsp;<code><strong>Toolkit<\/strong><\/code>&nbsp;class&#8217;s&nbsp;<code><strong>getImage<\/strong><\/code>&nbsp;method to load the image.&nbsp; Untrusted Java applets are not allowed to access the local browser user&#8217;s disks;&nbsp; they are only allowed to access files from the host from whence the Java applet was launched. Consequently, applets have some convenience methods that are usually used to access images.&nbsp; Those images are usually located in some standard place on the host, relative to the location of the HTML page file in which the applet is embedded.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">It is important to realize that image loading is an asynchronous process.&nbsp;&nbsp;<em>Image loading is not guaranteed to be complete when the <code><strong>getImage<\/strong><\/code> method returns.<\/em>&nbsp; The reason for this is that images can be large, and we might be loading them from a slow source, such as over a network or from the Internet.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">As a result, we need to determine whether the image loading has completed before we assume that we can start displaying that image.&nbsp; We use the&nbsp;<code><strong>MediaTracker<\/strong><\/code>&nbsp;class to accomplish this.<\/p>\n\n\n<div class=\"wp-block-syntaxhighlighter-code \"><pre class=\"brush: java; auto-links: false; highlight: [6,8,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,44,45,46,47,48,49,50,51,52,53,54,55,56,57,58,59,60,61,62,63,64,65,66,67,68,69,70,71,72,73,74,75,76,77,78,79,80,81]; title: ; quick-code: false; notranslate\" title=\"\">\npackage swingExamples;\n\nimport java.awt.Container;\nimport java.awt.Dimension;\nimport java.awt.Graphics;\nimport java.awt.Image;\nimport java.awt.Insets;\nimport java.awt.MediaTracker;\nimport java.awt.Toolkit;\n\nimport javax.swing.JFrame;\nimport javax.swing.JPanel;\n\nclass ImageDisplayPanel extends JPanel\n{\n  public ImageDisplayPanel()\n  {\n    \/\/ Load the images\n    Toolkit t = Toolkit.getDefaultToolkit();\n    m_image1 = t.getImage(&quot;Neonhd.gif&quot;);\n    m_image2 = t.getImage(&quot;Marqhd.gif&quot;);\n    m_image3 = t.getImage(&quot;Bleye.gif&quot;);\n    MediaTracker tracker = new MediaTracker(this);\n    tracker.addImage(m_image1, 0);\n    tracker.addImage(m_image2, 1);\n    tracker.addImage(m_image3, 2);\n    try\n    {\n      tracker.waitForID(0);\n      tracker.waitForID(1);\n      tracker.waitForID(2);\n    }\n    catch (InterruptedException ex)\n    {\n      \/\/ Ignore this possibility\n    }\n    \/\/ Once we get here, the images should be loaded\n  }\n  \n  public void paintComponent(Graphics g)\n  {\n    super.paintComponent(g);\n    \n    Dimension d = getSize();\n    Insets in = getInsets();\n    int clientWidth = d.width - in.right - in.left;\n    int clientHeight = d.height - in.bottom - in.top;\n    \n    \/\/ Draw Neon image\n    int cx = in.left;\n    int cy = in.top;\n    g.drawImage(m_image1, cx, cy, this);\n    \n    \/\/ Draw Marquee image\n    cy += m_image1.getHeight(this) + 10;\n    int image2Width = m_image2.getWidth(this);\n    int image2Height = m_image2.getHeight(this);\n    cx = (clientWidth - image2Width)\/2 + in.left;\n    g.drawImage(m_image2, cx, cy, this);\n    \n    \/\/ Draw Bloodshot eye image\n    int image3Width = m_image3.getWidth(this);\n    int image3Height = m_image3.getHeight(this);\n    cx = (cx - image3Width)\/2;\n    cy += (image2Height - image3Height)\/2;\n    int cx3 = cx;\n    int cy3 = cy;\n    g.drawImage(m_image3, cx, cy, this);\n    \n    \/\/ Copy Bloodshot eye image multiple times.\n    cx = in.left;\n    cy += image2Height + 20;\n    for (int i = 0; i &lt;= clientWidth\/image3Width; i++)\n    {\n      g.copyArea(cx3, cy3,\n          image3Width, image3Height,\n          i * image3Width - cx3, cy - cy3);\n    }\n  }\n  \n  private Image m_image1, m_image2, m_image3;\n}\n\nclass ImageDisplayFrame extends JFrame\n{\n  public ImageDisplayFrame()\n  {\n    setTitle(&quot;ImageDisplay&quot;);\n    setSize(500, 300);\n    setDefaultCloseOperation(EXIT_ON_CLOSE);\n    Container contentPane = getContentPane();\n    contentPane.add( new ImageDisplayPanel() );\n  }\n}\n\npublic class ImageDisplay\n{\n  public static void main(String&#x5B;] args)\n  {\n    ImageDisplayFrame frame = new ImageDisplayFrame();\n    frame.setVisible(true);\n  }\n}\n<\/pre><\/div>\n\n\n<p class=\"wp-block-paragraph\">which produces the following:<\/p>\n\n\n\n<div class=\"wp-block-image\"><figure class=\"alignleft size-large\"><img fetchpriority=\"high\" decoding=\"async\" width=\"500\" height=\"300\" src=\"https:\/\/bhiggs.x10hosting.com\/PracticalJavaProgramming\/wp-content\/uploads\/2021\/01\/ImageDisplay.gif\" alt=\"\" class=\"wp-image-723\"\/><\/figure><\/div>\n\n\n\n<div style=\"height:28px\" aria-hidden=\"true\" class=\"wp-block-spacer\"><\/div>\n\n\n\n<p class=\"wp-block-paragraph\">assuming the appropriate images are found in the proper locations on disk.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\"><span class=\"ez-toc-section\" id=\"Finding_Image_Files\"><\/span>Finding Image Files<span class=\"ez-toc-section-end\"><\/span><\/h3>\n\n\n\n<p class=\"wp-block-paragraph\">The previous example made the simple assumption that the images it displayed had image files that were located in its current default working directory.&nbsp; However, in real programs this is not a typical (or particularly good) strategy.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">An image file might be found in a number of places:<\/p>\n\n\n\n<ul class=\"wp-block-list\"><li>In a directory on a local disk<\/li><li>In a directory on a remote disk<\/li><li>Somewhere in a network or on the Internet.<\/li><li>Contained within a ZIP or JAR file, together with the Java program&#8217;s classes.<\/li><\/ul>\n\n\n\n<p class=\"wp-block-paragraph\">The&nbsp;<code><strong>Toolkit<\/strong><\/code>&nbsp;class actually has two overloaded&nbsp;<code><strong>getImage<\/strong><\/code>&nbsp;methods:<\/p>\n\n\n\n<figure class=\"wp-block-table\"><table><tbody><tr><th>Method<\/th><th>Description<\/th><\/tr><tr><td><strong><code>public abstract Image getImage(String filename)<\/code><\/strong><\/td><td>Returns an image which gets pixel data from the specified file, whose format can be either GIF, JPEG or PNG.<\/td><\/tr><tr><td><strong><code>public abstract Image getImage(URL url)<\/code><\/strong><\/td><td>Returns an image which gets pixel data from the specified URL. The pixel data referenced by the specified URL must be in one of the following formats: GIF, JPEG or PNG<\/td><\/tr><\/tbody><\/table><\/figure>\n\n\n\n<p class=\"wp-block-paragraph\">The first version of the method is the simplest to use, but tends to be rather inflexible.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">The second requires the use of a URL (Uniform Resource Locator), the form of which may be familiar to you from the address field in your browser.&nbsp; The most common forms of URLs are:<\/p>\n\n\n\n<ul class=\"wp-block-list\"><li><code><strong>http:\/\/<em>hostname<\/em>[:<em>port<\/em>]\/<em>path<\/em><\/strong><\/code><\/li><li><code><strong>file:\/\/\/<em>filespec<\/em><\/strong><\/code><\/li><li>and several other forms<\/li><\/ul>\n\n\n\n<p class=\"wp-block-paragraph\">A URL is represented in Java by the URL class, which allows to specify the location of an image file on a disk, on a network or the Internet, or within a ZIP or JAR file.&nbsp;&nbsp;<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">A very common usage is to specify the location of an image file relative to the location of a Java class file within the program that is displaying the image.&nbsp; Here&#8217;s an example of this usage:<\/p>\n\n\n<div class=\"wp-block-syntaxhighlighter-code \"><pre class=\"brush: java; auto-links: false; highlight: [21,22,23,24,25,26,27,28,29,30,31,32,33,34]; title: ; quick-code: false; notranslate\" title=\"\">\npackage swingExamples;\n\nimport java.awt.Container;\nimport java.awt.Dimension;\nimport java.awt.Graphics;\nimport java.awt.Image;\nimport java.awt.Insets;\nimport java.awt.MediaTracker;\nimport java.awt.Toolkit;\n\nimport java.net.URL;\n\nimport javax.swing.JFrame;\nimport javax.swing.JPanel;\n\nclass ImageURLDisplayPanel extends JPanel\n{\n  public ImageURLDisplayPanel()\n  {\n    Toolkit tk = Toolkit.getDefaultToolkit();\n    URL remoteURL = null;\n    URL localURL = null;\n    try\n    {\n      \/\/ Image file from the Internet\n      remoteURL = new URL(&quot;http:\/\/members.lycos.co.uk\/pinkwall\/memor.jpg&quot;);\n      \/\/ Image file located relative to the current class file\n      Class mainClass = ImageURLDisplay.class;\n      localURL = mainClass.getResource(&quot;..\/images\/monalisa.jpg&quot;);\n    }\n    catch (Exception e)\n    {\n      e.printStackTrace();\n    }\n    \n    \/\/ Get the images\n    m_dali = tk.getImage(remoteURL);\n    m_davinci = tk.getImage(localURL);\n    \n    \/\/ Track them until loaded\n    MediaTracker tracker = new MediaTracker(this);\n    tracker.addImage(m_dali, 0);\n    tracker.addImage(m_davinci, 1);\n    try\n    {\n      tracker.waitForID(0);\n      tracker.waitForID(1);\n    }\n    catch (InterruptedException ex)\n    {\n    }\n  }\n  \n  public void paintComponent(Graphics g)\n  {\n    super.paintComponent(g);\n    \n    Dimension d = getSize();\n    Insets in = getInsets();\n    int clientWidth = d.width - in.right - in.left;\n    int clientHeight = d.height - in.bottom - in.top;\n    \n    \/\/ Draw Dali&#039;s Persistence of Memory\n    int cx = in.left + 5;\n    int cy = in.top + 5;\n    g.drawImage(m_dali, cx, cy, this);\n    \n    \/\/ Draw DaVinci&#039;s Mona Lisa\n    cx += m_dali.getWidth(this) + 5;\n    g.drawImage(m_davinci, cx, cy, this);\n  }\n  \n  private Image m_dali;\n  private Image m_davinci;\n}\n\nclass ImageURLDisplayFrame extends JFrame\n{\n  public ImageURLDisplayFrame()\n  {\n    setTitle(&quot;ImageURLDisplay&quot;);\n    setSize(650, 450);\n    setDefaultCloseOperation(EXIT_ON_CLOSE);\n    Container contentPane = getContentPane();\n    contentPane.add( new ImageURLDisplayPanel() );\n  }\n}\n\npublic class ImageURLDisplay\n{\n  public static void main(String&#x5B;] args)\n  {\n    ImageURLDisplayFrame frame = new ImageURLDisplayFrame();\n    frame.setVisible(true);\n  }\n}\n<\/pre><\/div>\n\n\n<p class=\"wp-block-paragraph\">which results in the following:<\/p>\n\n\n\n<div class=\"wp-block-image\"><figure class=\"alignleft size-large\"><img decoding=\"async\" width=\"650\" height=\"450\" src=\"https:\/\/bhiggs.x10hosting.com\/PracticalJavaProgramming\/wp-content\/uploads\/2021\/01\/ArtWork.gif\" alt=\"\" class=\"wp-image-728\"\/><\/figure><\/div>\n\n\n\n<div style=\"height:37px\" aria-hidden=\"true\" class=\"wp-block-spacer\"><\/div>\n\n\n\n<p class=\"wp-block-paragraph\">Again, assuming that the image files are found in the proper places.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\"><span class=\"ez-toc-section\" id=\"Using_ImageIO\"><\/span>Using ImageIO<span class=\"ez-toc-section-end\"><\/span><\/h3>\n\n\n\n<p class=\"wp-block-paragraph\">Starting with JDK 1.4, we have an alternative way of obtaining image files:&nbsp;<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">The&nbsp;<code><strong>java.imageio.ImageIO<\/strong><\/code>&nbsp;class.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">This removes the need to use the&nbsp;<code><strong>Toolkit<\/strong><\/code>&nbsp;class.&nbsp; Apparently, it also removes the need to use the&nbsp;<code><strong>MediaTracker<\/strong><\/code>&nbsp;class.<\/p>\n\n\n<div class=\"wp-block-syntaxhighlighter-code \"><pre class=\"brush: java; auto-links: false; highlight: [15,33,34,40,41,42,43]; title: ; quick-code: false; notranslate\" title=\"\">\npackage swingExamples;\n\nimport java.awt.Container;\nimport java.awt.Dimension;\nimport java.awt.Graphics;\nimport java.awt.Image;\nimport java.awt.Insets;\nimport java.awt.MediaTracker;\n\nimport java.io.IOException;\n\nimport java.net.MalformedURLException;\nimport java.net.URL;\n\nimport javax.imageio.ImageIO;\nimport javax.swing.JFrame;\nimport javax.swing.JPanel;\n\nclass ImageIODisplayPanel extends JPanel\n{\n  public ImageIODisplayPanel()\n  {\n    URL remoteURL = null;\n    URL localURL = null;\n    try\n    {\n      \/\/ Image file from the Internet\n      remoteURL = new URL(&quot;http:\/\/members.lycos.co.uk\/pinkwall\/memor.jpg&quot;);\n      \/\/ Image file located relative to the current class file\n      Class mainClass = ImageIODisplay.class;\n      localURL = mainClass.getResource(&quot;..\/images\/monalisa.jpg&quot;);\n      \/\/ Get the images\n      m_dali = ImageIO.read(remoteURL);\n      m_davinci = ImageIO.read(localURL);\n    }\n    catch (MalformedURLException mue)\n    {\n      mue.printStackTrace();\n    }\n    catch (IOException ioe)\n    {\n      ioe.printStackTrace();\n    }\n  }\n  \n  public void paintComponent(Graphics g)\n  {\n    super.paintComponent(g);\n    \n    Dimension d = getSize();\n    Insets in = getInsets();\n    int clientWidth = d.width - in.right - in.left;\n    int clientHeight = d.height - in.bottom - in.top;\n    \n    \/\/ Draw Dali&#039;s Persistence of Memory\n    int cx = in.left + 5;\n    int cy = in.top + 5;\n    g.drawImage(m_dali, cx, cy, this);\n    \n    \/\/ Draw DaVinci&#039;s Mona Lisa\n    cx += m_dali.getWidth(this) + 5;\n    g.drawImage(m_davinci, cx, cy, this);\n  }\n  \n  private Image m_dali;\n  private Image m_davinci;\n}\n\nclass ImageIODisplayFrame extends JFrame\n{\n  public ImageIODisplayFrame()\n  {\n    setTitle(&quot;ImageIODisplay&quot;);\n    setSize(650, 450);\n    setDefaultCloseOperation(EXIT_ON_CLOSE);\n    Container contentPane = getContentPane();\n    contentPane.add( new ImageIODisplayPanel() );\n  }\n}\n\npublic class ImageIODisplay\n{\n  public static void main(String&#x5B;] args)\n  {\n    ImageIODisplayFrame frame = new ImageIODisplayFrame();\n    frame.setVisible(true);\n  }\n<\/pre><\/div>\n\n\n<p class=\"wp-block-paragraph\">which produces the following:<\/p>\n\n\n\n<div class=\"wp-block-image\"><figure class=\"alignleft size-large\"><img decoding=\"async\" width=\"650\" height=\"450\" src=\"https:\/\/bhiggs.x10hosting.com\/PracticalJavaProgramming\/wp-content\/uploads\/2021\/01\/ImageIODisplay.gif\" alt=\"\" class=\"wp-image-732\"\/><\/figure><\/div>\n\n\n\n<div style=\"height:24px\" aria-hidden=\"true\" class=\"wp-block-spacer\"><\/div>\n","protected":false},"excerpt":{"rendered":"<p>An important part of graphics programming is the ability to display images. That is, instead of drawing the components of the image at run time, create the image ahead of time, store it in a file (such as a .jpg, .gif, or .png file), and then render it at run time. Image Display Example Here&#8217;s [&hellip;]<\/p>\n","protected":false},"author":2,"featured_media":0,"parent":67,"menu_order":0,"comment_status":"closed","ping_status":"closed","template":"","meta":{"_eb_attr":"","_uag_custom_page_level_css":"","ocean_post_layout":"left-sidebar","ocean_both_sidebars_style":"","ocean_both_sidebars_content_width":0,"ocean_both_sidebars_sidebars_width":0,"ocean_sidebar":"ocs-course-topics-sidebar","ocean_second_sidebar":"0","ocean_disable_margins":"enable","ocean_add_body_class":"","ocean_shortcode_before_top_bar":"","ocean_shortcode_after_top_bar":"","ocean_shortcode_before_header":"","ocean_shortcode_after_header":"","ocean_has_shortcode":"","ocean_shortcode_after_title":"","ocean_shortcode_before_footer_widgets":"","ocean_shortcode_after_footer_widgets":"","ocean_shortcode_before_footer_bottom":"","ocean_shortcode_after_footer_bottom":"","ocean_display_top_bar":"default","ocean_display_header":"default","ocean_header_style":"","ocean_center_header_left_menu":"0","ocean_custom_header_template":"0","ocean_custom_logo":0,"ocean_custom_retina_logo":0,"ocean_custom_logo_max_width":0,"ocean_custom_logo_tablet_max_width":0,"ocean_custom_logo_mobile_max_width":0,"ocean_custom_logo_max_height":0,"ocean_custom_logo_tablet_max_height":0,"ocean_custom_logo_mobile_max_height":0,"ocean_header_custom_menu":"0","ocean_menu_typo_font_family":"0","ocean_menu_typo_font_subset":"","ocean_menu_typo_font_size":0,"ocean_menu_typo_font_size_tablet":0,"ocean_menu_typo_font_size_mobile":0,"ocean_menu_typo_font_size_unit":"px","ocean_menu_typo_font_weight":"","ocean_menu_typo_font_weight_tablet":"","ocean_menu_typo_font_weight_mobile":"","ocean_menu_typo_transform":"","ocean_menu_typo_transform_tablet":"","ocean_menu_typo_transform_mobile":"","ocean_menu_typo_line_height":0,"ocean_menu_typo_line_height_tablet":0,"ocean_menu_typo_line_height_mobile":0,"ocean_menu_typo_line_height_unit":"","ocean_menu_typo_spacing":0,"ocean_menu_typo_spacing_tablet":0,"ocean_menu_typo_spacing_mobile":0,"ocean_menu_typo_spacing_unit":"","ocean_menu_link_color":"","ocean_menu_link_color_hover":"","ocean_menu_link_color_active":"","ocean_menu_link_background":"","ocean_menu_link_hover_background":"","ocean_menu_link_active_background":"","ocean_menu_social_links_bg":"","ocean_menu_social_hover_links_bg":"","ocean_menu_social_links_color":"","ocean_menu_social_hover_links_color":"","ocean_disable_title":"default","ocean_disable_heading":"default","ocean_post_title":"","ocean_post_subheading":"","ocean_post_title_style":"","ocean_post_title_background_color":"","ocean_post_title_background":0,"ocean_post_title_bg_image_position":"","ocean_post_title_bg_image_attachment":"","ocean_post_title_bg_image_repeat":"","ocean_post_title_bg_image_size":"","ocean_post_title_height":0,"ocean_post_title_bg_overlay":0.5,"ocean_post_title_bg_overlay_color":"","ocean_disable_breadcrumbs":"default","ocean_breadcrumbs_color":"","ocean_breadcrumbs_separator_color":"","ocean_breadcrumbs_links_color":"","ocean_breadcrumbs_links_hover_color":"","ocean_display_footer_widgets":"default","ocean_display_footer_bottom":"default","ocean_custom_footer_template":"0","footnotes":""},"class_list":["post-719","page","type-page","status-publish","hentry","entry"],"uagb_featured_image_src":{"full":false,"thumbnail":false,"medium":false,"medium_large":false,"large":false,"1536x1536":false,"2048x2048":false,"ocean-thumb-m":false,"ocean-thumb-ml":false,"ocean-thumb-l":false},"uagb_author_info":{"display_name":"Bryan Higgs","author_link":"https:\/\/bhiggs.x10hosting.com\/PracticalJavaProgramming\/author\/bryan\/"},"uagb_comment_info":0,"uagb_excerpt":"An important part of graphics programming is the ability to display images. That is, instead of drawing the components of the image at run time, create the image ahead of time, store it in a file (such as a .jpg, .gif, or .png file), and then render it at run time. Image Display Example Here&#8217;s&hellip;","_links":{"self":[{"href":"https:\/\/bhiggs.x10hosting.com\/PracticalJavaProgramming\/wp-json\/wp\/v2\/pages\/719","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/bhiggs.x10hosting.com\/PracticalJavaProgramming\/wp-json\/wp\/v2\/pages"}],"about":[{"href":"https:\/\/bhiggs.x10hosting.com\/PracticalJavaProgramming\/wp-json\/wp\/v2\/types\/page"}],"author":[{"embeddable":true,"href":"https:\/\/bhiggs.x10hosting.com\/PracticalJavaProgramming\/wp-json\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/bhiggs.x10hosting.com\/PracticalJavaProgramming\/wp-json\/wp\/v2\/comments?post=719"}],"version-history":[{"count":10,"href":"https:\/\/bhiggs.x10hosting.com\/PracticalJavaProgramming\/wp-json\/wp\/v2\/pages\/719\/revisions"}],"predecessor-version":[{"id":737,"href":"https:\/\/bhiggs.x10hosting.com\/PracticalJavaProgramming\/wp-json\/wp\/v2\/pages\/719\/revisions\/737"}],"up":[{"embeddable":true,"href":"https:\/\/bhiggs.x10hosting.com\/PracticalJavaProgramming\/wp-json\/wp\/v2\/pages\/67"}],"wp:attachment":[{"href":"https:\/\/bhiggs.x10hosting.com\/PracticalJavaProgramming\/wp-json\/wp\/v2\/media?parent=719"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}