Kamis, 26 Maret 2020

SMALL Basic - Picture to punctuation convertion

You know you can make

I want to make a black and white image to have punctuation or other characters in the black pixels.

'GraphicsWindow.FontSize = 10
'GraphicsWindow.FontName =
wide = 5
GraphicsWindow.FontSize = wide
GraphicsWindow.DrawImage("C:\Users\Totardo\Downloads\flower-black-a-white-pattern-vector-224732.jpg",0,0)
For i = 0 To 1080 Step wide
  For j = 0 To 823 Step wide
    black_count = 0
    For k = 0 To wide
      For l = 0 To wide
        'GraphicsWindow.FillEllipse(i+k,j+l,1,1)
        test[i+k][j+l]=GraphicsWindow.GetPixel(i+k,j+l)
        pc = GraphicsWindow.GetPixel(i+k,j+l)
        TextWindow.WriteLine(i+k+","+j+l+","+pc)
        If pc <> "#FFFFFF" Then
          'TextWindow.WriteLine("Not pure white")
          black_count = black_count + 1
          'TextWindow.WriteLine("black_count is:" + black_count)
          'Program.Delay(1000)
        EndIf
     
      EndFor
    EndFor
    If black_count >= (wide/2*wide/2) Then
      TextWindow.WriteLine("black count: " + black_count)
      'Program.Delay(1000)
      'GraphicsWindow.DrawRectangle(i,j,20,20)
      paint_new[i+k][j+l]="?"
      'ts = Shapes.AddText("?")
      'Shapes.Move(ts,i,j)
    Else
      paint_new[i+k][j+l]=" "
      EndIf
  EndFor
EndFor

Sub aloha
For i = 0 To array.GetItemCount(test[i])
  For j = 0 To Array.GetItemCount(test[j])
    GraphicsWindow.BrushColor = test[i][j]
    GraphicsWindow.FillEllipse(i,j,1,1)
  EndFor
EndFor
EndSub

GraphicsWindow.Clear()

For i = 0 To 200
  For j = 0 To 200
    GraphicsWindow.DrawText(i,j,paint_new[i][j])
  EndFor
EndFor

  

Tidak ada komentar:

Posting Komentar