FaceGen 3 SDKs Reference
Loading...
Searching...
No Matches
Fg3ImgIo.cpp
1//
2// Copyright (c) Singular Inversions Inc. 2010
3//
4// Authors: Andrew Beatty
5// Created: July 7, 2010
6//
7
8#include "stdafx.h"
9
10#include "Fg3ImgIo.hpp"
11
12using namespace std;
13
14namespace Fg {
15
16void
17fg3ImgConvert(
18 const FimImgRgbaUbC & in,
19 ImgRgba8 & out)
20{
21 out.resize(in.width(),in.height());
22 for (uint row=0; row<out.height(); ++row)
23 for (uint col=0; col<out.width(); ++col)
24 out.xy(col,row) = *(Rgba8*)(&(in[row][col]));
25}
26
27void
28fg3ImgConvert(
29 const FimImgRgbaFC & in,
30 ImgRgba8 & out)
31{
32 out.resize(in.width(),in.height());
33 for (uint row=0; row<out.height(); ++row)
34 for (uint col=0; col<out.width(); ++col)
35 out.xy(col,row) =
36 Rgba8(
37 uchar(in[row][col].c[0]),
38 uchar(in[row][col].c[1]),
39 uchar(in[row][col].c[2]),
40 uchar(in[row][col].c[3]));
41}
42
43void
44fg3ImgConvert(
45 ImgRgba8 const & in,
46 FimImgRgbaUbC & out)
47{
48 out.resize(in.width(),in.height());
49 for (uint row=0; row<out.height(); ++row)
50 for (uint col=0; col<out.width(); ++col)
51 out[row][col] = *(FimRgbaUbC*)(&in.xy(col,row));
52}
53
54void
55fg3ImgReadAnyFormat(
56 String8 const & fname,
57 FimImgRgbaUbC & img)
58{
59 ImgRgba8 img2 = loadImage(fname);
60 fg3ImgConvert(img2,img);
61}
62
63}