1.8" LCD & Large BMP question.

EL Wire/Tape/Panels, LEDs, pixels and strips, LCDs and TFTs, etc products from Adafruit

Moderators: adafruit_support_bill, adafruit

Please be positive and constructive with your questions and comments.
Locked
nam3ci
 
Posts: 3
Joined: Wed Dec 05, 2012 4:44 am

1.8" LCD & Large BMP question.

Post by nam3ci »

Hello!

I've been searching the forum but have not found it. :(

I'm doing a project and need to show a portion of a large BMP in the 1.8 "LCD.

The idea is that from an image of a size (for example) of 1024 x 1024 pixels display only a region of 160x128 pixels giving x and y coordinates for any point in the image.

Anyone know how to create a function like found in the library that draws a BMP to do this?

Thank you!

User avatar
pburgess
 
Posts: 4161
Joined: Sun Oct 26, 2008 2:29 am

Re: 1.8" LCD & Large BMP question.

Post by pburgess »

Have a look at the spitftbitmap sketch included with the current ST7735 LCD library. I've never specifically tested it against an image that large, but in theory it should handle the cropping OK.

nam3ci
 
Posts: 3
Joined: Wed Dec 05, 2012 4:44 am

Re: 1.8" LCD & Large BMP question.

Post by nam3ci »

Ok. I'll try It.

I was using the old library . :wink:

Thank you!

**** EDIT ***

Image cropped correct at (0,0) position to screen size, now only I need to change origin position to another , for example (10,20) and show the image. It's seems easy changing "pos" in:

Code: Select all

if(flip) // Bitmap is stored bottom-to-top order (normal BMP)
            pos = bmpImageoffset + (bmpHeight - 1 - row) * rowSize;
          else     // Bitmap is stored top-to-bottom
            pos = bmpImageoffset + row * rowSize;
          if(bmpFile.position() != pos) { // Need seek?
            bmpFile.seek(pos);
            buffidx = sizeof(sdbuffer); // Force buffer reload
          }

nam3ci
 
Posts: 3
Joined: Wed Dec 05, 2012 4:44 am

Re: 1.8" LCD & Large BMP question.

Post by nam3ci »

Solved!!!! :mrgreen:

In bmpDraw function I've changed:

Code: Select all

pos = bmpImageoffset + (bmpHeight - 1 - row) * rowSize;
by

Code: Select all

pos = ( bmpImageoffset + (orig_x * 3)) + (bmpHeight - 1 - ( row + orig_y)) * rowSize ;
Where orig_x and orig_y are the new origin for image.

Locked
Please be positive and constructive with your questions and comments.

Return to “Glowy things (LCD, LED, TFT, EL) purchased at Adafruit”