• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 308
  • Last Modified:

for Hypo ONLY

Yo Hypo!  I need some code on loading a 24bpp bitmap, bmp or pcx, in our mode..

0
VIBESPRO
Asked:
VIBESPRO
  • 6
  • 3
  • 2
1 Solution
 
HypoCommented:
I'm on it... :)
0
 
VIBESPROAuthor Commented:
Great....  ;) and don't forget to answer that guys ??? on jpg files

and do you know the format of TTF files??  I want to display a true type font in pascal as well... :)

if you can answer that I'll double the points...
0
 
VIBESPROAuthor Commented:
hey man, I'm serious about the TTF files!  If you can more points will follow!!
0
Free Tool: ZipGrep

ZipGrep is a utility that can list and search zip (.war, .ear, .jar, etc) archives for text patterns, without the need to extract the archive's contents.

One of a set of tools we're offering as a way to say thank you for being a part of the community.

 
VIBESPROAuthor Commented:
oh, and for the 24bpp bitmap..
all I really need is the formula for converting it and info on how the pixels should be placed
0
 
RaidCommented:
Sorry to interrupt, really, but the formula is:
Read Header, then read B, G, R per pixel, and to convert the B, G, R to your graphics mode is:
B SHR 2, G SHR 2, R SHR 2.
(In other words: B DIV 4, G DIV 4, R DIV 4)
But I'm sure you knew that :)
Once again sorry for interrupting, I load 24 bit bitmap's all the time, the least I can do is help, since you and Hypo helped me.
0
 
RaidCommented:
Oh, and the annoying part is that the image is saved as:
Down to Up, Left to Right.
To read the bitmap file is:

Type
  BmpColType=Record
    B, G, R: Byte;
  End;
Var
  R, G, B: Byte;
  Offset: Word;
Begin
  Blockread(BmpFile, BmpHeader, Sizeof(BmpHeader));
  For Y := BmpHeader.Height-1 downto 0 Begin
    For X := 0 to BmpHeader.Width-1 do Begin
      BlockRead(BmpFile, BmpColType, Sizeof(BmpColType));
      R := BmpColType.R Shr 2;
      G := BmpColType.G Shr 2;
      B := BmpColType.B Shr 2;
      Offset := ((Yvar*BmpHeader.Width)*2)+(xvar*2);
      MemW[Sef(Buffer):Ofs(Buffer)+Offset] :=
       _CalculateColor(R, G, B);
    End;
  End;
End;

(Note: The *2 was there because you are dealing with 16bit,           which is 2 bytes)
0
 
VIBESPROAuthor Commented:
Hey thanx Raid!  I'll give you the points for this question but I still need the info on how to read TTF files from Hypo.

No offense Hypo, Raid deserves the points.  But I still can give the points the anyone who can help with the TTF files...

Raid! you are welcome to join in!!
0
 
VIBESPROAuthor Commented:
if you guys have any info on TTF files send it to my email address and if it works I'll post another question for it worth 400 points
0
 
RaidCommented:
Do you want file format info, or all out information on to load them?
0
 
VIBESPROAuthor Commented:
if u have it all that will be great!!
0
 
HypoCommented:
Don' worry about me beeing offended...
As you already knew I've got to many things to do right now... and Raid did answer your question, so he should have the points.

Anyway... The description of the TTF format can probably be found on
http://www.Wotsit.org
As I've said before... the TTF format is build up using Vectors, not a bunch of stored sprites as other fonts are.
(That's how they solved the problem of using a dynamical sized font)
So the problem isn't just to load / decode the format, but also whenever you have to put the font on the screen.

But as soon as I'll get some time over... I'll check it out.
0

Featured Post

Take Control of Web Hosting For Your Clients

As a web developer or IT admin, successfully managing multiple client accounts can be challenging. In this webinar we will look at the tools provided by Media Temple and Plesk to make managing your clients’ hosting easier.

  • 6
  • 3
  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now