<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>REALbasic City &#187; picture</title>
	<atom:link href="http://realbasic.tutspolis.com/tag/picture/feed/" rel="self" type="application/rss+xml" />
	<link>http://realbasic.tutspolis.com</link>
	<description>Tutorials - Tutspolis.com</description>
	<lastBuildDate>Sat, 29 May 2010 23:10:17 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.9.2</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>Hex Color Picker in REALbasic</title>
		<link>http://realbasic.tutspolis.com/tutorials/hex-color-picker-in-realbasic/</link>
		<comments>http://realbasic.tutspolis.com/tutorials/hex-color-picker-in-realbasic/#comments</comments>
		<pubDate>Sun, 18 Oct 2009 11:52:18 +0000</pubDate>
		<dc:creator>Jakub Pawlak</dc:creator>
				<category><![CDATA[Tutorials]]></category>
		<category><![CDATA[canvas]]></category>
		<category><![CDATA[color picker]]></category>
		<category><![CDATA[graphics]]></category>
		<category><![CDATA[picture]]></category>
		<category><![CDATA[realbasic]]></category>

		<guid isPermaLink="false">http://realbasic.tutspolis.com/?p=111</guid>
		<description><![CDATA[<!-- isPostPurchased ,postID 111, userID 0, combination 1 -->
			
				
			
		
Weekend is almost over and I promised some tutorials for you folks. So to keep my word we will learn today how can we create a Hex Color Picker in REALbasic. This will be a very fun tutorial so watch it , learn it, enjoy it!


Creating the GUI
We will use today Rectangle Control, StaticText Control, [...]]]></description>
			<content:encoded><![CDATA[<!-- isPostPurchased ,postID 111, userID 0, combination 1 --><div class="tweetmeme_button" style="float: right; margin-left: 10px;">
			<a href="http://api.tweetmeme.com/share?url=http%3A%2F%2Frealbasic.tutspolis.com%2Ftutorials%2Fhex-color-picker-in-realbasic%2F"><br />
				<img src="http://api.tweetmeme.com/imagebutton.gif?url=http%3A%2F%2Frealbasic.tutspolis.com%2Ftutorials%2Fhex-color-picker-in-realbasic%2F&amp;source=REALbasicCity&amp;style=normal" height="61" width="50" /><br />
			</a>
		</div>
<p>Weekend is almost over and I promised some tutorials for you folks. So to keep my word we will learn today how can we create a Hex Color Picker in REALbasic. This will be a very fun tutorial so watch it , learn it, enjoy it!</p>
<p><span id="more-111"></span></p>
<div style="margin-left:19px;float:left">
<h2>Creating the GUI</h2>
<p>We will use today Rectangle Control, StaticText Control, TextField Control and Canvas Control. Try to put them in similar positions and sizes like on the screenshot. In StaticText Control property Text enter Color name then add to Project Tab a picture (vacations) and for the Backdrop property for Canvas1 select our image. For the end add in Code Editor Tab a new Property Declaration mycolor As Color.</p>
<p><img src="http://realbasic.tutspolis.com/files/tutorials/hexcolorpicker.jpg" alt="Hex Color Picker in REALbasic" /></p>
<h3>Color Picker from Canvas</h3>
<p>To get the color from our Canvas1 we must go to the code editor Canvas1 Function MouseDown (). When we enter this code this tutorial is over but I will give you some other tips.  First when you enter this code for example in Event Handlers Function MouseDown () you will get every color available in app Window (StaticText Control, Window BackColor).</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
4
</pre></td><td class="code"><pre class="vb" style="font-family:monospace;">myColor = System.Pixel(System.MouseX, System.MouseY) //<span style="color: #000080;">get</span> the pixel color under the mouse
&nbsp;
Rectangle1.FillColor = mycolor //change the color <span style="color: #000080;">in</span> Rectangle <span style="color: #000080;">Control</span>
StaticText1.Text = Str(mycolor) //<span style="color: #000080;">get</span> the color name <span style="color: #000080;">in</span> <span style="color: #000080;">string</span></pre></td></tr></table></div>

<h2>Converting color to Hexadecimal</h2>
<p>Our color picker in REALbasic give us a color in format &amp;hffffff (white). We can simply convert this to web color by replacing &amp;h with #. In this way we can use the name of color immediate in our web pages, css files or graphics software.</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
</pre></td><td class="code"><pre class="vb" style="font-family:monospace;">me.Text = Replace(me.Text, <span style="color: #800000;">&quot;&amp;amp;h&quot;</span>, <span style="color: #800000;">&quot;#&quot;</span>)</pre></td></tr></table></div>

<h2>Changing the cursor in REALbasic</h2>
<p>It can be also nice when we can display a other cursor for picking the color from our picture. To do this we can go to Canvas1 Sub MouseEnter () and display a new cursor. On Canvas1 Sub MouseExit () we can then change it to default.</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
</pre></td><td class="code"><pre class="vb" style="font-family:monospace;">App.MouseCursor = System.Cursors.MagnifyLarger</pre></td></tr></table></div>

</div>
]]></content:encoded>
			<wfw:commentRss>http://realbasic.tutspolis.com/tutorials/hex-color-picker-in-realbasic/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Drawing a picture in REALbasic ListBox control</title>
		<link>http://realbasic.tutspolis.com/tutorials/drawing-a-picture-in-realbasic-listbox-control/</link>
		<comments>http://realbasic.tutspolis.com/tutorials/drawing-a-picture-in-realbasic-listbox-control/#comments</comments>
		<pubDate>Thu, 08 Oct 2009 21:11:58 +0000</pubDate>
		<dc:creator>Jakub Pawlak</dc:creator>
				<category><![CDATA[Tutorials]]></category>
		<category><![CDATA[control]]></category>
		<category><![CDATA[drawing]]></category>
		<category><![CDATA[image]]></category>
		<category><![CDATA[listbox]]></category>
		<category><![CDATA[picture]]></category>
		<category><![CDATA[realbasic]]></category>
		<category><![CDATA[tutorial]]></category>

		<guid isPermaLink="false">http://realbasic.tutspolis.com/?p=96</guid>
		<description><![CDATA[<!-- isPostPurchased ,postID 96, userID 0, combination 1 -->
			
				
			
		
In this tutorial we will learn how can we easy draw a picture in REALbasic ListBox control and how can we get the text from double clicked row or column in this control. So run REALbasic and start reading. Watch it, learn it, enjoy it!


ListBox Control Setup
Add to your Window ListBox Control and set the [...]]]></description>
			<content:encoded><![CDATA[<!-- isPostPurchased ,postID 96, userID 0, combination 1 --><div class="tweetmeme_button" style="float: right; margin-left: 10px;">
			<a href="http://api.tweetmeme.com/share?url=http%3A%2F%2Frealbasic.tutspolis.com%2Ftutorials%2Fdrawing-a-picture-in-realbasic-listbox-control%2F"><br />
				<img src="http://api.tweetmeme.com/imagebutton.gif?url=http%3A%2F%2Frealbasic.tutspolis.com%2Ftutorials%2Fdrawing-a-picture-in-realbasic-listbox-control%2F&amp;source=REALbasicCity&amp;style=normal" height="61" width="50" /><br />
			</a>
		</div>
<p>In this tutorial we will learn how can we easy draw a picture in REALbasic ListBox control and how can we get the text from double clicked row or column in this control. So run REALbasic and start reading. Watch it, learn it, enjoy it!</p>
<p><span id="more-96"></span></p>
<div style="margin-left:19px;float:left">
<h2>ListBox Control Setup</h2>
<p>Add to your Window ListBox Control and set the DefaultRowHeight property value to 32. Next prepare a 32&#215;32 picture (called tutspolis) and drag it to your Project Tab. </p>
<p><img src="http://realbasic.tutspolis.com/files/tutorials/listboxpicture/pictureinlistbox1.png" alt="Add a picture to REALbasic Project Tab" /></p>
<h2>Adding text to ListBox control</h2>
<p>In code editor go to ListBox Sub Open () and insert this code:</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
4
5
6
7
8
9
10
</pre></td><td class="code"><pre class="vb" style="font-family:monospace;"><span style="color: #000080;">Dim</span> i <span style="color: #000080;">As</span> <span style="color: #000080;">Integer</span>
&nbsp;
<span style="color: #000080;">for</span> i = 1 <span style="color: #000080;">to</span> 5
  ListBox1.AddFolder <span style="color: #800000;">&quot;REALbasic City&quot;</span>
  ListBox1.Cell(Me.LastIndex, 1) = <span style="color: #800000;">&quot;F&quot;</span>
  ListBox1.AddFolder <span style="color: #800000;">&quot;REALbasic City 2&quot;</span>
  ListBox1.Cell(Me.LastIndex, 1) = <span style="color: #800000;">&quot;F&quot;</span>
<span style="color: #000080;">next</span>
&nbsp;
 Me.ColumnAlignmentOffset(0)= 35</pre></td></tr></table></div>

<h2>Drawing a graphic in ListBox</h2>
<p>In REALbasic code editor go to ListBox Function CellTextPaint () and use this code:</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
4
5
6
7
</pre></td><td class="code"><pre class="vb" style="font-family:monospace;"><span style="color: #000080;">if</span> column = 0 <span style="color: #000080;">then</span>
  <span style="color: #000080;">if</span> Me.cell(row,1) = <span style="color: #800000;">&quot;F&quot;</span> <span style="color: #000080;">then</span>
     g.DrawPicture(tutspolis,2,2)
  <span style="color: #000080;">else</span>
     g.DrawString <span style="color: #800000;">&quot;Fake Line&quot;</span>, 29,9
   <span style="color: #000080;">end</span> <span style="color: #000080;">if</span>
<span style="color: #000080;">end</span> <span style="color: #000080;">if</span></pre></td></tr></table></div>

<h2>ListBox DoubleClick event</h2>
<p>Using this code in the ListBox Sub DoubleClick () event you can get the string, number of the cell, row that was double-clicked.</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
4
5
6
</pre></td><td class="code"><pre class="vb" style="font-family:monospace;"><span style="color: #000080;">Dim</span> row, column <span style="color: #000080;">As</span> <span style="color: #000080;">Integer</span>
&nbsp;
row=Me.RowFromXY(System.MouseX - Me.Left - Self.Left, System.MouseY - Me.Top - Self.Top)
column=Me.ColumnFromXY(System.MouseX - Me.Left - Self.Left, System.MouseY - Me.Top - Self.Top)
&nbsp;
MsgBox <span style="color: #800000;">&quot;You double-clicked on &quot;</span>+ Me.list(row)</pre></td></tr></table></div>

<p><img src="http://realbasic.tutspolis.com/files/tutorials/listboxpicture/pictureinlistbox.png" alt="draw a picture in realbasic list box" /></p>
</div>
]]></content:encoded>
			<wfw:commentRss>http://realbasic.tutspolis.com/tutorials/drawing-a-picture-in-realbasic-listbox-control/feed/</wfw:commentRss>
		<slash:comments>5</slash:comments>
		</item>
		<item>
		<title>Drop Shadow effect in REALbasic</title>
		<link>http://realbasic.tutspolis.com/tutorials/drop-shadow-effect-in-realbasic/</link>
		<comments>http://realbasic.tutspolis.com/tutorials/drop-shadow-effect-in-realbasic/#comments</comments>
		<pubDate>Wed, 30 Sep 2009 23:08:37 +0000</pubDate>
		<dc:creator>Jakub Pawlak</dc:creator>
				<category><![CDATA[Tutorials]]></category>
		<category><![CDATA[blending options]]></category>
		<category><![CDATA[canvas]]></category>
		<category><![CDATA[drop shadow]]></category>
		<category><![CDATA[picture]]></category>
		<category><![CDATA[realbasic]]></category>
		<category><![CDATA[save picture]]></category>
		<category><![CDATA[saveasjpeg]]></category>

		<guid isPermaLink="false">http://realbasic.tutspolis.com/?p=84</guid>
		<description><![CDATA[<!-- isPostPurchased ,postID 84, userID 0, combination 1 -->
			
				
			
		
This tutorial will teach you how can you create a simply drop shadow effect similar to Photoshop Blending Options called Drop Shadow. Of course its not the same technic but it will show you some ideas how can you make this effect. Watch it, learn it, enjoy it!


Creating the GUI
As usually we start creating our [...]]]></description>
			<content:encoded><![CDATA[<!-- isPostPurchased ,postID 84, userID 0, combination 1 --><div class="tweetmeme_button" style="float: right; margin-left: 10px;">
			<a href="http://api.tweetmeme.com/share?url=http%3A%2F%2Frealbasic.tutspolis.com%2Ftutorials%2Fdrop-shadow-effect-in-realbasic%2F"><br />
				<img src="http://api.tweetmeme.com/imagebutton.gif?url=http%3A%2F%2Frealbasic.tutspolis.com%2Ftutorials%2Fdrop-shadow-effect-in-realbasic%2F&amp;source=REALbasicCity&amp;style=normal" height="61" width="50" /><br />
			</a>
		</div>
<p>This tutorial will teach you how can you create a simply drop shadow effect similar to Photoshop Blending Options called Drop Shadow. Of course its not the same technic but it will show you some ideas how can you make this effect. Watch it, learn it, enjoy it!</p>
<p><span id="more-84"></span></p>
<div style="margin-left:19px;float:left">
<h2>Creating the GUI</h2>
<p>As usually we start creating our application from building the graphic interface in REAlbasic. Try to get something similar to picture below. If you have some problems please find on our site tutorial called REALbasic – Learning the interface on Mac, Windows and Linux and come back letter.</p>
<p><img src="http://realbasic.tutspolis.com/files/tutorials/blendingoptions/dropshadow.png" alt="canvas drop shadow" /></p>
<p>We have here 4 StaticText controls (Text, Shadow X position, Shadow Y position, Shadow Opacity), 1 TextField control, 3 Slider controls, 1 Canvas control (the white field) and 1 PushButton &#8211; Save file.</p>
<p>In Slider1, Slider2 and Slider3 change in Property panel LiveScroll option to active, and in Initial State enter this values: Minimum: -10, Value: 20, Maximum: 50.</p>
<h3>Displaying the text in Canvas</h3>
<p>First add a New Property (create a global declaration) and type in Declaration p and in As Picture. Now go to TextField1 Sub TextChange() and insert this code:</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
4
5
6
7
</pre></td><td class="code"><pre class="vb" style="font-family:monospace;">Canvas1.Refresh // refreshing Canvas when typing
&nbsp;
p = <span style="color: #000080;">New</span> Picture (400,400,32) //creating <span style="color: #000080;">new</span> picture (width, height, depth)
p.Graphics.ForeColor = RGB(1,1,1) //making text color <span style="color: #000080;">to</span> black
p.Graphics.DrawString (TextField1.text,20,20,400) //drawing text
&nbsp;
Canvas1.Backdrop = p // loading the picture from memory <span style="color: #000080;">to</span> Canvas1</pre></td></tr></table></div>

<p>Now when we will put something in our Text field the Canvas1 will show in real time the result.</p>
<h2>Creating drop shadow effect</h2>
<p>On Wikipedia you can find information that shadow is an area where direct light from a light source cannot reach due to obstruction by an object. It occupies all of the space behind an opaque object with light in front of it. The cross section of a shadow is a two-dimensional silhouette, or reverse projection of the object blocking the light.</p>
<p>We can say simplifying that shadow or drop shadow effect is a reflect of a object, in our case reflect of some text. The way to get this kind of effect is duplicating the object and putting it in other X and Y position. Of course if we wont have more realistic results we should create other opacity for the shadow too. Opacity can be simply other hue of the original color.</p>
<p>On Slider1 at Shadow X position go to Sub ValueChanger () in Code Editor and insert the code:</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
4
5
6
7
8
9
10
11
</pre></td><td class="code"><pre class="vb" style="font-family:monospace;">Canvas1.Refresh  //refreshing Canvas when changing value
&nbsp;
p = <span style="color: #000080;">New</span> Picture (400,400,32)
p.Graphics.ForeColor = RGB(Slider3.Value+126,Slider3.Value+126,Slider3.Value+126) 
//generating color <span style="color: #000080;">for</span> shadow text (silver <span style="color: #000080;">like</span> color)
p.Graphics.DrawString (TextField1.Text,Slider1.Value,Slider2.Value,400)
//drawing shadow text beneath the text (text <span style="color: #000080;">string</span>, X position, Y position, width)
p.Graphics.ForeColor = RGB(1,1,1)
p.Graphics.DrawString (TextField1.text,20,20,220) //drawing text
&nbsp;
Canvas1.Backdrop = p //displaying the text <span style="color: #000080;">with</span> shadow</pre></td></tr></table></div>

<p>Duplicate the code in Slider 2 (Shadow Y position) and Slider 3 (Shadow opacity) too (Sub ValueChanger ()). The opacity goes smaller when the Slider3.Value goes right. In our example the difference between the min a max opacity values isn&#8217;t so big. Try to experiment with the min a max values to see better changes. PS. If you like you can make a method, we have learned this earlier, and call it in only one line in our slider controls. In this way you code can be smaller for some 18 lines.</p>
<h2>Saving Picture (Canvas) to JPEG file</h2>
<p>The last thing we will make today is saving our graphics displayed in Canvas or better say kept in memory Picture to a JPG file on our Desktop. We can do this in 3 lines&#8230;</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
4
</pre></td><td class="code"><pre class="vb" style="font-family:monospace;"> <span style="color: #000080;">Dim</span> f <span style="color: #000080;">As</span> FolderItem //class objects represent files, applications, <span style="color: #000080;">or</span> folders
&nbsp;
 f=SpecialFolder.Desktop.Child(<span style="color: #800000;">&quot;test.jpg&quot;</span>) //getting info where <span style="color: #000080;">is</span> our desktop <span style="color: #000080;">and</span> indicate the file <span style="color: #000080;">to</span> save
 f.SaveAsJPEG p //saving the file <span style="color: #000080;">to</span> JPEG format</pre></td></tr></table></div>

<h2>Like this tutorial?</h2>
<p>If you like this or other tutorials please write a comment or simply click on retweet button and share it with others. Please have in mind that when our community will grow REALbasic City will offer more and better tutorials for everyone for free!</p>
</div>
]]></content:encoded>
			<wfw:commentRss>http://realbasic.tutspolis.com/tutorials/drop-shadow-effect-in-realbasic/feed/</wfw:commentRss>
		<slash:comments>8</slash:comments>
		</item>
	</channel>
</rss>
