![]() | ![]() | ![]() |
| | #16 |
|
That makes even less sense atom.... RGB.... All 00s == black. All FFs == white. There should be no separate bytes other than R G and B.
__________________ "Because I be what I be. I would tell you what you want to know if I could, mum, but I be a cat, and no cat anywhere ever gave anyone a straight answer, har har." | |
| |
| | #17 |
|
hey guys this is killing me: Code: void LCDWriteBMP(unsigned rom char *bmp, unsigned char x, unsigned char y, unsigned char width, unsigned char height) {
unsigned int j;
unsigned int maxPix;
unsigned int xmin, xmax, ymin, ymax;
unsigned int i;
maxPix = 0;
//maxPix = (width * height);
for(j = 0; j < height; j++) {
maxPix += width;
}
xmin = x;
xmax = x + width;
ymin = y;
ymax = y + height;
LCDCommand(PASETP);
LCDData(ymin);
LCDData(ymax);
LCDCommand(CASETP);
LCDData(xmin);
LCDData(xmax);
LCDCommand(RAMWRP);
for(j = 0; j < maxPix; j++) {
LCDData(*bmp++);
}
}
LCDWriteBMP(bmp444,20,20,50,50); for some reason the values are mixed up or wrong..
__________________ AtomSofts eBay Store AtomSoftTech: C18 TIPS & TRICKS v9 PDF Nokia 6100 Driver/Software My Name: Jason Lopez http://atomsofttech.info/ | My YouTube Videos! My Favorite Store: dipmicro Electronics Last edited by AtomSoft; 31st October 2009 at 02:33 AM. | |
| |
| | #18 |
|
__________________ AtomSofts eBay Store AtomSoftTech: C18 TIPS & TRICKS v9 PDF Nokia 6100 Driver/Software My Name: Jason Lopez http://atomsofttech.info/ | My YouTube Videos! My Favorite Store: dipmicro Electronics | |
| |
| | #19 | |
| Quote:
2500 = hex 9C4 Hex C4 = 196 You need to force the calculation to be done in unsigned long max = width; max = max * height; would probably do it or you could probably use explicit type casts. | ||
| |
| | #20 |
|
the issue was it wasnt getting the data from the call but i fixed it somewhat; Code: width = *bmp++;
height = *bmp++;
for(j = 0; j < height; j++) {
maxPix += width;
}
UPDATE: Code: width = *bmp++;
height = *bmp++;
maxPix = height;
maxPix = maxPix * width;
__________________ AtomSofts eBay Store AtomSoftTech: C18 TIPS & TRICKS v9 PDF Nokia 6100 Driver/Software My Name: Jason Lopez http://atomsofttech.info/ | My YouTube Videos! My Favorite Store: dipmicro Electronics Last edited by AtomSoft; 31st October 2009 at 05:04 PM. | |
| |
| | #21 |
|
this is very frustrating heh .. in my mind it should be working but in reality it isnt.. My screen is setup to write from LEFT to Right then top to bottom like: ![]() So in VB im reading from left to right and top to bottom .. placing the data into a listbox and looping through the listbox (visual array) I divide each pixel RGB by 17 so 255 == 15 (aka 0x0F) which is the max for each RGB (0xFFF) Now i get black pretty good but i get sukish results with the rest... here is my 50x50 image i want to convert: (i had to convert to jpg to place here) ![]() VB Code: Code: Private OnBits(0 To 31) As Long
Private Declare Function GetPixel Lib "gdi32" (ByVal hdc As Long, ByVal x As Long, _
ByVal y As Long) As Long
Dim Red As Byte
Dim Green As Byte
Dim Blue As Byte
Dim Color As Long
Public Function LShiftLong(ByVal Value As Long, _
ByVal Shift As Integer) As Long
MakeOnBits
If (Value And (2 ^ (31 - Shift))) Then GoTo OverFlow
LShiftLong = ((Value And OnBits(31 - Shift)) * (2 ^ Shift))
Exit Function
OverFlow:
LShiftLong = ((Value And OnBits(31 - (Shift + 1))) * _
(2 ^ (Shift))) Or &H80000000
End Function
Public Function RShiftLong(ByVal Value As Long, _
ByVal Shift As Integer) As Long
Dim hi As Long
MakeOnBits
If (Value And &H80000000) Then hi = &H40000000
RShiftLong = (Value And &H7FFFFFFE) \ (2 ^ Shift)
RShiftLong = (RShiftLong Or (hi \ (2 ^ (Shift - 1))))
End Function
Private Sub MakeOnBits()
Dim j As Integer, _
v As Long
For j = 0 To 30
v = v + (2 ^ j)
OnBits(j) = v
Next j
OnBits(j) = v + &H80000000
End Sub
Private Sub Command1_Click()
'The following code example counts the number of red pixels on the active form:
' assumes that form's ScaleMode
' is set to 3 - Pixels
Text2 = ""
Text4 = ""
Text3 = ""
Dim x As Long, y As Long
Dim h As Long, count As Long
Dim q As Long, w As Long
Dim tmp As Integer
Dim tmpf As Integer
' cache form's hDC property
h = Picture1.hdc
'For y = 0 To Picture1.ScaleHeight - 1
' For x = 0 To Picture1.ScaleWidth - 1
Dim hMax As Integer, wMax As Integer
hMax = Picture1.ScaleHeight - 1
wMax = Picture1.ScaleWidth - 1
For y = 0 To hMax
For x = 0 To wMax
Color = GetPixel(h, x, y)
Red = Color And &HFF& 'mind the ampersand at the end of constant
Green = (Color And &HFF00&) / 256 'bit masking and "shift"
Blue = (Color And &HFF0000) / 65535 'bit masking and "shift"
Red = Red / 17
Green = Green / 17
Blue = Blue / 17
List1.AddItem Red
List1.AddItem Green
List1.AddItem Blue
Text2.Text = Text2.Text & Red & "-" & Green & "-" & Blue & ", "
Next
Next
h = List1.ListCount - 1
If h Mod 2 = 1 Then List1.AddItem 0
count = List1.ListCount / 2
h = List1.ListCount - 1
For y = 0 To List1.ListCount - 1
tmpf = 0
For x = 0 To 1
tmpf = tmpf Or Val(List1.List(y + x))
If tmpf > 9 Then
Select Case List1.List(y + x)
Case 10
tmpf = tmpf Or &HA
Case 11
tmpf = tmpf Or &HB
Case 12
tmpf = tmpf Or &HC
Case 13
tmpf = tmpf Or &HD
Case 14
tmpf = tmpf Or &HE
Case 15
tmpf = tmpf Or &HF
End Select
End If
If x = 0 Then
tmpf = LShiftLong(tmpf, 4)
End If
Next x
y = y + 2
List2.AddItem tmpf
Next y
Text3 = Str(List1.ListCount - 1)
Text4 = Str(List2.ListCount - 1)
End Sub
Private Sub List1_Click()
Dim x As Integer, y As Integer
Text2.Text = ""
For x = 0 To List1.ListCount - 1
Text2.Text = Text2.Text & List1.List(x) & ","
y = y + 1
If y = 40 Then
y = 0
Text2.Text = Text2.Text & vbNewLine
End If
Next x
Text2.Text = Mid$(Text2.Text, 1, (Len(Text2.Text) - 1))
End Sub
Private Sub List2_Click()
Dim x As Integer, y As Integer
Text2.Text = ""
For x = 0 To List2.ListCount - 1
Text2.Text = Text2.Text & List2.List(x) & ","
y = y + 1
If y = 40 Then
y = 0
Text2.Text = Text2.Text & vbNewLine
End If
Next x
Text2.Text = Mid$(Text2.Text, 1, (Len(Text2.Text) - 1))
End Sub
Private Sub Picture1_Click()
Picture1.Picture = LoadPicture("d:\colors.bmp")
End Sub
__________________ AtomSofts eBay Store AtomSoftTech: C18 TIPS & TRICKS v9 PDF Nokia 6100 Driver/Software My Name: Jason Lopez http://atomsofttech.info/ | My YouTube Videos! My Favorite Store: dipmicro Electronics | |
| |
| | #22 | |
| Quote:
Code: unsigned char newpixel; // 8bit var is ok unsigned int temp; // must be 16bit var! temp = (pixel + 8); newpixel = (temp / 16); | ||
| |
| | #23 |
|
Thanks will try
__________________ AtomSofts eBay Store AtomSoftTech: C18 TIPS & TRICKS v9 PDF Nokia 6100 Driver/Software My Name: Jason Lopez http://atomsofttech.info/ | My YouTube Videos! My Favorite Store: dipmicro Electronics | |
| |
| | #24 |
|
Thanks. I also figured out another issue and this is what i get so far:
__________________ AtomSofts eBay Store AtomSoftTech: C18 TIPS & TRICKS v9 PDF Nokia 6100 Driver/Software My Name: Jason Lopez http://atomsofttech.info/ | My YouTube Videos! My Favorite Store: dipmicro Electronics | |
| |
| | #25 |
|
Top line looks ok, then you get a 45 degree angle so you have a 1 pixel error on each line. Check your line length values, and for loops etc. Could be a -1 in the wrong spot... | |
| |
| | #26 |
|
OMG YES!!!!!!!! i did it:
__________________ AtomSofts eBay Store AtomSoftTech: C18 TIPS & TRICKS v9 PDF Nokia 6100 Driver/Software My Name: Jason Lopez http://atomsofttech.info/ | My YouTube Videos! My Favorite Store: dipmicro Electronics | |
| |
| | #27 |
|
Look a bear lol:
__________________ AtomSofts eBay Store AtomSoftTech: C18 TIPS & TRICKS v9 PDF Nokia 6100 Driver/Software My Name: Jason Lopez http://atomsofttech.info/ | My YouTube Videos! My Favorite Store: dipmicro Electronics | |
| |
| | #28 |
|
The main program... can someone test it out for me to see if it works well on other computers. Like does it seem to work well heh Tiny Version (NO VB6 RUNTIME FILES INCLUDED) (9kb ZIP) http://atomsofttech.info/code/Nokia12Bit_tiny.zip Full Version (VB6 RUNTIME FILES INCLUDED) (1,179kb ZIP) http://atomsofttech.info/code/Nokia12Bit_full.zip EDIT: Just noticed they were making txt files instead of h (headers) so i just fixed it and re-uploaded it heh was bored.... ![]() Looks way better live
__________________ AtomSofts eBay Store AtomSoftTech: C18 TIPS & TRICKS v9 PDF Nokia 6100 Driver/Software My Name: Jason Lopez http://atomsofttech.info/ | My YouTube Videos! My Favorite Store: dipmicro Electronics Last edited by AtomSoft; 31st October 2009 at 10:39 PM. | |
| |
| | #29 |
|
I am currently Cleaning up the code and will post a full source and schematic and VB program all in one. This way people can use it. The VB source will not be shared until i fix it up more... Also i will be adding the ability to select between 8, 12 and 16 bit color for LCD image conversion and code soon.
__________________ AtomSofts eBay Store AtomSoftTech: C18 TIPS & TRICKS v9 PDF Nokia 6100 Driver/Software My Name: Jason Lopez http://atomsofttech.info/ | My YouTube Videos! My Favorite Store: dipmicro Electronics | |
| |
| | #30 |
|
so if i needed to make a RGB pixel to 8 bit LCD which is RRRGGGBB can i simply Code: unsigned char newpixel; // 8bit var is ok unsigned int temp; // must be 16bit var! temp = (RED); newRED = (temp / (255/7)); temp = (GREEN); newGREEN = (temp / (255/7)); temp = (BLUE); newBLUE = (temp / (255/3)); //NewPixel 8 Bit would be shifted like: newpixel= (NewRED<<4) | (NewGREEN<<2) | NewBLUE;
__________________ AtomSofts eBay Store AtomSoftTech: C18 TIPS & TRICKS v9 PDF Nokia 6100 Driver/Software My Name: Jason Lopez http://atomsofttech.info/ | My YouTube Videos! My Favorite Store: dipmicro Electronics Last edited by AtomSoft; 1st November 2009 at 10:17 PM. | |
| |
|
| Tags |
| 6100, library, nokia |
| Thread Tools | |
| Display Modes | |
| |
Similar | ||||
| Title | Starter | Forum | Replies | Latest |
| Multisim Library | rahulshah | Datasheet/Parts Requests | 0 | 15th March 2009 02:12 PM |
| Rfid Library | ollakalla | Micro Controllers | 0 | 18th December 2008 07:02 PM |
| eagle library | fedail | General Electronics Chat | 19 | 14th October 2008 07:36 PM |
| Eagle Library | bababui | Electronic Projects Design/Ideas/Reviews | 13 | 9th May 2007 01:56 PM |
| Protothread library | Dan East | Micro Controllers | 0 | 7th October 2005 04:31 AM |