It is currently 20 Apr 2024, 01:10
   
Text Size

The Art of Things to Come

Discuss Upcoming Releases, Coding New Cards, Etc.
PLEASE DO NOT REPORT BUGS HERE!

Moderators: BAgate, drool66, Aswan jaguar, gmzombie, stassy, CCGHQ Admins

Re: The Art of Things to Come

Postby Korath » 25 Oct 2020, 09:52

You're already using a different frameset for portrait art; just change the art position in [SmallCard]. There should be no need for this hack , and certainly not in cardartlib (though a bit in drawcardlib's TranslucentColorless to suppress drawing art over the entire smallcard while allowing its other options would be convenient).
artheight.jpg
Left normal; right 0/0 - 1000/1700
User avatar
Korath
DEVELOPER
 
Posts: 3707
Joined: 02 Jun 2013, 05:57
Has thanked: 496 times
Been thanked: 1106 times

Re: The Art of Things to Come

Postby drool66 » 26 Oct 2020, 00:11

That is much simpler, but Korath maybe you can help me... again.
I do see what you mean about the toggle for drawing the full art in DrawSmallCard, and it should be easy enough. I can add it once this is straightened out.
But for one, I can't get the same results without taking a hammer to FullArtBar.dat, ruining the rest of the cards that use it in the process. As is, all the cards using FullArtBar w/o ColorlessTranslucent settings look ok, albeit with this in deckbuilder (duel is fine):
Screenshot (44).png

...but I can't get Emrakul to do the same, even trying all different permutations of ColorlessTranslucent bits. I would think it would be =FRAMES_TRANSLUCENT_COLORLESS_REDRAW_SMALLCARD_ART (ie. 4). But she still looks like this no matter what I do:
Screenshot (48).png
Screenshot (48).png (52.99 KiB) Viewed 4228 times


Her legacy is great though:
Screenshot (47).png
Screenshot (47).png (50.32 KiB) Viewed 4228 times


I've set ArtHeight = 1309, which is the proportion to the ArtWidth for the image I'm using (attached). I've also tried h=1354;w=1000;top=0;left=0

What could I be missing? Do I need to make a change to drawcardlib? Any way to get these working for all FullArtBar frames?

While we're on the topic, thank you very much for cleaning up the ArtIsPortrait system.
Attachments
Emrakul, the Aeons Torn.jpg
User avatar
drool66
Programmer
 
Posts: 1163
Joined: 25 Nov 2010, 22:38
Has thanked: 186 times
Been thanked: 267 times

Re: The Art of Things to Come

Postby Korath » 26 Oct 2020, 01:49

Any TranslucentColorless option of 0 or greater makes smallcards ignore the art positioning and draw it at 0,0-1000,1000. If you look closely at my image you'll see the name bar on the right is fully opaque.

The reason too-big art draws outside smallcards in the deckbuilder but not duel is because duel creates a new window for each smallcard, while the deckbuilder renders smallcards into a larger one. Another call to IntersectClipRect() to card_rect near the start of draw_smallcard_art(), or, better, DrawSmallCard() should fix it.
User avatar
Korath
DEVELOPER
 
Posts: 3707
Joined: 02 Jun 2013, 05:57
Has thanked: 496 times
Been thanked: 1106 times

Re: The Art of Things to Come

Postby drool66 » 26 Oct 2020, 22:22

Ok, thanks again. The cards are looking the same as before, but now done within DrawSmallCard() rather than DrawSmallArt(). I also added the option to suppress the art drawn over the entire card area. I do have one question though, just to make sure I did this right and I haven't done some hack job again. The code for DrawSmallArt() now looks in part like this:

