<?xml version="1.0"?>
<?xml-stylesheet type="text/css" href="http://mitov.com/wiki/skins/common/feed.css?301"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en">
		<id>http://mitov.com/wiki/index.php?action=history&amp;feed=atom&amp;title=TGPGraphics.GetHalftonePalette</id>
		<title>TGPGraphics.GetHalftonePalette - Revision history</title>
		<link rel="self" type="application/atom+xml" href="http://mitov.com/wiki/index.php?action=history&amp;feed=atom&amp;title=TGPGraphics.GetHalftonePalette"/>
		<link rel="alternate" type="text/html" href="http://mitov.com/wiki/index.php?title=TGPGraphics.GetHalftonePalette&amp;action=history"/>
		<updated>2026-04-22T00:30:04Z</updated>
		<subtitle>Revision history for this page on the wiki</subtitle>
		<generator>MediaWiki 1.17.0</generator>

	<entry>
		<id>http://mitov.com/wiki/index.php?title=TGPGraphics.GetHalftonePalette&amp;diff=1796&amp;oldid=prev</id>
		<title>David Alm: Automated Syncronization with Documentation</title>
		<link rel="alternate" type="text/html" href="http://mitov.com/wiki/index.php?title=TGPGraphics.GetHalftonePalette&amp;diff=1796&amp;oldid=prev"/>
				<updated>2011-11-22T00:15:54Z</updated>
		
		<summary type="html">&lt;p&gt;Automated Syncronization with Documentation&lt;/p&gt;
&lt;p&gt;&lt;b&gt;New page&lt;/b&gt;&lt;/p&gt;&lt;div&gt;&amp;lt;b&amp;gt;&amp;lt;span style=&amp;quot;color:red&amp;quot;&amp;gt;&lt;br /&gt;
This is a Beta Read Only version of this page. &lt;br /&gt;
Please review and send recommendations to [mailto:mitov@mitov.com mitov@mitov.com]. &lt;br /&gt;
We will enable the editing as soon as we are happy with the overall Wiki site.&lt;br /&gt;
&amp;lt;/span&amp;gt;&amp;lt;/b&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Description ==&lt;br /&gt;
Call this method to get a Windows halftone palette.&lt;br /&gt;
 &lt;br /&gt;
 &lt;br /&gt;
 &lt;br /&gt;
 &amp;lt;b&amp;gt;Example:&amp;lt;/b&amp;gt;&lt;br /&gt;
 &lt;br /&gt;
 The following example draws the same image twice. Before the&lt;br /&gt;
 image is drawn the second time, the code gets a halftone&lt;br /&gt;
 palette, selects the palette into a device context, and&lt;br /&gt;
 realizes the palette.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
 var&lt;br /&gt;
   AGraphics1 : IGPGraphics;&lt;br /&gt;
   AGraphics2 : IGPGraphics;&lt;br /&gt;
   AImage     : IGPImage;&lt;br /&gt;
   APalette   : HPALETTE;&lt;br /&gt;
 &lt;br /&gt;
 begin&lt;br /&gt;
 &lt;br /&gt;
   AImage := TGPImage.Create( 'Mosaic.png' );&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
 &amp;lt;code lang=&amp;quot;delphi&amp;quot;&amp;gt;&lt;br /&gt;
 &lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
   AGraphics1 := TGPGraphics.Create( ACanvas );&lt;br /&gt;
   AGraphics1.DrawImage(AImage, 10, 10);&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
 &amp;lt;code lang=&amp;quot;delphi&amp;quot;&amp;gt;&lt;br /&gt;
   Araphics1 := NIL;&lt;br /&gt;
 &lt;br /&gt;
   APalette := TGPGraphics.GetHalftonePalette();&lt;br /&gt;
   SelectPalette( ACanvas.Handle, APalette, FALSE);&lt;br /&gt;
   RealizePalette( ACanvas.Handle );&lt;br /&gt;
 &lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
   AGraphics2 := TGPGraphics.Create( ACanvas );&lt;br /&gt;
   graphics2.DrawImage(AImage, 300, 10);&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
 &amp;lt;code lang=&amp;quot;delphi&amp;quot;&amp;gt;&lt;br /&gt;
   Araphics2 := NIL;&lt;br /&gt;
   DeleteObject( APalette);&lt;br /&gt;
 end;&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
Remarks&lt;br /&gt;
The purpose of the GetHalftonePalette method is to enable&lt;br /&gt;
GDI+ to produce a better quality halftone when the display&lt;br /&gt;
uses 8 bits per pixel. To display an image using the halftone&lt;br /&gt;
palette, use the following procedure:&lt;br /&gt;
&lt;br /&gt;
  1. Call GetHalftonePalette to get a GDI+ halftone palette.&lt;br /&gt;
  2. Select the halftone palette into a device context.&lt;br /&gt;
  3. Realize the palette by calling the RealizePalette&lt;br /&gt;
     function.&lt;br /&gt;
  4. Construct a Graphics object from a handle to the device&lt;br /&gt;
     context.&lt;br /&gt;
  5. Call the DrawImage method of the Graphics object.&lt;br /&gt;
&lt;br /&gt;
Be sure to delete the palette when you have finished using&lt;br /&gt;
it. If you do not follow the preceding procedure, then on an&lt;br /&gt;
8-bits-per-pixel-display device, the default, 16-color&lt;br /&gt;
process is used, which results in a lesser quality halftone.&lt;/div&gt;</summary>
		<author><name>David Alm</name></author>	</entry>

	</feed>