PDA

View Full Version : getBitmap()



MadBeardMan
January 12th, 2019, 23:22
Evening All,

portraitwidget.getBitmap()

When I run this command, the 'portrait' gets bigger.

Here's this 'good' portrait:

25933

And here, if I run 'portraitwidget.getBitmap()' then it like this:

25934

Here's the code:


local portraitwidget = nil;

function onInit()
local linename = window.getDatabaseNode().createChild("gameline","string").getValue();
local gameline;
if super and super.onInit then
super.onInit();
end
-- set portrait, if available
if window.getDatabaseNode() and window.getDatabaseNode().getName() then
if getName() == "portrait" then
-- full-sized portrait
portraitwidget = window.portrait.addBitmapWidget("portrait_" .. window.getDatabaseNode().getName().. "_charlist");
end
if getName() == "smallportrait" then
-- small portrait
portraitwidget = window.smallportrait.addBitmapWidget("portrait_" .. window.getDatabaseNode().getName().. "_token");
end
end
if portraitwidget and portraitwidget.getBitmap() and window.logo then
window.logo.setVisible(false);
end
-- set gameline-related stuff
if linename=="" then
linename = LineManager.getDefaultName();
end
gameline = LineManager.getLine(linename);
if gameline then
setTooltipText(gameline.FullName);
end
if User.isHost() then
setMenus();
end
end

And here's the code for the portrait in the character sheets:


<portrait_char name="portrait">
<bounds>-115,15,75,75</bounds>
<script file="campaign/scripts/charsheet_portrait.lua" />
</portrait_char>

So why does 'getBitmap()' make the image bigger?

Thanks,
Col

damned
January 12th, 2019, 23:30
I think whatever you are doing is losing the auto-scaling that occurs when you add the Token to the Charsheet.
You should look at the CoreRPG code that scales the Portrait when added to the Charsheet.

MadBeardMan
January 12th, 2019, 23:43
I think whatever you are doing is losing the auto-scaling that occurs when you add the Token to the Charsheet.
You should look at the CoreRPG code that scales the Portrait when added to the Charsheet.

Thanks Chap,

Where's the code in the CoreRPG as I can find it for the Tokens, but not for the portrait.

But it works fine, if I can't run the 'getBitmap()', but I need to run that hence why I'd like to 'fix' this bug.

Cheers,
Col

pindercarl
January 13th, 2019, 00:09
I think the character portrait on the character sheet in CoreRPG is using a generic control (not a bitmap widget) and setIcon. Images larger than a generic control will be scaled to fit. [Usual disclaimer: I don't work on mainline code, I haven't looked at this thoroughly, etc..]

Moon Wizard
January 13th, 2019, 03:40
Yes, the PC portraits on PC sheets in CoreRPG-based rulesets uses genericcontrol and setIcon function.
The template you are looking for is called "portrait".

Regards,
JPG