Code: Select all
int
DrawSmallCard(HDC hdc, const RECT* card_rect, const card_ptr_t* cp, int version, int mode, int player, int card)
{
...Same, until we get to...

  if (parent == PARENT_OTHER)
   IntersectClipRect(hdc, 0, 0, 6*(card_rect->right - card_rect->left), 7.5*(card_rect->bottom - card_rect->top));

#pragma message "suppress for nyx frames"
  GpImageAttributes* alpha_xform = NULL;
  PicHandleNames orig_framenum = framenum;
  if (BASE_FRAME(framenum) == FRAME_MODERN_SPELL_COLORLESS && colorless_option >= 0)
   {
     if( !(colorless_option & FRAMES_TRANSLUCENT_COLORLESS_NO_SMALLCARD_BACKGROUND_ART) ){
      if( colorless_option & FRAMES_TRANSLUCENT_COLORLESS_SMALLART_FULLSIZE ){
         RECT full_art_rect = {0, 0, card_rect->right - card_rect->left, 1.25*((card_rect->right - card_rect->left)*GetArtHeight(cp->id, version))/GetArtWidth(cp->id, version)};
         draw_smallcard_art(hdc, &full_art_rect, cp->id, version, 1, 0, 0);
      }
      else{
         draw_smallcard_art(hdc, card_rect, cp->id, version, 1, 0, 0);
      }
     }
     framenum = FRAMEPART_FROM_BASE(CARDOV_MODERN_COLORLESS, cfg);
     alpha_xform = cfg->colorless_alpha_xform;
     colorless_option |= FRAMES_TRANSLUCENT_COLORLESS_ENABLED;
   }
  else
etc....
I just don't know where the 6 & 7.5 (and by extension, the 1.25) coefficients came from and I don't see them anywhere else. Again, just want to make sure I'm doing this properly before I commit & release.
User avatar
drool66
Programmer
 
Posts: 1163
Joined: 25 Nov 2010, 22:38
Has thanked: 186 times
Been thanked: 267 times

Re: The Art of Things to Come

Postby Korath » 26 Oct 2020, 23:05

On the IntersectClipRect() call:
I don't know where you came up with 6 and 7.5 at all. I don't see them anywhere in the current source. Did you get them experimentally?

I would guess, if you clip at the time you do, it should be to 0,0 - 800,1120. IntersectClipRect() uses logical coordinates, and that's after we've set mapped the logical coordinates to those.

I'd similarly guess that you'd clip to card_rect->left,card_rect->top - card_rect->right,card_rect->bottom if you did it before remapping, immediately after the SaveDC call; but clipping after remapping should be more reliable, since we wouldn't have to guess at (or query for) the previous mapping.

The way to find out for sure is to draw a rectangle instead of clipping, and verify that it's always to the same area as the card.


On the rest:
The only change necessary to make the drawn art honor the ArtLeft etc. values is to the second-last parameter of draw_smallcard_art(). Just change
draw_smallcard_art(hdc, card_rect, cp->id, version, 1, 0, 0);
to
draw_smallcard_art(hdc, card_rect, cp->id, version, 1, (colorless_option & WHATEVER_CONSTANT_YOU_PICKED) ? 1 : 0, 0);
What you currently have looks, without testing, like it'll change the art position if your eldrazi becomes colored (Painter's Servant should be an easy test, since lacing Emrakul is problematic). The entire goal of this is to be able to draw the art is the same place whether the card's colorless or not. And hardcoding the proportion in this dll isn't any better than doing it in cardartlib.

Please do not change indentation or brace styles in projects where one's been established. Manalink proper is an unholy unreadable mix of anything and everything, but all the other projects are self-consistent.
User avatar
Korath
DEVELOPER
 
Posts: 3707
Joined: 02 Jun 2013, 05:57
Has thanked: 496 times
Been thanked: 1106 times

Re: The Art of Things to Come

Postby drool66 » 27 Oct 2020, 19:05

I don't know where you came up with 6 and 7.5 at all. I don't see them anywhere in the current source. Did you get them experimentally?
Yes - maybe these are the factors by which card_rect is scaled up in SetWindowExtEx etc. In any case, you were right, setting it to card_rect->left/top/right/bottom right after SaveDC worked perfectly

