Verfasst: 17.06.2009 22:34
Mir wär der Deal auch recht^^
Hat sich eigentlich bei der G19 auch die Auflösung geändert?
Hat sich eigentlich bei der G19 auch die Auflösung geändert?
Als Alternative kanns Du auch MyLCD benutzen,dortHoto hat geschrieben: dass man sowohl das G15 bzw. G13 (selbes Display) ebenso wie die G19 in seinem Prog unterstützen kann.
Code: Alles auswählen
Procedure G15_MakeImage(Image, *bitmap.lgLcdBitmap160x43x1)
Protected A.l, x.l, y.l, w.l, h.l, d.l, Result.l, hDC, *bmi.BITMAPINFO, *Buffer
Protected *H1.BYTE, *H2.LONG
If IsImage(Image) = 0
ProcedureReturn #False
EndIf
w = ImageWidth(Image)
h = ImageHeight(Image)
d = 8 ; ImageDepth(Image) ;###### HIER IST DIE Änderung
If d <> 8 Or w > #LGLCD_BMP_WIDTH Or h > #LGLCD_BMP_HEIGHT
ProcedureReturn #False
EndIf
[...]
EndProcedure
Code: Alles auswählen
Procedure G15_MakeImage(Image, *bitmap.lgLcdBitmap160x43x1, Invers = 0)
Protected A, x, y, w, h, d, Result, hDC, *bmi.BITMAPINFO, *Buffer
Protected *HB.BYTE, *HW.WORD, *HL.LONG, *H2.LONG
If IsImage(Image) = 0
ProcedureReturn #False
EndIf
w = ImageWidth(Image)
h = ImageHeight(Image)
d = ImageDepth(Image)
; If w > #LGLCD_BMP_WIDTH Or h > #LGLCD_BMP_HEIGHT
; ProcedureReturn #False
; EndIf
; fix widths and heights
If d = 1
d = 8
EndIf
If w > #LGLCD_BMP_WIDTH
w = #LGLCD_BMP_WIDTH
h = h * #LGLCD_BMP_WIDTH / ImageWidth(Image)
If h > #LGLCD_BMP_HEIGHT
h = #LGLCD_BMP_HEIGHT
w = w * #LGLCD_BMP_HEIGHT / ImageHeight(Image)
EndIf
ElseIf h > #LGLCD_BMP_HEIGHT
h = #LGLCD_BMP_HEIGHT
w = w * #LGLCD_BMP_HEIGHT / ImageHeight(Image)
If w > #LGLCD_BMP_WIDTH
w = #LGLCD_BMP_WIDTH
h = h * #LGLCD_BMP_WIDTH / ImageWidth(Image)
EndIf
EndIf
If w <> ImageWidth(Image) Or h <> ImageHeight(Image)
ResizeImage(Image, w, h)
EndIf
If MyG15\Simulate & #LCD_SIMULATE
CopyImage(Image, MyG15\ImageID)
ResizeImage(MyG15\ImageID, w*2, h*2)
If *bitmap = 0
ProcedureReturn #True
EndIf
EndIf
*bitmap\hdr\Format = #LGLCD_BMP_FORMAT_160x43x1
hDC = StartDrawing(ImageOutput(Image))
If hDC
*bmi = AllocateMemory(SizeOf(BITMAPINFO) + 255 * SizeOf(RGBQUAD))
If *bmi
*bmi\bmiHeader\biSize = SizeOf(BITMAPINFOHEADER)
*bmi\bmiheader\biWidth = w
*bmi\bmiheader\biHeight = - h
*bmi\bmiheader\biPlanes = 1
*bmi\bmiheader\biBitCount = d
*bmi\bmiheader\biCompression = #BI_RGB
*Buffer = AllocateMemory(w * h * (d / 8))
If *Buffer = 0
StopDrawing()
Else
Result = GetDIBits_(hDC, ImageID(Image), 0, h, *Buffer, *bmi, #DIB_RGB_COLORS)
StopDrawing()
If Result
Select d
Case 8
*HB = *Buffer
For y = 0 To #LGLCD_BMP_HEIGHT - 1
For x = 0 To #LGLCD_BMP_WIDTH - 1
If y >= h Or x >= w
A = 255
Else
*H2 = *bmi\bmiColors + (*HB\b & $FF) * SizeOf(RGBQUAD)
A = (*H2\l & $FF) + ((*H2\l >> 8) & $FF) + ((*H2\l >> 16) & $FF)
*HB + 1
EndIf
If Invers
*bitmap\pixels[y * #LGLCD_BMP_WIDTH + x] = B / 3
Else
*bitmap\pixels[y * #LGLCD_BMP_WIDTH + x] = 255 - (A / 3)
EndIf
Next x
Next y
Case 16
*HW = *Buffer
For y = 0 To #LGLCD_BMP_HEIGHT - 1
For x = 0 To #LGLCD_BMP_WIDTH - 1
If y >= h Or x >= w
A = 510
Else
A = (*HW\w & $ff) + ((*HW\w >> 8) & $ff)
*HW + 2
EndIf
If Invers
*bitmap\pixels[y * #LGLCD_BMP_WIDTH + x] = A / 2
Else
*bitmap\pixels[y * #LGLCD_BMP_WIDTH + x] = 255 - (A / 2)
EndIf
Next x
Next y
Case 24
*HL = *Buffer
For y = 0 To #LGLCD_BMP_HEIGHT - 1
For x = 0 To #LGLCD_BMP_WIDTH - 1
If y >= h Or x >= w
A = 765
Else
A = (*HL\l & $FF) + ((*HL\l >> 8) & $FF) + ((*HL\L >> 16) & $FF)
*HL + 3
EndIf
If Invers
*bitmap\pixels[y * #LGLCD_BMP_WIDTH + x] = A / 3
Else
*bitmap\pixels[y * #LGLCD_BMP_WIDTH + x] = 255 - (A / 3)
EndIf
Next x
Next y
Case 32
*HL = *Buffer
For y = 0 To #LGLCD_BMP_HEIGHT - 1
For x = 0 To #LGLCD_BMP_WIDTH - 1
If y >= h Or x >= w
A = 765
Else
A = (*HL\l & $FF) + ((*HL\l >> 8) & $FF) + ((*HL\L >> 16) & $FF)
*HL + 4
EndIf
If Invers
*bitmap\pixels[y * #LGLCD_BMP_WIDTH + x] = A / 3
Else
*bitmap\pixels[y * #LGLCD_BMP_WIDTH + x] = 255 - (A / 3)
EndIf
Next x
Next y
EndSelect
EndIf
FreeMemory(*Buffer)
EndIf
FreeMemory(*bmi)
Else
StopDrawing()
EndIf
EndIf
ProcedureReturn Result
EndProcedure