Craig Oates
6 years ago
14 changed files with 41 additions and 293 deletions
@ -0,0 +1,25 @@
|
||||
|
||||
Microsoft Visual Studio Solution File, Format Version 12.00 |
||||
# Visual Studio 15 |
||||
VisualStudioVersion = 15.0.28010.2016 |
||||
MinimumVisualStudioVersion = 10.0.40219.1 |
||||
Project("{F2A71F9B-5D33-465A-A702-920D77279786}") = "SmoulderingBeachBall", "SmoulderingBeachBall\SmoulderingBeachBall.fsproj", "{DFC3CBCA-3DA7-4CF4-A8BC-BCCB740FA6CD}" |
||||
EndProject |
||||
Global |
||||
GlobalSection(SolutionConfigurationPlatforms) = preSolution |
||||
Debug|Any CPU = Debug|Any CPU |
||||
Release|Any CPU = Release|Any CPU |
||||
EndGlobalSection |
||||
GlobalSection(ProjectConfigurationPlatforms) = postSolution |
||||
{DFC3CBCA-3DA7-4CF4-A8BC-BCCB740FA6CD}.Debug|Any CPU.ActiveCfg = Debug|Any CPU |
||||
{DFC3CBCA-3DA7-4CF4-A8BC-BCCB740FA6CD}.Debug|Any CPU.Build.0 = Debug|Any CPU |
||||
{DFC3CBCA-3DA7-4CF4-A8BC-BCCB740FA6CD}.Release|Any CPU.ActiveCfg = Release|Any CPU |
||||
{DFC3CBCA-3DA7-4CF4-A8BC-BCCB740FA6CD}.Release|Any CPU.Build.0 = Release|Any CPU |
||||
EndGlobalSection |
||||
GlobalSection(SolutionProperties) = preSolution |
||||
HideSolutionNode = FALSE |
||||
EndGlobalSection |
||||
GlobalSection(ExtensibilityGlobals) = postSolution |
||||
SolutionGuid = {78F0A77D-F78C-476F-A7C5-64E5579E9EB4} |
||||
EndGlobalSection |
||||
EndGlobal |
@ -0,0 +1,5 @@
|
||||
namespace SmoulderingBeachBall |
||||
|
||||
module Say = |
||||
let hello name = |
||||
printfn "Hello %s" name |
@ -0,0 +1,11 @@
|
||||
<Project Sdk="Microsoft.NET.Sdk"> |
||||
|
||||
<PropertyGroup> |
||||
<TargetFramework>netstandard2.0</TargetFramework> |
||||
</PropertyGroup> |
||||
|
||||
<ItemGroup> |
||||
<Compile Include="Library.fs" /> |
||||
</ItemGroup> |
||||
|
||||
</Project> |
@ -1,31 +0,0 @@
|
||||
|
||||
Microsoft Visual Studio Solution File, Format Version 12.00 |
||||
# Visual Studio 15 |
||||
VisualStudioVersion = 15.0.28010.2016 |
||||
MinimumVisualStudioVersion = 10.0.40219.1 |
||||
Project("{F2A71F9B-5D33-465A-A702-920D77279786}") = "SmoulderingBeachBall", "SmoulderingBeachBall\SmoulderingBeachBall.fsproj", "{279C546F-588A-4343-9E11-8EB21188DA70}" |
||||
EndProject |
||||
Project("{F2A71F9B-5D33-465A-A702-920D77279786}") = "SmoulderingBeachBallCLI", "SmoulderingBeachBallCLI\SmoulderingBeachBallCLI.fsproj", "{F3027063-706C-442F-8C88-11A33E8EA222}" |
||||
EndProject |
||||
Global |
||||
GlobalSection(SolutionConfigurationPlatforms) = preSolution |
||||
Debug|Any CPU = Debug|Any CPU |
||||
Release|Any CPU = Release|Any CPU |
||||
EndGlobalSection |
||||
GlobalSection(ProjectConfigurationPlatforms) = postSolution |
||||
{279C546F-588A-4343-9E11-8EB21188DA70}.Debug|Any CPU.ActiveCfg = Debug|Any CPU |
||||
{279C546F-588A-4343-9E11-8EB21188DA70}.Debug|Any CPU.Build.0 = Debug|Any CPU |
||||
{279C546F-588A-4343-9E11-8EB21188DA70}.Release|Any CPU.ActiveCfg = Release|Any CPU |
||||
{279C546F-588A-4343-9E11-8EB21188DA70}.Release|Any CPU.Build.0 = Release|Any CPU |
||||
{F3027063-706C-442F-8C88-11A33E8EA222}.Debug|Any CPU.ActiveCfg = Debug|Any CPU |
||||
{F3027063-706C-442F-8C88-11A33E8EA222}.Debug|Any CPU.Build.0 = Debug|Any CPU |
||||
{F3027063-706C-442F-8C88-11A33E8EA222}.Release|Any CPU.ActiveCfg = Release|Any CPU |
||||
{F3027063-706C-442F-8C88-11A33E8EA222}.Release|Any CPU.Build.0 = Release|Any CPU |
||||
EndGlobalSection |
||||
GlobalSection(SolutionProperties) = preSolution |
||||
HideSolutionNode = FALSE |
||||
EndGlobalSection |
||||
GlobalSection(ExtensibilityGlobals) = postSolution |
||||
SolutionGuid = {B5BDCF9E-3DC2-4A57-91F3-62EFADB6BEF0} |
||||
EndGlobalSection |
||||
EndGlobal |
@ -1,34 +0,0 @@
|
||||
namespace SmoulderingBeachBall |
||||
|
||||
module ImageMaker = |
||||
|
||||
open System |
||||
open System.Drawing |
||||
open System.IO |
||||
|
||||
let private validateDimension dimension = |
||||
match dimension with |
||||
| dimension when dimension <= 0 -> invalidArg "dimension" "The width and height must be greater than 0." |
||||
| _ -> () |
||||
|
||||
let private validateDirectory filePath = |
||||
let path = Path.GetDirectoryName filePath |
||||
match (Directory.Exists path) with |
||||
| false -> invalidArg "filePath" "Unable to save to the specified location because it does not exist." |
||||
| true -> () |
||||
|
||||
let makeImage width height colour filepath = |
||||
async { |
||||
try |
||||
validateDimension width |
||||
validateDimension height |
||||
validateDirectory filepath |
||||
use bitmap = new Bitmap(width, height) |
||||
use graphics = Graphics.FromImage(bitmap) |
||||
graphics.FillRectangle(colour, new Rectangle(0, 0, bitmap.Width, bitmap.Height)) |
||||
bitmap.Save(filepath) |
||||
return "Image saved." |
||||
with |
||||
| :? ArgumentException as ex -> return ex.Message |
||||
| _ as ex -> return ex.Message |
||||
} |
@ -1,28 +0,0 @@
|
||||
#load "ImageMaker.fs" |
||||
|
||||
open System.Drawing |
||||
open System.Drawing.Imaging |
||||
open SmoulderingBeachBall |
||||
|
||||
// INITIAL IDEA ======================================================================================================= |
||||
|
||||
let width = 500 |
||||
let height = 500 |
||||
let colour = Brushes.BurlyWood |
||||
let testPath = "C:/users/craig/desktop/test.png" |
||||
let draw () = |
||||
use bmp = new Bitmap(width, height) |
||||
use gr = Graphics.FromImage(bmp) |
||||
gr.FillRectangle(colour, new Rectangle(0, 0, bmp.Width, bmp.Height)) |
||||
gr.DrawImage(bmp, 0, 0) |
||||
bmp.Save(testPath, ImageFormat.Png) |
||||
|
||||
// IMAGE MAKER ======================================================================================================== |
||||
|
||||
let im_width = 500 |
||||
let im_height = 500 |
||||
let im_colour = Brushes.BurlyWood |
||||
let im_testPath = "C:/users/craig/desktop/test.png" |
||||
|
||||
ImageMaker.makeImage im_width im_height im_colour im_testPath |
||||
|> Async.RunSynchronously |
@ -1,16 +0,0 @@
|
||||
<Project Sdk="Microsoft.NET.Sdk"> |
||||
|
||||
<PropertyGroup> |
||||
<TargetFramework>netstandard2.0</TargetFramework> |
||||
</PropertyGroup> |
||||
|
||||
<ItemGroup> |
||||
<Compile Include="ImageMaker.fs" /> |
||||
<None Include="ScratchPad.fsx" /> |
||||
</ItemGroup> |
||||
|
||||
<ItemGroup> |
||||
<PackageReference Include="Microsoft.Windows.Compatibility" Version="2.0.1" /> |
||||
</ItemGroup> |
||||
|
||||
</Project> |
@ -1,6 +0,0 @@
|
||||
<?xml version="1.0" encoding="utf-8" ?> |
||||
<configuration> |
||||
<startup> |
||||
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.7.1" /> |
||||
</startup> |
||||
</configuration> |
@ -1,41 +0,0 @@
|
||||
namespace SmoulderingBeachBallCLI.AssemblyInfo |
||||
|
||||
open System.Reflection |
||||
open System.Runtime.CompilerServices |
||||
open System.Runtime.InteropServices |
||||
|
||||
// General Information about an assembly is controlled through the following |
||||
// set of attributes. Change these attribute values to modify the information |
||||
// associated with an assembly. |
||||
[<assembly: AssemblyTitle("SmoulderingBeachBallCLI")>] |
||||
[<assembly: AssemblyDescription("")>] |
||||
[<assembly: AssemblyConfiguration("")>] |
||||
[<assembly: AssemblyCompany("")>] |
||||
[<assembly: AssemblyProduct("SmoulderingBeachBallCLI")>] |
||||
[<assembly: AssemblyCopyright("Copyright © 2018")>] |
||||
[<assembly: AssemblyTrademark("")>] |
||||
[<assembly: AssemblyCulture("")>] |
||||
|
||||
// Setting ComVisible to false makes the types in this assembly not visible |
||||
// to COM components. If you need to access a type in this assembly from |
||||
// COM, set the ComVisible attribute to true on that type. |
||||
[<assembly: ComVisible(false)>] |
||||
|
||||
// The following GUID is for the ID of the typelib if this project is exposed to COM |
||||
[<assembly: Guid("f3027063-706c-442f-8c88-11a33e8ea222")>] |
||||
|
||||
// Version information for an assembly consists of the following four values: |
||||
// |
||||
// Major Version |
||||
// Minor Version |
||||
// Build Number |
||||
// Revision |
||||
// |
||||
// You can specify all the values or you can default the Build and Revision Numbers |
||||
// by using the '*' as shown below: |
||||
// [<assembly: AssemblyVersion("1.0.*")>] |
||||
[<assembly: AssemblyVersion("1.0.0.0")>] |
||||
[<assembly: AssemblyFileVersion("1.0.0.0")>] |
||||
|
||||
do |
||||
() |
@ -1,15 +0,0 @@
|
||||
open SmoulderingBeachBall.ImageMaker |
||||
open System.Drawing |
||||
open System |
||||
|
||||
// Learn more about F# at http://fsharp.org |
||||
// See the 'F# Tutorial' project for more help. |
||||
|
||||
[<EntryPoint>] |
||||
let main argv = |
||||
printfn "%A" argv |
||||
let result = |
||||
makeImage 500 500 Brushes.PaleVioletRed "C:/users/craig/desktop/test.png" |
||||
|> Async.RunSynchronously |
||||
//Console.ReadLine |> ignore |
||||
0 // return an integer exit code |
@ -1,83 +0,0 @@
|
||||
<?xml version="1.0" encoding="utf-8"?> |
||||
<Project ToolsVersion="15.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> |
||||
<Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" /> |
||||
<PropertyGroup> |
||||
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration> |
||||
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform> |
||||
<SchemaVersion>2.0</SchemaVersion> |
||||
<ProjectGuid>f3027063-706c-442f-8c88-11a33e8ea222</ProjectGuid> |
||||
<OutputType>Exe</OutputType> |
||||
<RootNamespace>SmoulderingBeachBallCLI</RootNamespace> |
||||
<AssemblyName>SmoulderingBeachBallCLI</AssemblyName> |
||||
<TargetFrameworkVersion>v4.7.1</TargetFrameworkVersion> |
||||
<AutoGenerateBindingRedirects>true</AutoGenerateBindingRedirects> |
||||
<UseStandardResourceNames>true</UseStandardResourceNames> |
||||
<Name>SmoulderingBeachBallCLI</Name> |
||||
</PropertyGroup> |
||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' "> |
||||
<DebugSymbols>true</DebugSymbols> |
||||
<DebugType>full</DebugType> |
||||
<Optimize>false</Optimize> |
||||
<Tailcalls>false</Tailcalls> |
||||
<OutputPath>bin\$(Configuration)\</OutputPath> |
||||
<DefineConstants>DEBUG;TRACE</DefineConstants> |
||||
<WarningLevel>3</WarningLevel> |
||||
<PlatformTarget>AnyCPU</PlatformTarget> |
||||
<DocumentationFile>bin\$(Configuration)\$(AssemblyName).XML</DocumentationFile> |
||||
<Prefer32Bit>true</Prefer32Bit> |
||||
</PropertyGroup> |
||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' "> |
||||
<DebugType>pdbonly</DebugType> |
||||
<Optimize>true</Optimize> |
||||
<Tailcalls>true</Tailcalls> |
||||
<OutputPath>bin\$(Configuration)\</OutputPath> |
||||
<DefineConstants>TRACE</DefineConstants> |
||||
<WarningLevel>3</WarningLevel> |
||||
<PlatformTarget>AnyCPU</PlatformTarget> |
||||
<DocumentationFile>bin\$(Configuration)\$(AssemblyName).XML</DocumentationFile> |
||||
<Prefer32Bit>true</Prefer32Bit> |
||||
</PropertyGroup> |
||||
<PropertyGroup> |
||||
<MinimumVisualStudioVersion Condition="'$(MinimumVisualStudioVersion)' == ''">11</MinimumVisualStudioVersion> |
||||
</PropertyGroup> |
||||
<PropertyGroup Condition=" '$(FSharpTargetsPath)' == '' AND Exists('$(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v$(VisualStudioVersion)\FSharp\Microsoft.FSharp.Targets') "> |
||||
<FSharpTargetsPath>$(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v$(VisualStudioVersion)\FSharp\Microsoft.FSharp.Targets</FSharpTargetsPath> |
||||
</PropertyGroup> |
||||
<Import Project="$(FSharpTargetsPath)" /> |
||||
<ItemGroup> |
||||
<Compile Include="AssemblyInfo.fs" /> |
||||
<Compile Include="Program.fs" /> |
||||
<None Include="App.config" /> |
||||
<Content Include="packages.config" /> |
||||
</ItemGroup> |
||||
<ItemGroup> |
||||
<Reference Include="FSharp.Core"> |
||||
<HintPath>..\packages\FSharp.Core.4.5.2\lib\net45\FSharp.Core.dll</HintPath> |
||||
</Reference> |
||||
<Reference Include="mscorlib" /> |
||||
<Reference Include="System" /> |
||||
<Reference Include="System.Core" /> |
||||
<Reference Include="System.Drawing" /> |
||||
<Reference Include="System.Drawing.Common"> |
||||
<HintPath>..\packages\System.Drawing.Common.4.5.0\lib\net461\System.Drawing.Common.dll</HintPath> |
||||
</Reference> |
||||
<Reference Include="System.Numerics" /> |
||||
<Reference Include="System.ValueTuple"> |
||||
<Private>True</Private> |
||||
</Reference> |
||||
</ItemGroup> |
||||
<ItemGroup> |
||||
<ProjectReference Include="..\SmoulderingBeachBall\SmoulderingBeachBall.fsproj"> |
||||
<Name>SmoulderingBeachBall</Name> |
||||
<Project>{279c546f-588a-4343-9e11-8eb21188da70}</Project> |
||||
<Private>True</Private> |
||||
</ProjectReference> |
||||
</ItemGroup> |
||||
<!-- To modify your build process, add your task inside one of the targets below and uncomment it. |
||||
Other similar extension points exist, see Microsoft.Common.targets. |
||||
<Target Name="BeforeBuild"> |
||||
</Target> |
||||
<Target Name="AfterBuild"> |
||||
</Target> |
||||
--> |
||||
</Project> |
@ -1,6 +0,0 @@
|
||||
<?xml version="1.0" encoding="utf-8"?> |
||||
<packages> |
||||
<package id="FSharp.Core" version="4.5.2" targetFramework="net471" /> |
||||
<package id="System.Drawing.Common" version="4.5.0" targetFramework="net471" /> |
||||
<package id="System.ValueTuple" version="4.4.0" targetFramework="net471" /> |
||||
</packages> |
@ -1,13 +0,0 @@
|
||||
// Learn more about F# at http://fsharp.org |
||||
|
||||
open System |
||||
open SmoulderingBeachBall.ImageMaker |
||||
open System.Drawing |
||||
|
||||
[<EntryPoint>] |
||||
let main argv = |
||||
printfn "Hello World from F#!" |
||||
let result = |
||||
makeImage 500 500 Brushes.PaleVioletRed "C:/users/craig/desktop/test.png" |
||||
|> Async.RunSynchronously |
||||
0 // return an integer exit code |
@ -1,20 +0,0 @@
|
||||
<Project Sdk="Microsoft.NET.Sdk"> |
||||
|
||||
<PropertyGroup> |
||||
<OutputType>Exe</OutputType> |
||||
<TargetFramework>netcoreapp2.1</TargetFramework> |
||||
</PropertyGroup> |
||||
|
||||
<ItemGroup> |
||||
<Compile Include="Program.fs" /> |
||||
</ItemGroup> |
||||
|
||||
<ItemGroup> |
||||
<PackageReference Include="System.Drawing.Common" Version="4.5.0" /> |
||||
</ItemGroup> |
||||
|
||||
<ItemGroup> |
||||
<ProjectReference Include="..\SmoulderingBeachBall\SmoulderingBeachBall.fsproj" /> |
||||
</ItemGroup> |
||||
|
||||
</Project> |
Loading…
Reference in new issue