The only change necessary to make the drawn art honor the ArtLeft etc. values is to the second-last parameter of draw_smallcard_art(). Just change
draw_smallcard_art(hdc, card_rect, cp->id, version, 1, 0, 0);
to
draw_smallcard_art(hdc, card_rect, cp->id, version, 1, (colorless_option & WHATEVER_CONSTANT_YOU_PICKED) ? 1 : 0, 0);
What you currently have looks, without testing, like it'll change the art position if your eldrazi becomes colored (Painter's Servant should be an easy test, since lacing Emrakul is problematic). The entire goal of this is to be able to draw the art is the same place whether the card's colorless or not. And hardcoding the proportion in this dll isn't any better than doing it in cardartlib.
Good call. I think I see what you mean but unless I completely misunderstand, it didn't work out quite that simply. Once the color is changed, BASEFRAME(framenum) changes as well (it follows card_pointer->color) so the whole thing gets kicked down to its "else", which begins by clearing colorless_option. And yes, the result was suboptimal. What we need is a way to differentiate a Blood Knight from a painted Emrakul, and I accomplished that by using the card_data (slow, I know):

Code: Select all
  if (parent == PARENT_OTHER)
   IntersectClipRect(hdc, card_rect->left, card_rect->top, card_rect->right, card_rect->bottom);


  SetMapMode(hdc, MM_ANISOTROPIC);
  SetWindowExtEx(hdc, 800, 1120, NULL);
  SetViewportExtEx(hdc, card_rect->right - card_rect->left, card_rect->bottom - card_rect->top, NULL);
  SetWindowOrgEx(hdc, 0, 0, NULL);
  SetViewportOrgEx(hdc, card_rect->left, card_rect->top, NULL);

  const Rarities* r = get_rarity(cp->id);
  PicHandleNames framenum = select_frame(cp, r, -1, -1, version);
  int colorless_option;
  if (framenum == CARDBACK)
   {
     colorless_option = cfg->frames_facedown_creature;
     framenum = FRAME_MODERN_SPELL_COLORLESS;
   }
  else
   colorless_option = cfg->frames_translucent_colorless;

//this section
  int tc = 0;
  if ( (parent == PARENT_MANALINK || parent == PARENT_SHANDALAR) && colorless_option >= 0 )
   {
     const card_data_t* cd = get_card_data_from_csvid(cp->id);
     if ( cd && cd->color == COLOR_TEST_COLORLESS && cd->type != TYPE_ARTIFACT && cd->type != TYPE_LAND )
      tc = 1;
   }
//
#pragma message "suppress for nyx frames"
  GpImageAttributes* alpha_xform = NULL;
  PicHandleNames orig_framenum = framenum;
  if ( (BASE_FRAME(framenum) == FRAME_MODERN_SPELL_COLORLESS || tc) && colorless_option >= 0 )
   {
     if ( !(colorless_option & FRAMES_TRANSLUCENT_COLORLESS_NO_SMALLCARD_BACKGROUND_ART) )
      {
        if ( colorless_option & FRAMES_TRANSLUCENT_COLORLESS_SMALLART_FULLSIZE )
         {
           RECT full_art_rect = {card_rect->left, card_rect->top, card_rect->right, 1.4*(card_rect->right*GetArtHeight(cp->id, version))/GetArtWidth(cp->id, version)};
           draw_smallcard_art(hdc, &full_art_rect, cp->id, version, 1, !BASE_FRAME(framenum) == FRAME_MODERN_SPELL_COLORLESS, 0);
         }
        else
         {
           draw_smallcard_art(hdc, card_rect, cp->id, version, 1, 0, 0);
         }
      }
     if ( BASE_FRAME(framenum) == FRAME_MODERN_SPELL_COLORLESS )
      {
        framenum = FRAMEPART_FROM_BASE(CARDOV_MODERN_COLORLESS, cfg);
        alpha_xform = cfg->colorless_alpha_xform;
      }
     colorless_option |= FRAMES_TRANSLUCENT_COLORLESS_ENABLED;
   }
  else
   {
     colorless_option = 0;
     if (cfg->smallcard_art_first)
      draw_smallcard_art(hdc, card_rect, cp->id, version, 1, 1, 0);
   }
