Datatypes/image remapping

Datatypes/image remapping

Post by Aric the Blu » Mon, 01 Sep 1997 04:00:00


You know, this ought to be a simple thing:

All I want to do is display an image (a gadget button) and have it
remapped to the screens' colours.  Since the picture.datatype knows how to
do this, I should be able to use that.

Right?

So, HOW can I get picture.datatype to process an image that's embeded in
my program?  I don't want to keep each image as a separate, tiny picture
file, and I really resent having to write the data out to a temporary file
in RAM: and have picture.datatype load it from there.  Why doesn't
DTST_RAM work?  Or if it does, HOW?

You know, I think ALL the datatypes should be rewritten from scratch, that
way we can do it right from the start (IE, progressive image display,
support what I describe above, 24 bit image and 16 bit sound without
complications).  

--
Quod Scripsi Scripsi

 
 
 

Datatypes/image remapping

Post by Nils Banden » Wed, 03 Sep 1997 04:00:00



Quote:> You know, this ought to be a simple thing:

> All I want to do is display an image (a gadget button) and have it
> remapped to the screens' colours.  Since the picture.datatype knows how to
> do this, I should be able to use that.

> Right?

> So, HOW can I get picture.datatype to process an image that's embeded in
> my program?  I don't want to keep each image as a separate, tiny picture
> file, and I really resent having to write the data out to a temporary file
> in RAM: and have picture.datatype load it from there.  Why doesn't
> DTST_RAM work?  Or if it does, HOW?

Hmmm, this piece of code could match your whishes:   You have to modify
the part with the copying from ColRegs to ColRegs2 and from CRegs to CRegs2.
Here is the source of the colors another datatyes object. For correct usage
of these variables you should see the AutoDoc for picture.datatype.

: struct BitMap *BitMap2;
: struct BitMapHeader *BitMapHeader2;
: ULONG *CRegs, *CRegs2;
: UBYTE *ColRegs = NULL, *ColRegs2;
: int i;
: APTR Obj2;
:
: if (Obj2 = NewDTObject(NULL,    DTA_SourceType,     DTST_RAM,
:                                 DTA_GroupID,        GID_PICTURE,
:                                 PDTA_BitMap,        BitMap2,
:                                 PDTA_NumColors,     NumCols,
:                                 PDTA_ModeID,        ModeID,
:                                 TAG_DONE))
: {
:     if (GetDTAttrs(Obj2, PDTA_CRegs, &CRegs2, PDTA_ColorRegisters, &ColRegs2, PDTA_BitMapHeader, &BitMapHeader2, TAG_DONE))
:     {
:         int i;
:
:         if (CRegs2 && ColRegs2)
:         {
:             for (i = 0; i < NumCols; i++)
:             {
:                 ColRegs2[i * 3 + 0] = ColRegs[i * 3 + 0];
:                 ColRegs2[i * 3 + 1] = ColRegs[i * 3 + 1];
:                 ColRegs2[i * 3 + 2] = ColRegs[i * 3 + 2];
:                 CRegs2[i * 3 + 0] = CRegs[i * 3 + 0];
:                 CRegs2[i * 3 + 1] = CRegs[i * 3 + 1];
:                 CRegs2[i * 3 + 2] = CRegs[i * 3 + 2];
:             }
:         }
:
:         BitMapHeader2->bmh_Width = width;
:         BitMapHeader2->bmh_Height = height;
:         BitMapHeader2->bmh_Depth = depth;
:         BitMapHeader2->bmh_Masking = masking;
:         BitMapHeader2->bmh_Transparent = transparent;
:         BitMapHeader2->bmh_XAspect = xaspect;
:         BitMapHeader2->bmh_YAspect = yaspect;
:
:         SetDTAttrs(Obj2, NULL, NULL,
:                    DTA_NominalHoriz,   BitMapHeader2->bmh_Width,
:                    DTA_NominalVert,    BitMapHeader2->bmh_Height,
:                    TAG_DONE);
:
:     }
: }
: return Obj2;

As far as I see that, actual remapping is first done when you add the
object to the window. Thus, simply BltBipMap() would not bring the effect.

P.S.: I do not know, whether poking the structures is really legal, but
picture.datatype lets you no choice.

--
Nils Bandener          ///   Fiasco in the WWW:




 
 
 

Datatypes/image remapping

Post by Ben Matth » Thu, 04 Sep 1997 04:00:00



> > You know, this ought to be a simple thing:

Thats a good point ;-0

I've got a sorta similar problem when I've tried to remap images
with picture.datatype.

