reading pixel value

Spezielle Fragen zu 2D- und 3D-Grafik, Sound und Video
Antworten
sony
Foriker
Beiträge: 8
Registriert: Mi 14. Jun 2017, 04:49
Kontaktdaten:

reading pixel value

Beitrag von sony » Fr 29. Sep 2017, 10:03

Hello,
I start gambas example with name MyWebCam project and running.
How to read value of pixel color in drawingarea ?
thank you

Sony

vuott
Foriker
Beiträge: 73
Registriert: Fr 16. Jan 2015, 01:27
Kontaktdaten:

Re: reading pixel value

Beitrag von vuott » Sa 30. Sep 2017, 00:39

sony hat geschrieben:
Fr 29. Sep 2017, 10:03
How to read value of pixel color in drawingarea ?
A way (only Gambas resources) could be: :|
gambas code
Public Sub Form_Open()
 
 With DrawingArea1
   .Background = Color.White
   .W = 300
   .H = 40
 End With
  
End


Public Sub DrawingArea1_Draw()
 
 Dim c As Integer[] = [Color.Blue, Color.Green, Color.Yellow, Color.Red]
 Dim p As Float[] = [0, 0.34, 0.67, 1]
  
  With Paint
    .Brush = .LinearGradient(0, 0, DrawingArea1.W, DrawingArea1.H, c, p)
    .Rectangle(0, 0, DrawingArea1.W, DrawingArea1.H)
    .Fill
   .End
  End With
  
End


Public Sub Button1_Click()
 
 Dim pc As Picture
 Dim n As Integer
  
  pc = Desktop.Screenshot(DrawingArea1.ScreenX, DrawingArea1.ScreenY, DrawingArea1.Width, DrawingArea1.Height)
   
  For n = 0 To pc.Image.Pixels.Max
    Print Hex(pc.Image.Pixels[n], 8)
  Next
  
End

sony
Foriker
Beiträge: 8
Registriert: Mi 14. Jun 2017, 04:49
Kontaktdaten:

Re: reading pixel value

Beitrag von sony » Mo 2. Okt 2017, 01:08

Hello,
Thank you very much for your help.

regards

Sony

Antworten

Wer ist online?

Mitglieder in diesem Forum: 0 Mitglieder und 1 Gast