Of course I''m sure!
Did you run it?
It works...
adamm@san.rr.com
Incrementing Pointers
yeah, I compiled it and it did the same thing it did before I sent it to you. here''s the code you sent to me:
and before you changed it:
These are both the same, right?
Visit our web site:
Asylum Entertainment
void Blend16(int sx,int sy, int width, int height, int dx, int dy, int alpha, int slPitch16, int dlPitch16, USHORT colorkey, USHORT* svidbuffer, USHORT* dvidbuffer, int pixel_format) { // To Do: Rewrite this function to work with 5.5.5 cards int index_x, index_y; int dindex, sindex; UCHAR sred,sgreen,sblue,dred,dgreen,dblue,fred,fgreen,fblue;/* for (index_y = 0; index_y < height; index_y++) { for (index_x = 0; index_x < width; index_x++) { if((svidbuffer[index_x + sx + slPitch16 * (index_y + sy)] != colorkey)) { dindex = index_x + dx + dlPitch16 * (index_y + dy); sindex = index_x + sx + slPitch16 * (index_y + sy); sred = (((svidbuffer[sindex] >> 11) & 0x1F)); sgreen = (((svidbuffer[sindex] >> 5) & 0x3F)); sblue = ((svidbuffer[sindex]) & 0x1F); dred = (((dvidbuffer[dindex] >> 11) & 0x1F)); dgreen = (((dvidbuffer[dindex] >> 5) & 0x3F)); dblue = ((dvidbuffer[dindex]) & 0x1F); fred = ((l_Alpha[alpha][sred] - l_Alpha[alpha][dred])) + dred; // same as (alpha * sred - alpha * dred) + dred fgreen = ((l_Alpha[alpha][sgreen] - l_Alpha[alpha][dgreen])) + dgreen; fblue = ((l_Alpha[alpha][sblue] - l_Alpha[alpha][dblue])) + dblue; dvidbuffer[dindex] = RGB16(fred << 3,fgreen << 2,fblue << 3); // scale up the values } } }*/ dindex = dx + dlPitch16 * dy; sindex = sx + slPitch16 * sy; svidbuffer += sindex; dvidbuffer += dindex; for (index_y = 0; index_y < height; index_y++) { for (index_x = 0; index_x < width; index_x++) { if((*(svidbuffer + index_x) != colorkey)) { sred = (*(svidbuffer + index_x) >> 11) & 0x1F; sgreen = (*(svidbuffer + index_x) >> 5) & 0x3F; sblue = *(svidbuffer + index_x) & 0x1F; dred = (*(dvidbuffer + index_x) >> 11) & 0x1F; dgreen = (*(dvidbuffer + index_x) >> 5) & 0x3F; dblue = *(dvidbuffer + index_x) & 0x1F; fred = ((l_Alpha[alpha][sred] - l_Alpha[alpha][dred])) + dred; // same as (alpha * sred - alpha * dred) + dred fgreen = ((l_Alpha[alpha][sgreen] - l_Alpha[alpha][dgreen])) + dgreen; fblue = ((l_Alpha[alpha][sblue] - l_Alpha[alpha][dblue])) + dblue; *(dvidbuffer + index_x) = RGB16(fred << 3,fgreen << 2,fblue << 3); // scale up the values } } svidbuffer += slPitch16; dvidbuffer += dlPitch16; } }
and before you changed it:
void Blend16(int sx,int sy, int width, int height, int dx, int dy, int alpha, int slPitch16, int dlPitch16, USHORT colorkey, USHORT* svidbuffer, USHORT* dvidbuffer, int pixel_format) { // To Do: Rewrite this function to work with 5.5.5 cards int index_x, index_y; int dindex, sindex; UCHAR sred,sgreen,sblue,dred,dgreen,dblue,fred,fgreen,fblue;/* for (index_y = 0; index_y < height; index_y++) { for (index_x = 0; index_x < width; index_x++) { if((svidbuffer[index_x + sx + slPitch16 * (index_y + sy)] != colorkey)) { dindex = index_x + dx + dlPitch16 * (index_y + dy); sindex = index_x + sx + slPitch16 * (index_y + sy); sred = (((svidbuffer[sindex] >> 11) & 0x1F)); sgreen = (((svidbuffer[sindex] >> 5) & 0x3F)); sblue = ((svidbuffer[sindex]) & 0x1F); dred = (((dvidbuffer[dindex] >> 11) & 0x1F)); dgreen = (((dvidbuffer[dindex] >> 5) & 0x3F)); dblue = ((dvidbuffer[dindex]) & 0x1F); fred = ((l_Alpha[alpha][sred] - l_Alpha[alpha][dred])) + dred; // same as (alpha * sred - alpha * dred) + dred fgreen = ((l_Alpha[alpha][sgreen] - l_Alpha[alpha][dgreen])) + dgreen; fblue = ((l_Alpha[alpha][sblue] - l_Alpha[alpha][dblue])) + dblue; dvidbuffer[dindex] = RGB16(fred << 3,fgreen << 2,fblue << 3); // scale up the values } } }*/ dindex = dx + dlPitch16 * dy; sindex = sx + slPitch16 * sy; svidbuffer += sindex; dvidbuffer += dindex; for (index_y = 0; index_y < height; index_y++) { for (index_x = 0; index_x < width; index_x++) { if((*(dvidbuffer + index_x) != colorkey)) { sred = (*(svidbuffer + index_x) >> 11) & 0x1F; sgreen = (*(svidbuffer + index_x) >> 5) & 0x3F; sblue = *(svidbuffer + index_x) & 0x1F; dred = (*(dvidbuffer + index_x) >> 11) & 0x1F; dgreen = (*(dvidbuffer + index_x) >> 5) & 0x3F; dblue = *(dvidbuffer + index_x) & 0x1F; fred = ((l_Alpha[alpha][sred] - l_Alpha[alpha][dred])) + dred; // same as (alpha * sred - alpha * dred) + dred fgreen = ((l_Alpha[alpha][sgreen] - l_Alpha[alpha][dgreen])) + dgreen; fblue = ((l_Alpha[alpha][sblue] - l_Alpha[alpha][dblue])) + dblue; *(dvidbuffer + index_x) = RGB16(fred << 3,fgreen << 2,fblue << 3); // scale up the values } } svidbuffer += slPitch16; dvidbuffer += dlPitch16; } }
These are both the same, right?
Visit our web site:
Asylum Entertainment
My Geekcode: "GCS d s: a14 C++$ P+(++) L+ E-- W+++$ K- w++(+++) O---- M-- Y-- PGP- t XR- tv+ b++ DI+(+++) D- G e* h!"Decode my geekcode!Geekcode.com
Visit our web site:Asylum Entertainment
Visit our web site:Asylum Entertainment
yeah, I compiled it and it did the same thing it did before I sent it to you. here''s the code you sent to me:
and before you changed it:
These are both the same, right?
(BTW I''m 13 years old)
Visit our web site:
Asylum Entertainment
void Blend16(int sx,int sy, int width, int height, int dx, int dy, int alpha, int slPitch16, int dlPitch16, USHORT colorkey, USHORT* svidbuffer, USHORT* dvidbuffer, int pixel_format) { // To Do: Rewrite this function to work with 5.5.5 cards int index_x, index_y; int dindex, sindex; UCHAR sred,sgreen,sblue,dred,dgreen,dblue,fred,fgreen,fblue;/* for (index_y = 0; index_y < height; index_y++) { for (index_x = 0; index_x < width; index_x++) { if((svidbuffer[index_x + sx + slPitch16 * (index_y + sy)] != colorkey)) { dindex = index_x + dx + dlPitch16 * (index_y + dy); sindex = index_x + sx + slPitch16 * (index_y + sy); sred = (((svidbuffer[sindex] >> 11) & 0x1F)); sgreen = (((svidbuffer[sindex] >> 5) & 0x3F)); sblue = ((svidbuffer[sindex]) & 0x1F); dred = (((dvidbuffer[dindex] >> 11) & 0x1F)); dgreen = (((dvidbuffer[dindex] >> 5) & 0x3F)); dblue = ((dvidbuffer[dindex]) & 0x1F); fred = ((l_Alpha[alpha][sred] - l_Alpha[alpha][dred])) + dred; // same as (alpha * sred - alpha * dred) + dred fgreen = ((l_Alpha[alpha][sgreen] - l_Alpha[alpha][dgreen])) + dgreen; fblue = ((l_Alpha[alpha][sblue] - l_Alpha[alpha][dblue])) + dblue; dvidbuffer[dindex] = RGB16(fred << 3,fgreen << 2,fblue << 3); // scale up the values } } }*/ dindex = dx + dlPitch16 * dy; sindex = sx + slPitch16 * sy; svidbuffer += sindex; dvidbuffer += dindex; for (index_y = 0; index_y < height; index_y++) { for (index_x = 0; index_x < width; index_x++) { if((*(svidbuffer + index_x) != colorkey)) { sred = (*(svidbuffer + index_x) >> 11) & 0x1F; sgreen = (*(svidbuffer + index_x) >> 5) & 0x3F; sblue = *(svidbuffer + index_x) & 0x1F; dred = (*(dvidbuffer + index_x) >> 11) & 0x1F; dgreen = (*(dvidbuffer + index_x) >> 5) & 0x3F; dblue = *(dvidbuffer + index_x) & 0x1F; fred = ((l_Alpha[alpha][sred] - l_Alpha[alpha][dred])) + dred; // same as (alpha * sred - alpha * dred) + dred fgreen = ((l_Alpha[alpha][sgreen] - l_Alpha[alpha][dgreen])) + dgreen; fblue = ((l_Alpha[alpha][sblue] - l_Alpha[alpha][dblue])) + dblue; *(dvidbuffer + index_x) = RGB16(fred << 3,fgreen << 2,fblue << 3); // scale up the values } } svidbuffer += slPitch16; dvidbuffer += dlPitch16; } }
and before you changed it:
void Blend16(int sx,int sy, int width, int height, int dx, int dy, int alpha, int slPitch16, int dlPitch16, USHORT colorkey, USHORT* svidbuffer, USHORT* dvidbuffer, int pixel_format) { // To Do: Rewrite this function to work with 5.5.5 cards int index_x, index_y; int dindex, sindex; UCHAR sred,sgreen,sblue,dred,dgreen,dblue,fred,fgreen,fblue;/* for (index_y = 0; index_y < height; index_y++) { for (index_x = 0; index_x < width; index_x++) { if((svidbuffer[index_x + sx + slPitch16 * (index_y + sy)] != colorkey)) { dindex = index_x + dx + dlPitch16 * (index_y + dy); sindex = index_x + sx + slPitch16 * (index_y + sy); sred = (((svidbuffer[sindex] >> 11) & 0x1F)); sgreen = (((svidbuffer[sindex] >> 5) & 0x3F)); sblue = ((svidbuffer[sindex]) & 0x1F); dred = (((dvidbuffer[dindex] >> 11) & 0x1F)); dgreen = (((dvidbuffer[dindex] >> 5) & 0x3F)); dblue = ((dvidbuffer[dindex]) & 0x1F); fred = ((l_Alpha[alpha][sred] - l_Alpha[alpha][dred])) + dred; // same as (alpha * sred - alpha * dred) + dred fgreen = ((l_Alpha[alpha][sgreen] - l_Alpha[alpha][dgreen])) + dgreen; fblue = ((l_Alpha[alpha][sblue] - l_Alpha[alpha][dblue])) + dblue; dvidbuffer[dindex] = RGB16(fred << 3,fgreen << 2,fblue << 3); // scale up the values } } }*/ dindex = dx + dlPitch16 * dy; sindex = sx + slPitch16 * sy; svidbuffer += sindex; dvidbuffer += dindex; for (index_y = 0; index_y < height; index_y++) { for (index_x = 0; index_x < width; index_x++) { if((*(dvidbuffer + index_x) != colorkey)) { sred = (*(svidbuffer + index_x) >> 11) & 0x1F; sgreen = (*(svidbuffer + index_x) >> 5) & 0x3F; sblue = *(svidbuffer + index_x) & 0x1F; dred = (*(dvidbuffer + index_x) >> 11) & 0x1F; dgreen = (*(dvidbuffer + index_x) >> 5) & 0x3F; dblue = *(dvidbuffer + index_x) & 0x1F; fred = ((l_Alpha[alpha][sred] - l_Alpha[alpha][dred])) + dred; // same as (alpha * sred - alpha * dred) + dred fgreen = ((l_Alpha[alpha][sgreen] - l_Alpha[alpha][dgreen])) + dgreen; fblue = ((l_Alpha[alpha][sblue] - l_Alpha[alpha][dblue])) + dblue; *(dvidbuffer + index_x) = RGB16(fred << 3,fgreen << 2,fblue << 3); // scale up the values } } svidbuffer += slPitch16; dvidbuffer += dlPitch16; } }
These are both the same, right?
(BTW I''m 13 years old)
Visit our web site:
Asylum Entertainment
My Geekcode: "GCS d s: a14 C++$ P+(++) L+ E-- W+++$ K- w++(+++) O---- M-- Y-- PGP- t XR- tv+ b++ DI+(+++) D- G e* h!"Decode my geekcode!Geekcode.com
Visit our web site:Asylum Entertainment
Visit our web site:Asylum Entertainment
actually in the file you sent me, you were checking the key against the wrong surface, like this
if((dvidbuffer[index_x + sx + slPitch16 * (index_y + sy)] != colorkey))
i merely changed it to
if((svidbuffer[index_x + sx + slPitch16 * (index_y + sy)] != colorkey))
and that''s why it was the exact same size
And I''m pretty impressed.. you''re making some pretty cool stuff for 13
adamm@san.rr.com
if((dvidbuffer[index_x + sx + slPitch16 * (index_y + sy)] != colorkey))
i merely changed it to
if((svidbuffer[index_x + sx + slPitch16 * (index_y + sy)] != colorkey))
and that''s why it was the exact same size
And I''m pretty impressed.. you''re making some pretty cool stuff for 13
adamm@san.rr.com
adamm@san.rr.com
I just got your email. I was looking the code over, but I don''t have time to fix it right now, I''ve got homework :-( But I''ll try tomorrow, and post here again.
Visit our web site:
Asylum Entertainment
Visit our web site:
Asylum Entertainment
My Geekcode: "GCS d s: a14 C++$ P+(++) L+ E-- W+++$ K- w++(+++) O---- M-- Y-- PGP- t XR- tv+ b++ DI+(+++) D- G e* h!"Decode my geekcode!Geekcode.com
Visit our web site:Asylum Entertainment
Visit our web site:Asylum Entertainment
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement
Recommended Tutorials
Advertisement