I accomplished the same thing with the full card in drawfullcard.c->draw_art_first()
Code: Select all
  int tc = 0;
  if ( (parent == PARENT_MANALINK || parent == PARENT_SHANDALAR) && colorless_option >= 0 )
   {
     const card_data_t* cd = get_card_data_from_csvid(csvid);
     if ( cd && cd->color == COLOR_TEST_COLORLESS && cd->type != TYPE_ARTIFACT && cd->type != TYPE_LAND )
      tc = 1;
   }

#pragma message "suppress for nyx frames"
  if ( (BASE_FRAME(framenum) == FRAME_MODERN_SPELL_COLORLESS || tc) && colorless_option >= 0)
   {
     *suppress_later_art = 1;

     if (cardback)
      {
        make_gpic_from_pic(CARDBACK);
        gdip_blt_whole(hdc, &cfg->fullcard_frame, CARDBACK, NULL);
        *big_art_exists = 1;
        return TFM_CARDBACK;
      }
     else
      {
        *big_art_exists = draw_fullcard_art(hdc, &cfg->fullcard_frame, csvid, pic_version);
        if (colorless_option & FRAMES_TRANSLUCENT_COLORLESS_ALSO_NORMAL_FULLCARD_ART)
         return TFM_COLORLESS_ALSO_NORMAL_FULLCARD_ART;
        else if( BASE_FRAME(framenum) == FRAME_MODERN_SPELL_COLORLESS )
         return TFM_COLORLESS;
        else
         return TFM_NORMAL;
      }
   }
  else
Everything seems to work perfectly and beautifully as far as I can tell. Do you think the "iid_for_color" approach used in select_frame() would be better? Please let me know if you think there's anything I should change or clean up.
PS the 1.4 factor in full_art_rect is to compensate for the distortion in the logical size; 1120/800 = 1.4
User avatar
drool66
Programmer
 
Posts: 1163
Joined: 25 Nov 2010, 22:38
Has thanked: 186 times
Been thanked: 267 times

Re: The Art of Things to Come

Postby Korath » 27 Oct 2020, 21:51

When it gets kicked down to the else clause, all it does is call draw_smallcard_art(hdc, card_rect, cp->id, version, 1, 1, 0);. That's exactly equivalent to draw_smallcard_art(hdc, card_rect, cp->id, version, 1, (colorless_option & WHATEVER_CONSTANT_YOU_PICKED) ? 1 : 0, 0);. Which is the goal.

"!BASE_FRAME(framenum) == FRAME_MODERN_SPELL_COLORLESS" is always 0.

There's no cause to call GetArtHeight() or GetArtWidth() at all. The place to account for the size ratio is in the config for your fullart styles.
blood aeons.jpg
The one-line change above, and changing FullArtBar.dat to set TranslucentColorless=8 and [SmallCard]ArtLeft/ArtTop/ArtRight/ArtBottom was all that was needed to get this. (And maybe implement Moonlace or Ersatz Gnomes in Manalink; they're both trivial, I didn't think to try Xathrid Gorgon, and having to reboot to Shandalar was irritating.) And this is the imagery we're trying to get, isn't it?

Also, explicitly setting IntersectClipRect(hdc, 0, 0, 800, 1120) after mapping logical coords instead of clipping to card_rect before, and to do so regardless of parent, really is necessary. It breaks in Shandalar otherwise. I suppose you could still skip it if parent == PARENT_MANALINK, but it's harmless not to.
User avatar
Korath
DEVELOPER
 
Posts: 3707
Joined: 02 Jun 2013, 05:57
Has thanked: 496 times
Been thanked: 1106 times

Re: The Art of Things to Come

Postby drool66 » 28 Oct 2020, 01:15

Oh gosh, I see what you're saying. Thank you for being so patient with me, I was a little thick there. Getting to it now.
User avatar
drool66
Programmer
 
Posts: 1163
Joined: 25 Nov 2010, 22:38
Has thanked: 186 times
Been thanked: 267 times

Previous

Return to Development

Who is online

Users browsing this forum: No registered users and 40 guests


Who is online

In total there are 40 users online :: 0 registered, 0 hidden and 40 guests (based on users active over the past 10 minutes)
Most users ever online was 4143 on 23 Jan 2024, 08:21

Users browsing this forum: No registered users and 40 guests

Login Form