dbTalk Databases Forums  

Rotated Labels or TextBoxes

comp.databases.ms-access comp.databases.ms-access


Discuss Rotated Labels or TextBoxes in the comp.databases.ms-access forum.



Reply
 
Thread Tools Display Modes
  #21  
Old   
Phil
 
Posts: n/a

Default Re: Rotated Labels or TextBoxes - 03-23-2011 , 07:37 AM






On 22/03/2011 14:07:09, "christianlott1 (AT) yahoo (DOT) com" wrote:
Quote:
Thanks again. At least Imagemagick is now working
So I will wade through the instructions and see if I can fathom transparent
labels. Is your suggestion then to create a transparent image containing the
boat and owner name at the correct size and angle, then use that as the
picture in an image control, then drag the image round to the correct spot.
If the angle is incorrect, then I click on the image, redifine the angle and
use ImageMagick to create a new image. Given that the Boatnameand person's
name is in a field called "SpaceAndName" and the angle is "LabelAngle" and
that I am using Arial 10pt and that although the height of the label should
be constant to fit the 10pt Arial, the length will vary possibly by a factor
of 3 to accomodate the different "SpaceAndName" data, could you help me with
the precise command. I presume the output file will be a Png or Gif. Are
there any advantages of one type or the other. Many thanks again for your
patience Phil

Not sure. I have only used IM for jpg conversions. I know it's also
used inside Inkscape, maybe the svg to png conversion. Since I've also
gotten transparent rotated text images using that process, I imagine
it can be done with either the :label parameter or the -draw command.
To convert svg to png is as simple as:

convert -size 300x300 +antialias a.svg a.png

I think you can cause transparent background with 'xc:none'

http://www.imagemagick.org/Usage/draw

I'll play around with it again today when I get the chance. Good luck!



ref links:
http://potrace.sourceforge.net/
http://en.wikipedia.org/wiki/Compari...rsion_software
Hi Christian

Progress at last

This creates a label OK

Sub CreateImage()

Dim sCmd As String
Dim sFileOUT As String
Dim sGO As String
Dim ProgPath As String, DataPath As String, PicPath As String

ProgPath = "C:\Program Files (X86)\ImageMagick\"
DataPath = "C:\Phil Data\Access\MDB 2010\WFYC\Odd Jpegs"

sCmd = ProgPath
sCmd = sCmd & "convert -rotate -45 -background transparent "
sCmd sCmd = sCmd & "-size 2000x -font 'Arial' -pointsize 96 label:Philip
-trim +repage "

ChDir hDir (DataPath) ' Imagemagick does not understand paths

sFileOUT = "draw12.png"
If Dir(sFileOUT) > "" Then
Kill sFileOUT
End If

sGO = sCmd & sFileOUT
Call ShellWait(sGO, vbMaximizedFocus)

PicPath = DataPath & "\" & sFileOUT
Space01.Picture = PicPath
Space02.Picture = PicPath
Space03.Picture = PicPath

Me.Repaint

End Sub

and I am then loading the same draw12.png as a picture into 3 image objects
(Space01, 02 and 03).

Now the work starts to create the right data for the 100 odd pngs and then
load the correct pngs into the right images.

You really did get me moving on this one, as I was completely stumped

Thanks again

Phil

Reply With Quote
  #22  
Old   
christianlott1@yahoo.com
 
Posts: n/a

Default Re: Rotated Labels or TextBoxes - 03-23-2011 , 08:31 AM






Quote:
* * sCmd = sCmd & "convert -rotate -45 -background transparent *"
sCmd = sCmd & "-size 2000x -font 'Arial' -pointsize 96 label:Philip
-trim +repage "
Great! Glad you got it to work, there's a lot of documentation and a
lot of options. I'm sure you saw the 'montage' command which I
imagined you may put to use combining the labels with the boat images.
In the docs somewhere it says you can use brackets and numbers to
force IM to loop : ( [2-20].jpg ) but that never worked for me, hence
the VB loop and ShellWait. If you're just executing one command
without a loop I suspect you don't need the ShellWait and can just use
'Shell'.


Quote:
ChDir (DataPath) ' Imagemagick does not understand paths
Yep. I think it's the spaces in the pathname?


