Reading variations in a .PCX file

I apologize for my numerous postings on this subject.

I've tried to illustrate my concept a little better by posting a representation of the file I am trying to work with.

What I need to do is, once I have the PCX file loaded in, I need to be able to extract a "frame" from the PCX file itself.  For example, if the file is 36 by 180, and I wanted to get the SECOND sequential 36 x 36 block I would need to go to coordinates 0,36 | 36,72....like this:

THIS IS ONE CONTINUOUS COLLECTION OF 36 x 36 pixel squares.  The dimensions of the entire image are 36 x 180 pixels for a total of 5 variations or "frames" going vertically.  If you we're to look at the .PCX file in MSPaint it would look like this:

SAMPLE.PCX

XXXXX
X         X
X         X   <-Variation 1
X         X
XXXXX
X         X
X         X   <-Variation 2
X         X
XXXXX
X         X
X         X   <-Variation 3
X         X
XXXXX
X         X
X         X   <-Variation 4
X         X
XXXXX
X         X
X         X   <-Variation 5
X         X
XXXXX

How would I extract Variation # 2?

I am VERY new at this, so I will require a FULLY FUNCTIONING procedure or function that I can just paste into my code and away I go.


The source code is available upon request.  Just send me mail at knowltonfamily@yahoo.com

A working demo of the Map Editor is available for download at:  www.enol.com/~knowlton
LVL 5
Tom KnowltonWeb developerAsked:
Who is Participating?

Improve company productivity with a Business Account.Sign Up

x
 
viktornetConnect With a Mentor Commented:
OK, I've send you the code...Is that what you need???

Regards,
Viktor Ivanov
0
 
Tom KnowltonWeb developerAuthor Commented:
Edited text of question
0
 
Tom KnowltonWeb developerAuthor Commented:
Edited text of question
0
Upgrade your Question Security!

Your question, your audience. Choose who sees your identity—and your question—with question security.

 
Tom KnowltonWeb developerAuthor Commented:
Adjusted points to 200
0
 
andrey070798Commented:
Hi, Tom!
This is me.

What happened to the code I've sent to you?
Is it working or you didn't receive it?

If you didn't receive it I can send it again.
Also you can LOAD your .PCX file into TImageList (all you need to do -  set up Properties:  Height and Width to 36, then it will load it up correctly itself).

Thanks, Andrey.


0
 
viktornetCommented:
what could do is load the image into an invisible TPCXBitmap, or whatever you want and then use a TRect like so...if you know the size of the image...I mean the dimsensions of the image..you could use something similar to this...

procedure ExtractFrame(Row: Integer);
var Rect : TRect;
begin
   Row := 180 div 36;
   with Rect do
     begin
        Top := Row * 2;{Multiply the Row with the row #...if you want to extract frame #2 then use                                    Row * 2}
        Bottom := Row + 36;
        Left := 0;
        Right := 36;
        //Now here use Canvas.CopyRect() or BitBlt to copy Rect to the place you want on your         //visible canvas...
     end;
end;

I hope it helps a bit!

Regards,
Viktor Ivanov
0
 
Tom KnowltonWeb developerAuthor Commented:
Andrey:

The code did not work.  I need something....different.
0
 
Tom KnowltonWeb developerAuthor Commented:
Viktornet:

Thank you for your response.

I will NOT know how big the file is until runtime...that's the problem.

Also, if you provide a source code solution I need you to post a function that I can just drop into my program and away I go...

If you want to send my source code back to me with a new function that does what I want, that would be the preferred solution.

Thank you,

Tom
0
 
viktornetCommented:
knowIton, what do you think about the piece of code I gave you above, do you think it can help you a bit? :)

Regards,
Viktor Ivanov
0
 
Tom KnowltonWeb developerAuthor Commented:
Edited text of question
0
 
viktornetCommented:
Ok, I'll try to make a function/procedure but I need you to tell me where do you need the frame extracted image to be placed...???

Viktor Ivanov
0
 
viktornetCommented:
Do you wanted to be placed in the Image which is named ImageThumb...the small image on the top???

Viktor Ivanov
0
 
viktornetCommented:
Do you wanted to be placed in the Image which is named ImageThumb...the small image on the top???

Viktor Ivanov
0
 
Tom KnowltonWeb developerAuthor Commented:
Viktor:

Yes, you can put it into ImageThumb...that would be perfect.

Also, I suppose I should put the frames into some kind of TImageList.  For example, if the .PCX file had 5 frames, the TImageList would contain 5 images, each one would be 36 x 36 pixels.

I sure appreciate your help!

Tom

btw - What do you think of my code?  Is it pretty stupid or is it okay?
0
 
viktornetCommented:
I think it's cool, but actually I'm kinda beginner myself... :)

Regards,
Viktor Ivanov
0
 
viktornetCommented:
Hey, KnowIton, I've made exactly what you need...I forgot your E-mail address, would you please leave a comment with the e-mail please...What I've done is that I've created a procedure to extract the frame you want from the image...it's so easy to use , just like this...

ExtractFrame( 0 , 0 , Invisibe_lImage_That_Contains_The_Whole_Image, ImageThumb );
 {That will extract the first frame of the Source Image and place it in the ThumbImage}

Just let me know your E-mail and I'll send you the procedure and a demo app..OK???

Regards,
Viktor Ivanov
That's all you need to write...I didn't try it on your project but I'm sure it will work...
0
 
viktornetCommented:
Opps....Sorry, Your e-mail is on the top of this page....I'll send you the source code and please tell me if that;s exactly what you needed, so I can use it too in the future...OK???

Regards,
Viktor Ivanov
0
 
viktornetCommented:
Well, tell me what you think knowiton... Did you recieve my mail with the Source Code I sent you???

Regards,
Viktor Ivanov
0
 
Tom KnowltonWeb developerAuthor Commented:
Viktor:

Yes, this code did work.  Now my problem is getting it to integrate with the Map Editor.

I am going to give you the points, but could you still help me integrate the code into the Map Editor itself?  I'm still having trouble there.

Thanks,

Tom
0
 
viktornetCommented:
Ok of course I'll help you. Just tell me an example of what are you trying to do now, and explain in details as you explained the question in the beginning. Then I'll try to help you! OK?? Ok talk to you later!

Regards,
Viktor Ivanov
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.