Of course. There are many examples online, here is my .htaccess:
RewriteEngine on
RewriteCond %{HTTP_REFERER} !^$
RewriteCond %{HTTP_REFERER} !^http://(albert|www)\.rierol\.net/.*$ [NC]
RewriteRule \.(jpg|png|jpeg|gif)$ - [F]
Means:
Line 1: switch on.
Line 2: calling page can't be nothing.
Line 3: calling page can't be anything other than my own (sub)domains.
Line 4: if the file has an image extension, then fail.