@ -191,21 +191,68 @@
assume any function with a "*Spec" type as a parameter will use this " t e m p "
file. * )
let drawBrushSpecGrid (spec: BrushSpec) =
let drawBrushSpecGrid (spec: BrushSpec) (greyScale: bool) =
use original = Bitmap.FromFile s p e c . o r i g i n a l P a t h
use temp = new B i t m a p ( o r i g i n a l )
use clone =
temp.Clone(new Rectangle(0, 0 , temp.Width, temp.Height), P i x e l F o r m a t . F o r m a t 32 b p p A r g b )
use graphics = G r a p h i c s . F r o m I m a g e ( c l o n e )
use pen = new Pen (spec.colour, width = s p e c . p e n W i d t h )
graphics.DrawImage(original,new Rectangle(0, 0 , clone.Width, c l o n e . H e i g h t ) )
let horizontalLines =
createHorizontalLines (clone.Size.Width) (clone.Size.Height) ( s p e c . r o w s )
let verticalLines =
createVerticalLines (clone.Size.Width) (clone.Size.Height) ( s p e c . c o l u m n s )
for line in horizontalLines do graphics.DrawLines (pen, l i n e )
for line in verticalLines do graphics.DrawLines (pen, l i n e )
clone.Save ( s p e c . s a v e P a t h )
//use clone =
// temp.Clone(new Rectangle(0, 0 , temp.Width, temp.Height), P i x e l F o r m a t . F o r m a t 32 b p p A r g b )
// The orignial is a b o v e ...
if greyScale = true t h e n
use temp1 = new Bitmap(original.Width, o r i g i n a l . H e i g h t )
use g = G r a p h i c s . F r o m I m a g e ( t e m p 1 )
let aM: float32[][] = [ |
[| (float32 0 .3 ); (float32 0 .3 ); (float32 0 .3 ); (float32 0 .0 ); (float32 0 .0 ) | ] ;
[| (float32 0 .59 ); (float32 0 .59 ); (float32 0 .59 ); (float32 0 .0 ); (float32 0 .0 ) | ] ;
[| (float32 0 .11 ); (float32 0 .11 ); (float32 0 .11 ); (float32 0 .0 ); (float32 0 .0 ) | ] ;
[| (float32 0 .0 ); (float32 0 .0 ); (float32 0 .0 ); (float32 1 .0 ); (float32 0 .0 ) | ] ;
[| (float32 0 .0 ); (float32 0 .0 ); (float32 0 .0 ); (float32 0 .0 ); (float32 1 .0 ) | ] ;
| ]
let colourMatrix = new C o l o r M a t r i x ( a M )
use attributes = new I m a g e A t t r i b u t e s ( )
a t t r i b u t e s . S e t C o l o r M a t r i x ( c o l o u r M a t r i x )
g.DrawImage(temp, new Rectangle(0, 0 , temp.Width, t e m p . H e i g h t ) ,
0 , 0 , temp.Width, temp.Height, GraphicsUnit.Pixel, a t t r i b u t e s )
// use clone = t e m p 1
use graphics = G r a p h i c s . F r o m I m a g e ( t e m p 1 )
use pen = new Pen (spec.colour, width = s p e c . p e n W i d t h )
graphics.DrawImage(temp1 ,new Rectangle(0, 0 , temp1.Width, t e m p 1 . H e i g h t ) )
let horizontalLines =
createHorizontalLines (temp1.Size.Width) (temp1.Size.Height) ( s p e c . r o w s )
let verticalLines =
createVerticalLines (temp1.Size.Width) (temp1.Size.Height) ( s p e c . c o l u m n s )
for line in horizontalLines do graphics.DrawLines (pen, l i n e )
for line in verticalLines do graphics.DrawLines (pen, l i n e )
temp1.Save ( s p e c . s a v e P a t h )
e l s e
use clone = temp.Clone(new Rectangle(0, 0 , temp.Width, temp.Height), P i x e l F o r m a t . F o r m a t 32 b p p A r g b )
use graphics = G r a p h i c s . F r o m I m a g e ( c l o n e )
use pen = new Pen (spec.colour, width = s p e c . p e n W i d t h )
graphics.DrawImage(original,new Rectangle(0, 0 , clone.Width, c l o n e . H e i g h t ) )
let horizontalLines =
createHorizontalLines (clone.Size.Width) (clone.Size.Height) ( s p e c . r o w s )
let verticalLines =
createVerticalLines (clone.Size.Width) (clone.Size.Height) ( s p e c . c o l u m n s )
for line in horizontalLines do graphics.DrawLines (pen, l i n e )
for line in verticalLines do graphics.DrawLines (pen, l i n e )
clone.Save ( s p e c . s a v e P a t h )
// The original is b e l o w ...
//use graphics = G r a p h i c s . F r o m I m a g e ( c l o n e )
//use pen = new Pen (spec.colour, width = s p e c . p e n W i d t h )
//graphics.DrawImage(original,new Rectangle(0, 0 , clone.Width, c l o n e . H e i g h t ) )
//let horizontalLines =
// createHorizontalLines (clone.Size.Width) (clone.Size.Height) ( s p e c . r o w s )
//let verticalLines =
// createVerticalLines (clone.Size.Width) (clone.Size.Height) ( s p e c . c o l u m n s )
//for line in horizontalLines do graphics.DrawLines (pen, l i n e )
//for line in verticalLines do graphics.DrawLines (pen, l i n e )
//clone.Save ( s p e c . s a v e P a t h )
let drawRGBAGrid (spec: RGBASpec) =
use original = Bitmap.FromFile s p e c . o r i g i n a l P a t h