I want to be able to attach a dtobject to a window and remap the
pens to suit the screenmode as standard.  However I don't want
to just view the whole image; I want to decode that image into
a seperate allocated bitmap and then blit the remapped image
whenever.

Is that possible?  The best solution I can come up with is to
open a window the same size as the image, attach the object to
it, refresh the object and therefore display the whole image
then grab the bitmap of the window/screen rastport, then
quickly close the window - which obviously is a totally
bollucky way of handling images.

There must be a better way of obtain a remapped bitmap
without having to display the thing first.  The PDTA_DestBitMap
is obviously no good since you need to allocate a sparse table
and I can't really do that with a screen I don't own - e.g:
Workbench.

TIA.

Ben
--
------------------------------------------------
* Ben Matthew is known to be lurking around:   *

*   http://www.bmatthew.demon.co.uk/ (WWW)     *
*       http://www.leighctc.force9.co.uk/          *
*       #disa (Internet IRC), nick:= Wisdom-X      *
------------------------------------------------
"You know it's time to slow down when every third key
you press is delete" - Jason G Doig

 
 
 

Datatypes/image remapping

Post by Yvon Rozi » Fri, 05 Sep 1997 04:00:00


:
: There must be a better way of obtain a remapped bitmap
: without having to display the thing first.  The PDTA_DestBitMap
: is obviously no good since you need to allocate a sparse table

Works fine for me without sparse table.

: and I can't really do that with a screen I don't own - e.g:
: Workbench.

--

Quote:>> e-mail reply? Remove ".nozpam" and don't post in newsgroup too!

                 ___                                      _
   Q          : |  #| yrozijn      :  \|/  http://www. : [_]_

  / \  Rozijn : `---'              :  /|\  ~yrozijn    :     O  4000
 
 
 

Datatypes/image remapping

Post by Ben Matth » Fri, 05 Sep 1997 04:00:00




> :
> : There must be a better way of obtain a remapped bitmap
> : without having to display the thing first.  The PDTA_DestBitMap
> : is obviously no good since you need to allocate a sparse table

> Works fine for me without sparse table.

Thats odd.  This is the code I was using when using PDTA_DestBitMap

struct gpLayout layout;

obj=NewDTObject(fname,  DTA_SourceType,DTST_FILE,
                                                DTA_GroupID,GID_PICTURE,
                                                PDTA_Remap,TRUE,
                                                PDTA_Screen,scr,        // A public screen, usually Workbench
                                                TAG_DONE);

// Not entirely sure this next bit to physically render the image is necessary

layout.MethodID=DTM_PROCLAYOUT;
layout.gpl_GInfo=NULL;
layout.gpl_Initial=1;

DoDTMethodA(obj, NULL, NULL, (Msg)&layout);

// Done

GetDTAttrs(obj, PDTA_BitMapHeader,&head,
                                PDTA_DestBitMap,&bitmap,
                                TAG_DONE);

{{Blit data into allocated bitmap}}

DisposeDTObject(obj);

And it doesn't remap properly at all.  In fact all it ends up doing is
locking the system when the PDTA_Remap tag is set for a few seconds.

Any ideas?

Ben

--
------------------------------------------------
* Ben Matthew is known to be lurking around:   *

*   http://www.bmatthew.demon.co.uk/ (WWW)     *
*       http://www.leighctc.force9.co.uk/          *
*       #disa (Internet IRC), nick:= Wisdom-X      *
------------------------------------------------
"You know it's time to slow down when every third key
you press is delete" - Jason G Doig

 
 
 

1. picture.datatype remapping 24-bits

Hi,

I am using the picture.datatype to remap existing bitmaps which works
fine with bitmaps up to 256 colors, like:

pic = NewObject(NULL,"picture.datatype",PDTA_Screen, scr, PDTA_Remap,
TRUE, PDTA_BitMap, bm, ...., TAG_END);

After a

DoMethod(pic,DTM_PROCLAYOUT,...);

I have a PDTA_DestBitMap with the remapped image - as long as the source
bitmap hasn't more than 8-bits.
If it's depth is 24-bits all goes well but the PDTA_DestBitMap will be
NULL in every case.
I am using the OS3.5 picture.datatype, if that matters.

I hope anyone can point me to the right idea...

Bye,
  Axel.

2. NT & USB

3. Need help with remapping datatypes

4. Anyone has trouble with DDE in latest patch?

5. Datatypes remapping

6. WANTED: SENIOR ARCH. MULTIMEDIA PLAYER (SF BAY)

7. Datatype remapping problem

8. How to create a custom title bar for windows

9. Datatypes and remapping

10. Datatype remapping

11. bitmap, datatypes, mask, remap, gfx card, etc...