Quote:
and I am then loading the same draw12.png as a picture into 3 image objects
(Space01, 02 and 03).

Now the work starts to create the right data for the 100 odd pngs and then
load the correct pngs into the right images.

You really did get me moving on this one, as I was completely stumped

Thanks again

Phil
I think there's a line length limit with the Shell/ShellWait commands
that you don't run into with WSH - but that's something I read, not
something I've experienced yet.

There should have been an easier way than this, some DirectX or gdi
graphics primitive that rotates a transparent bitmap but with my
limited experience this seemed the path of least resistance.


Here are a few links from searching:

Create a bitmap in memory and draw text on it
http://www.vb-helper.com/howto_memory_bitmap_text.html

VB projects - Text-to-image converter
http://www.ostrosoft.com/vb/projects...mage/index.asp

HOWTO: Rotate a Bitmap in Visual Basic for Windows
http://support.microsoft.com/kb/80406


Good luck! Keep us posted!

Reply With Quote
  #23  
Old   
christianlott1@yahoo.com
 
Posts: n/a

Default Re: Rotated Labels or TextBoxes - 03-23-2011 , 09:53 AM



Found this article on DirectX7 if you can add a reference to 'DirectX
7 Visual Basic Type Library':

http://msdn.microsoft.com/en-us/libr...8VS.60%29.aspx

Haven't tried it yet. To use you'd want to drop in a VB 2.0 Frame
Control (ActiveX), get the hWnd by using Frame1.SetFocus and the
'GotFocus' api.

Reply With Quote
  #24  
Old   
Phil
 
Posts: n/a

Default Re: Rotated Labels or TextBoxes - 03-23-2011 , 05:50 PM



On 23/03/2011 15:53:51, "christianlott1 (AT) yahoo (DOT) com" wrote:
Quote:
Found this article on DirectX7 if you can add a reference to 'DirectX
7 Visual Basic Type Library':

http://msdn.microsoft.com/en-us/libr...8VS.60%29.aspx

Haven't tried it yet. To use you'd want to drop in a VB 2.0 Frame
Control (ActiveX), get the hWnd by using Frame1.SetFocus and the
'GotFocus' api.

Hi Christian, I'm stuck again
Thought I had cracked it. In the example I gave above, that worked OK.
If however the Label has a space in it e.g. "Philip Stanton" only the Philip
part is generated. Other interesting things like reducing the pointsize from
96 to 12, gives the same size image, but blurred. I need to produce constant
height labels with a fixed font, so it's OK for their width to vary according
to the length of the label

Any ideas

Thanks

Phil

Reply With Quote
  #25  
Old   
Phil
 
Posts: n/a

Default Re: Rotated Labels or TextBoxes - 03-24-2011 , 04:11 AM



On 23/03/2011 23:50:55, "Phil" wrote:
Quote:
On 23/03/2011 15:53:51, "christianlott1 (AT) yahoo (DOT) com" wrote:
Found this article on DirectX7 if you can add a reference to 'DirectX
7 Visual Basic Type Library':

http://msdn.microsoft.com/en-us/libr...8VS.60%29.aspx

Haven't tried it yet. To use you'd want to drop in a VB 2.0 Frame
Control (ActiveX), get the hWnd by using Frame1.SetFocus and the
'GotFocus' api.

Hi Christian, I'm stuck again
Thought I had cracked it. In the example I gave above, that worked OK.
If however the Label has a space in it e.g. "Philip Stanton" only the
Philip part is generated. Other interesting things like reducing the
pointsize from 96 to 12, gives the same size image, but blurred. I need to
produce constant height labels with a fixed font, so it's OK for their
width to vary according to the length of the label

Any ideas

Thanks

Phil

Cracked the space in the name problem. ImageMagick doesn't understand single
quotes 'Anthony Stanton'

needs

sCmd = ProgPath
sCmd = sCmd & "convert -rotate -45 -background transparent "
sCmd = sCmd & " -trim +repage -font 'Arial' -pointsize 48 label:"
sCmd = sCmd & Chr$(34) & "Anthony Stanton" & Chr$(34) & " "

Still playing with font size

Phil

Reply With Quote
Reply




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Powered by vBulletin Version 3.5.3
Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.